libcheck / check

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

msys2: huge amount of warnings like : "warning: too many arguments for format" #274

Closed vtorri closed 4 years ago

vtorri commented 4 years ago

example :

  CC       ex_output.o
In file included from ex_output.c:26:
ex_output.c: In function 'test_pass_fn':
../src/check.h:537:44: warning: too many arguments for format [-Wformat-extra-args]
  537 |      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
      |                                            ^~~~~~~~~~~~~
ex_output.c:31:5: note: in expansion of macro 'ck_assert_msg'
   31 |     ck_assert_msg(1 == 1, "Shouldn't see this");
      |     ^~~~~~~~~~~~~
ex_output.c: In function 'test_fail_fn':
../src/check.h:556:65: warning: too many arguments for format [-Wformat-extra-args]
  556 | #define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
      |                                                                 ^~~~~~~~
ex_output.c:37:5: note: in expansion of macro 'ck_abort_msg'
   37 |     ck_abort_msg("Failure");
      |     ^~~~~~~~~~~~
ex_output.c: In function 'test_pass2_fn':
../src/check.h:537:44: warning: too many arguments for format [-Wformat-extra-args]
  537 |      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
      |                                            ^~~~~~~~~~~~~
ex_output.c:66:5: note: in expansion of macro 'ck_assert_msg'
   66 |     ck_assert_msg(1 == 1, "Shouldn't see this");
      |     ^~~~~~~~~~~~~
ex_output.c: In function 'test_loop_fn':
../src/check.h:537:44: warning: too many arguments for format [-Wformat-extra-args]
  537 |      _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
      |                                            ^~~~~~~~~~~~~
ex_output.c:72:5: note: in expansion of macro 'ck_assert_msg'
   72 |     ck_assert_msg(_i == 1, "Iteration %d failed", _i);
      |     ^~~~~~~~~~~~~
ex_output.c: In function 'test_xml_esc_fail_msg_fn':
../src/check.h:556:65: warning: too many arguments for format [-Wformat-extra-args]
  556 | #define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
      |                                                                 ^~~~~~~~
ex_output.c:78:5: note: in expansion of macro 'ck_abort_msg'
   78 |     ck_abort_msg("fail \" ' < > & \x9 \xA" "X""\x08"" message"); /* backspace char \x08 deletes the X */
      |     ^~~~~~~~~~~~
  CCLD     ex_output.exe
brarcher commented 4 years ago

This should now be resolved in #272. The MSYS2 build (nor the other builds) have this now. See this for an example.