Skip to content

Commit

Permalink
fix tests -Wmultistatement-macros
Browse files Browse the repository at this point in the history
newer gcc (9):
test_private.h:329:5: warning: macro expands to multiple statements [-Wmultistatement-macros]
     ind = strcmp((s1), (s2));                                                  \
     ^~~
test_gets_s.c:81:10: note: in expansion of macro 'EXPSTR'
     else EXPSTR(sub, "1234");
          ^~~~~~
test_gets_s.c:81:5: note: some parts of macro expansion are not guarded by this 'else' clause
     else EXPSTR(sub, "1234");
  • Loading branch information
rurban committed Jun 1, 2019
1 parent 4e145a4 commit fa5b54d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions build-aux/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ echo "gcc-mp-7 --enable-unsafe"
CC="gcc-mp-7" ./configure --enable-unsafe && \
gmake -s -j4 check-log || exit
gmake -s -j4 clean
echo "gcc-mp-8 -march=native --enable-unsafe"
CC="gcc-mp-8 -march=native" ./configure --enable-unsafe && \
gmake -s -j4 check-log || exit
gmake -s -j4 clean
echo "gcc-mp-9 --enable-unsafe"
CC="gcc-mp-9 -march=native" ./configure --enable-unsafe && \
gmake -s -j4 check-log || exit
gmake -s -j4 clean
echo "gcc-mp-7 -march=native -Wa,-q --enable-unsafe"
CC="gcc-mp-7 -march=native -Wa,-q" ./configure --enable-unsafe && \
gmake -s -j4 check-log || exit
Expand Down
12 changes: 7 additions & 5 deletions tests/test_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,13 @@ static inline void *bnd_chk_malloc(size_t n) {
errs++; \
}
#define EXPSTR(s1, s2) \
ind = strcmp((s1), (s2)); \
if (ind != 0) { \
debug_printf("%s %u Expected \"%s\", got \"%s\" \n", __FUNCTION__, \
__LINE__, (s2), s1); \
errs++; \
{ \
ind = strcmp((s1), (s2)); \
if (ind != 0) { \
debug_printf("%s %u Expected \"%s\", got \"%s\" \n", \
__FUNCTION__, __LINE__, (s2), s1); \
errs++; \
} \
}
#define WEXPNULL(s1) \
if ((s1)[0] != L'\0') { \
Expand Down

0 comments on commit fa5b54d

Please sign in to comment.