Re: [PATCH v2 4/5] selftests: Drop define _GNU_SOURCE

Sean Christopherson
2024-05-08T13:54:43Z

On Tue, May 07, 2024, Edward Liaw wrote:
> _GNU_SOURCE is provided by KHDR_INCLUDES, so it should be dropped to
> prevent _GNU_SOURCE redefined warnings.

...

> diff --git a/tools/testing/selftests/x86/test_syscall_vdso.c b/tools/testing/selftests/x86/test_syscall_vdso.c
> index 8965c311bd65..5cd13279bba5 100644
> --- a/tools/testing/selftests/x86/test_syscall_vdso.c
> +++ b/tools/testing/selftests/x86/test_syscall_vdso.c
> @@ -8,10 +8,6 @@
> * Can be built statically:
> * gcc -Os -Wall -static -m32 test_syscall_vdso.c thunks_32.S
> */
> -#undef _GNU_SOURCE
> -#define _GNU_SOURCE 1
> -#undef __USE_GNU
> -#define __USE_GNU 1

AFAICT, manually defining __USE_GNU is frowned upon, so I'm guessing the __USE_GNU
stuff is just the result of misguided copy+paste. But it would be nice to get
confirmation that this test isn't doing something clever. Or at the very least,
explain the removal of __USE_GNU in the changelog.

> #include <unistd.h>
> #include <stdlib.h>
> #include <string.h>