From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id E7E813858296; Fri, 3 Feb 2023 04:01:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7E813858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675396873; bh=RpIALamp85AggMSyZUiWbiZkivxF3ry52Fr8FlGT46w=; h=From:To:Subject:Date:From; b=FGenCv6RplHMiU3Zjh+fsKdgliHLocgKtDCdaKRirOX7gWutWMX1LbGUe18HgyszI cdvRKmWINq3XBoQ+JNDBsAYfDlt3s11Wm/Ejj9bzqGx3yllj1bbLrCGdNNQL4+mS+l kbQVWQOAXIZLwuWo5BY4gv9y8J9SK2RONPgDLlDE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Siddhesh Poyarekar To: glibc-cvs@sourceware.org Subject: [glibc] stdlib: tests: don't double-define _FORTIFY_SOURCE X-Act-Checkin: glibc X-Git-Author: Sam James X-Git-Refname: refs/heads/master X-Git-Oldrev: 83d49a53aab1c8e191c007bc986c4d696bc95570 X-Git-Newrev: 35bcb08eaa953c9b8bef6ab2486dc4361e1f26c0 Message-Id: <20230203040113.E7E813858296@sourceware.org> Date: Fri, 3 Feb 2023 04:01:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=35bcb08eaa953c9b8bef6ab2486dc4361e1f26c0 commit 35bcb08eaa953c9b8bef6ab2486dc4361e1f26c0 Author: Sam James Date: Thu Feb 2 23:00:31 2023 -0500 stdlib: tests: don't double-define _FORTIFY_SOURCE If using -D_FORITFY_SOURCE=3 (in my case, I've patched GCC to add =3 instead of =2 (we've done =2 for years in Gentoo)), building glibc tests will fail on testmb like: ``` : error: "_FORTIFY_SOURCE" redefined [-Werror] : note: this is the location of the previous definition cc1: all warnings being treated as errors make[2]: *** [../o-iterator.mk:9: /var/tmp/portage/sys-libs/glibc-2.36/work/build-x86-x86_64-pc-linux-gnu-nptl/stdlib/testmb.o] Error 1 make[2]: *** Waiting for unfinished jobs.... ``` It's just because we're always setting -D_FORTIFY_SOURCE=2 rather than unsetting it first. If F_S is already 2, it's harmless, but if it's another value (say, 1, or 3), the compiler will bawk. (I'm not aware of a reason this couldn't be tested with =3, but the toolchain support is limited for that (too new), and we want to run the tests everywhere possible.) Signed-off-by: Sam James Reviewed-by: Siddhesh Poyarekar Diff: --- stdlib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Makefile b/stdlib/Makefile index e0fc82fc4d..83391d00c1 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -392,7 +392,7 @@ CFLAGS-tst-qsort.c += $(stack-align-test-flags) CFLAGS-tst-makecontext.c += -funwind-tables CFLAGS-tst-makecontext2.c += $(stack-align-test-flags) -CFLAGS-testmb.c += -D_FORTIFY_SOURCE=2 -Wall -Werror +CFLAGS-testmb.c += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Werror # Run a test on the header files we use.