Commit daef47b8 authored by Edward Liaw's avatar Edward Liaw Committed by Shuah Khan

selftests: Compile kselftest headers with -D_GNU_SOURCE

Add the -D_GNU_SOURCE flag to KHDR_INCLUDES so that it is defined in a
central location.

Commit 80921623 ("selftests/harness: remove use of LINE_MAX")
introduced asprintf into kselftest_harness.h, which is a GNU extension
and needs _GNU_SOURCE to either be defined prior to including headers or
with the -D_GNU_SOURCE flag passed to the compiler.

Fixed up commit log:
Shuah Khan <skhan@linuxfoundation.org>

Fixes: 80921623 ("selftests/harness: remove use of LINE_MAX")
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202404301040.3bea5782-oliver.sang@intel.comSigned-off-by: default avatarEdward Liaw <edliaw@google.com>
Reviewed-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Reviewed-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 14d28ec6
...@@ -161,11 +161,11 @@ ifneq ($(KBUILD_OUTPUT),) ...@@ -161,11 +161,11 @@ ifneq ($(KBUILD_OUTPUT),)
# $(realpath ...) resolves symlinks # $(realpath ...) resolves symlinks
abs_objtree := $(realpath $(abs_objtree)) abs_objtree := $(realpath $(abs_objtree))
BUILD := $(abs_objtree)/kselftest BUILD := $(abs_objtree)/kselftest
KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_objtree}/usr/include
else else
BUILD := $(CURDIR) BUILD := $(CURDIR)
abs_srctree := $(shell cd $(top_srcdir) && pwd) abs_srctree := $(shell cd $(top_srcdir) && pwd)
KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_srctree}/usr/include
DEFAULT_INSTALL_HDR_PATH := 1 DEFAULT_INSTALL_HDR_PATH := 1
endif endif
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#define __KSELFTEST_HARNESS_H #define __KSELFTEST_HARNESS_H
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE static_assert(0, "kselftest harness requires _GNU_SOURCE to be defined");
#endif #endif
#include <asm/types.h> #include <asm/types.h>
#include <ctype.h> #include <ctype.h>
......
...@@ -53,7 +53,7 @@ selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) ...@@ -53,7 +53,7 @@ selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
top_srcdir = $(selfdir)/../../.. top_srcdir = $(selfdir)/../../..
ifeq ($(KHDR_INCLUDES),) ifeq ($(KHDR_INCLUDES),)
KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include KHDR_INCLUDES := -D_GNU_SOURCE -isystem $(top_srcdir)/usr/include
endif endif
# The following are built by lib.mk common compile rules. # The following are built by lib.mk common compile rules.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment