[PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

Vitaly Chikunov vt at altlinux.org
Wed May 22 01:10:31 UTC 2024


On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
> From: Mark Brown <broonie at kernel.org>
> 
> 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.
> 
> Signed-off-by: Mark Brown <broonie at kernel.org>
> Reviewed-by: Kees Cook <keescook at chromium.org>
> ---
>  tools/testing/selftests/kselftest_harness.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index b634969cbb6f..8e53686b71cb 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -51,7 +51,7 @@
>  #define __KSELFTEST_HARNESS_H
>  
>  #ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> +#warning kselftest harness requires _GNU_SOURCE to be defined

Maybe this should be `#error` if it really requires?

Thanks,

>  #endif
>  #include <asm/types.h>
>  #include <ctype.h>
> -- 
> 2.45.1.288.g0e0cd299f1-goog
> 



More information about the Linux-security-module-archive mailing list