kselftest: Desecalate reporting of missing _GNU_SOURCE
Subsystems (2)
PATCH 1/1 kselftest: Desecalate reporting of missing _GNU_SOURCE
Commit daef47b89efd0b7 ("selftests: Compile kselftest headers with -D_GNU_SOURCE") adds a static_assert() which means that things which would be warnings about undeclared functions get escalated into build failures. While we do actually want _GNU_SOURCE to be defined for users of kselftest_harness we haven't actually done that yet and this is causing widespread build breaks which were previously warnings about uses of asprintf() without prototypes, including causing other test programs in the same directory to fail to build.
Since the build failures that are introduced cause additional issues due to make stopping builds early replace the static_assert() with a missing without making the error more severe than it already was. This will be moot once the issue is fixed properly but reduces the disruption while that happens.
--- tools/testing/selftests/kselftest_harness.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kselftest_harness.h +1 -1
@@ -51,7 +51,7 @@#define __KSELFTEST_HARNESS_H#ifndef _GNU_SOURCE -static_assert (0 ,"kselftest harness requires _GNU_SOURCE to be defined" ); +#warning kselftest harness requires _GNU_SOURCE to be defined#endif #include <asm/types.h> #include <ctype.h>
---
base-commit: 3c999d1ae3c75991902a1a7dad0cb62c2a3008b4
change-id: 20240516-kselftest-mitigate-gnu-source-b41b2d2cb8a1
Best regards,
Signature · 1 line
Mark Brown <[email protected]>
Quoted 9 lines · Mark Brown
Commit
daef47b89efd0b7("selftests: Compile kselftest headers with -D_GNU_SOURCE") adds astatic_assert()which means that things which would be warnings about undeclared functions get escalated into build failures. While we do actually want_GNU_SOURCEto be defined for users ofkselftest_harnesswe haven't actually done that yet and this is causing widespread build breaks which were previously warnings about uses ofasprintf()without prototypes, including causing other test programs in the same directory to fail to build.
Quoted 7 lines
Since the build failures that are introduced cause additional issues due to make stopping builds early replace the
static_assert()with a missing without making the error more severe than it already was. This will be moot once the issue is fixed properly but reduces the disruption while that happens.Signed-off-by Mark Brown <[email protected]>
Signature · 1 line
Kees Cook