]> git.itanic.dy.fi Git - linux-stable/commitdiff
selftests/resctrl: Move _GNU_SOURCE define into Makefile
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 2 Oct 2023 09:48:10 +0000 (12:48 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 13 Oct 2023 20:54:21 +0000 (14:54 -0600)
_GNU_SOURCE is defined in resctrl.h. Defining _GNU_SOURCE has a large
impact on what gets defined when including headers either before or
after it. This can result in compile failures if .c file decides to
include a standard header file before resctrl.h.

It is safer to define _GNU_SOURCE in Makefile so it is always defined
regardless of in which order includes are done.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/resctrl/Makefile
tools/testing/selftests/resctrl/resctrl.h

index 5073dbc9612582ddd2e0c139dfc02ab59caa2839..2deac2031de9e029ca232ae4806c0d76b7c8420f 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2
+CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
 CFLAGS += $(KHDR_INCLUDES)
 
 TEST_GEN_PROGS := resctrl_tests
index dd07463cdf48af8bca1eec4a1d441d01a306386a..d9b5df95849defb886a3ea682ac16bf983f62e9a 100644 (file)
@@ -1,5 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#define _GNU_SOURCE
 #ifndef RESCTRL_H
 #define RESCTRL_H
 #include <stdio.h>