Skip to contentSkip to conversation

kselftest/alsa: Ensure _GNU_SOURCE is defined

PATCH In review Mark Brown 4 participants 4 messages May 16, 2024 – May 20, 2024

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 kselftest/alsa: Ensure _GNU_SOURCE is defined

The pcmtest driver tests use the kselftest harness which requires that _GNU_SOURCE is defined but nothing causes it to be defined. Since the KHDR_INCLUDES Makefile variable has had the required define added let's use that, this should provide some futureproofing.

Fixes daef47b89efd ("selftests: Compile kselftest headers with -D_GNU_SOURCE")
---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -1
index 5af9ba8a4645..c1ce39874e2b 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-CFLAGS += $(shell pkg-config --cflags alsa)
+CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
 LDLIBS += $(shell pkg-config --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound

---
base-commit: 3c999d1ae3c75991902a1a7dad0cb62c2a3008b4
change-id: 20240516-kselftest-fix-gnu-source-81ddd00870a8

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mark Brown

The pcmtest driver tests use the kselftest harness which requires that _GNU_SOURCE is defined but nothing causes it to be defined. Since the KHDR_INCLUDES Makefile variable has had the required define added let's use that, this should provide some futureproofing.

Fixes daef47b89efd ("selftests: Compile kselftest headers with -D_GNU_SOURCE")
Quoted 23 lines
---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -2
index 5af9ba8a4645..c1ce39874e2b 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-CFLAGS += $(shell pkg-config --cflags alsa)
+CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
 LDLIBS += $(shell pkg-config --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound
 
---

base-commit: 3c999d1ae3c75991902a1a7dad0cb62c2a3008b4
change-id: 20240516-kselftest-fix-gnu-source-81ddd00870a8

Best regards,

Signature · 2 lines
BR,
Muhammad Usama Anjum
Acked-by on v1 1/1
#2 lore raw
In reply to Mark Brown
Quoted 8 lines · Mark Brown

The pcmtest driver tests use the kselftest harness which requires that _GNU_SOURCE is defined but nothing causes it to be defined. Since the KHDR_INCLUDES Makefile variable has had the required define added let's use that, this should provide some futureproofing.

Fixes daef47b89efd ("selftests: Compile kselftest headers with -D_GNU_SOURCE")

The commit isn't yet in the Linus upstream tree but only in linux-next. I guess it's better to put the fix in the tree (Shuah's?) that introduced this change. So feel free to take my ack:

thanks,

Takashi

Quoted 26 lines
---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -2
index 5af9ba8a4645..c1ce39874e2b 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-CFLAGS += $(shell pkg-config --cflags alsa)
+CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
 LDLIBS += $(shell pkg-config --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound
 
---

base-commit: 3c999d1ae3c75991902a1a7dad0cb62c2a3008b4
change-id: 20240516-kselftest-fix-gnu-source-81ddd00870a8

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
maintainer
#3 lore raw
Quoted 8 lines · Takashi Iwai
Quoted 6 lines · Mark Brown

The pcmtest driver tests use the kselftest harness which requires that _GNU_SOURCE is defined but nothing causes it to be defined. Since the KHDR_INCLUDES Makefile variable has had the required define added let's use that, this should provide some futureproofing.

Quoted 10 lines
Quoted 2 lines
Fixes daef47b89efd ("selftests: Compile kselftest headers with -D_GNU_SOURCE")

The commit isn't yet in the Linus upstream tree but only in linux-next. I guess it's better to put the fix in the tree (Shuah's?) that introduced this change. So feel free to take my ack:

Thank you. I will take this through my tree.

thanks,
-- Shuah