Since Clang doesn't properly handle
/* FALLTHROUGH */
in elf/tst-align2.c nor
/* fall through */
in misc/tst-tsearch.c
tst-align2.c:100:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
100 | case 'A':
| ^
tst-align2.c:100:9: note: insert '__attribute__((fallthrough));' to silence this warning
100 | case 'A':
| ^
| __attribute__((fallthrough));
tst-align2.c:100:9: note: insert 'break;' to avoid fall-through
100 | case 'A':
| ^
| break;
suppress them when compiled with Clang.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
#include <sys/wait.h>
#include <tst-stack-align.h>
#include <unistd.h>
+#include <libc-diag.h>
static int res, fds[2], result;
static bool test_destructors;
int des_seen = 0, dso_des_seen = 0;
while ((len = TEMP_FAILURE_RETRY (read (fds[0], &c, 1))) > 0)
{
+ DIAG_PUSH_NEEDS_COMMENT_CLANG;
+ DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.2, "-Wimplicit-fallthrough");
switch (c)
{
case 'B':
result = 1;
break;
}
+ DIAG_POP_NEEDS_COMMENT_CLANG;
}
close (fds[0]);
#include <search.h>
#include <tst-stack-align.h>
#include <support/check.h>
+#include <libc-diag.h>
#define SEED 0
#define BALANCED 1
abort ();
}
+ DIAG_PUSH_NEEDS_COMMENT_CLANG;
+ DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.2, "-Wimplicit-fallthrough");
switch (what)
{
case build_and_del:
break;
}
+ DIAG_POP_NEEDS_COMMENT_CLANG;
}
}