ports/unix/check: Ignore error from fail_* macros

Usage of fail_if/fail_unless macros with a message results in a
warning with the latest version of check (0.15.2+) and GCC.

Ignore this specific error (since warnings are treated as errors) for now.

Example failure:

In file included from ../../../../src/../test/unit/lwip_check.h:7,
                 from ../../../../src/../test/unit/lwip_unittests.c:1:
../../../../src/../test/unit/lwip_unittests.c: In function ‘lwip_check_ensure_no_alloc’:
../../../../src/../test/unit/lwip_unittests.c:55:7: error: too many arguments for format [-Werror=format-extra-args]
   55 |       "mem heap still has %d bytes allocated", lwip_stats.mem.used);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Erik Ekman 2021-01-13 21:44:20 +01:00
parent 7b77378ed8
commit ecab77654a

View File

@ -37,6 +37,11 @@ LWIPDIR=../../../../src
# The include path to sys_arch.h and lwipopts.h must be first, so this must be before Common.mk # The include path to sys_arch.h and lwipopts.h must be first, so this must be before Common.mk
CFLAGS=-DLWIP_NOASSERT_ON_ERROR -I/usr/include/check -I$(LWIPDIR)/../test/unit CFLAGS=-DLWIP_NOASSERT_ON_ERROR -I/usr/include/check -I$(LWIPDIR)/../test/unit
# Ignore 'too many arguments for format' warnings which happen with GCCs
# from check 0.15.2 on fail_if/fail_unless macros with text.
# See https://github.com/libcheck/check/pull/298/commits/82540c5428d3818b64d
CFLAGS+=-Wno-error=format-extra-args
ifeq (clang,$(findstring clang,$(CC))) ifeq (clang,$(findstring clang,$(CC)))
# check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0 # check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0
CFLAGS+=-Wno-gnu-zero-variadic-macro-arguments CFLAGS+=-Wno-gnu-zero-variadic-macro-arguments