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

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -35,12 +35,12 @@ static void test_large(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
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[] = {
@ -76,7 +76,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -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);
@ -98,12 +98,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
struct item {
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, READER_INIT, "A", 0, 2, 70, "(10) 1 96 33 103 103 103 103 103 68 35", "ModeB FNC3 A Pad (5)" },
@ -130,7 +130,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, 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) {
@ -158,14 +158,14 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NUL U+0000, CodeA-only
@ -246,7 +246,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -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) {
@ -300,13 +300,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, "ab0123456789", 0, 2, 70, "BS EN 12323:2005 Figure 3",
@ -373,7 +373,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, 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) {