]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Test 17_intro/names.cc with -D_FORTIFY_SOURCE=2 [PR116210]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 4 Oct 2024 11:40:47 +0000 (12:40 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 9 Oct 2024 13:05:50 +0000 (14:05 +0100)
Add a new testcase that repeats 17_intro/names.cc but with
_FORTIFY_SOURCE defined, to find problems in Glibc fortify wrappers like
https://sourceware.org/bugzilla/show_bug.cgi?id=32052 (which is fixed
now).

libstdc++-v3/ChangeLog:

PR libstdc++/116210
* testsuite/17_intro/names.cc (sz): Undef for versions of Glibc
that use it in the fortify wrappers.
* testsuite/17_intro/names_fortify.cc: New test.

libstdc++-v3/testsuite/17_intro/names.cc
libstdc++-v3/testsuite/17_intro/names_fortify.cc [new file with mode: 0644]

index bea2d19ecba0129aa8995f26e192124e692393ed..5deb310dc313463b50a6d856964a441622c200e2 100644 (file)
 #undef y
 #endif
 
+#if defined __GLIBC_PREREQ && defined _FORTIFY_SOURCE
+# if ! __GLIBC_PREREQ(2,41)
+// https://sourceware.org/bugzilla/show_bug.cgi?id=32052
+#  undef sz
+# endif
+#endif
+
 #include <bits/stdc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/names_fortify.cc b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
new file mode 100644 (file)
index 0000000..c975412
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-do compile { target *-*-linux* } }
+// { dg-add-options no_pch }
+
+#define _FORTIFY_SOURCE 2
+// Now we can define the macros to poison uses of non-reserved names:
+#include "names.cc"