libcheck / check

A unit testing framework for C
GNU Lesser General Public License v2.1
1.07k stars 210 forks source link

Thousands of MACRO expansion warnings #290

Closed zfields closed 4 years ago

zfields commented 4 years ago

Here is a small sample of a couple MACRO expansion errors.

../src/check.h:556:65: warning: too many arguments for format [-Wformat-extra-args]
 #define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
                                                                 ^~~~~~~~
check_check_master.c:554:7: note: in expansion of macro 'ck_abort_msg'
       ck_abort_msg(emsg_escaped);
       ^~~~~~~~~~~~
check_check_master.c: In function 'test_check_failure_lnos_fn':
../src/check.h:537:44: warning: too many arguments for format [-Wformat-extra-args]
      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
                                            ^~~~~~~~~~~~~
check_check_master.c:580:5: note: in expansion of macro 'ck_assert_msg'
     ck_assert_msg(i - passed <= sub_nfailed, NULL);
     ^~~~~~~~~~~~~
../src/check.h:537:44: warning: too many arguments for format [-Wformat-extra-args]
      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)

Not only could these be causing portability problems, but they are also so noisy, I can't see if I'm having any "real warnings" or errors, because I can't even scroll back to the beginning of the build messages.

brarcher commented 4 years ago

This should now be resolved. Check 0.15.1 was released and has a fix.

zfields commented 4 years ago

Confirmed. Thank you!

The only warning(s) left are a handful regarding the modifier u supplied to ar, the archiver utility.

Example:

libtool: link: ar cru .libs/libcompat.a .libs/libcompat.o .libs/fpclassify.o 
ar: `u' modifier ignored since `D' is the default (see `U')
brarcher commented 4 years ago

Thanks for confirming.

I do not think that Check is explicitly setting arguments for ar. The warning might be from something in autotools. I do not see that warning myself, so perhaps it is limited to certain versions of autotools. Feel free to open another bug about it (as this bug was related to the macro warnings). Not sure what can be done about the ar warning, however.