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) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-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
@ -40,12 +40,12 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_GS1_128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" },
@ -194,7 +194,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
char bwipp_buf[8196];
char bwipp_msg[1024];
@ -218,7 +218,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
if (p_ctx->generate) {
if (data[i].ret == 0) {
@ -265,11 +265,11 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -332,7 +332,7 @@ static void test_hrt(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_hrt", &symbol);
@ -351,7 +351,7 @@ static void test_hrt(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, 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);
@ -367,10 +367,10 @@ static void test_hrt(const testCtx *const p_ctx) {
static void test_gs1_verify(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int ret;
char *expected;
char *expected_errtxt;
const char *expected;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -1448,10 +1448,10 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
static void test_gs1_lint(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int ret;
char *expected;
char *expected_errtxt;
const char *expected;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -2144,7 +2144,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int input_mode;
int output_options;
int ret;
@ -2289,7 +2289,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -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->index == -1 && data[i].compare_previous) {
ret = testUtilSymbolCmp(symbol, &previous_symbol);
@ -2312,10 +2312,10 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -2506,7 +2506,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_gs1nocheck_mode", &symbol);
@ -2525,7 +2525,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, 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);