general: reenable -Wpedantic for gcc by using __extension__ (ZEXT)

to suppress warnings about `errtxtf` operand number "%<n>$" args;
  enable some further warnings
test suite: enable -Wpedantic and fix/suppress any warnings
This commit is contained in:
gitlost 2025-01-27 11:03:33 +00:00
parent a4b557786f
commit b377b14360
93 changed files with 1397 additions and 1370 deletions

View file

@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -89,7 +89,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -111,10 +111,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -164,7 +164,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -182,12 +182,12 @@ static void test_input(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -260,7 +260,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -282,14 +282,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE39, -1, "1A", -1, 0, 1, 51, "ISO/IEC 16388:2007 Figure 1",
@ -417,7 +417,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -477,12 +477,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE39, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+", 0, 1, 1130, "CODE39 85" },
@ -525,7 +525,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);