aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-10-04 12:40:47 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-10-09 14:05:50 +0100
commit4f97411c0d45dc3d04b5d16384fee111889a7c41 (patch)
tree3e7fea9d7a945fb98290fadfa4586a539cd487ce
parent5247ee086f7fff5c6e7cd837478974dbfc2782db (diff)
downloadgcc-4f97411c0d45dc3d04b5d16384fee111889a7c41.zip
gcc-4f97411c0d45dc3d04b5d16384fee111889a7c41.tar.gz
gcc-4f97411c0d45dc3d04b5d16384fee111889a7c41.tar.bz2
libstdc++: Test 17_intro/names.cc with -D_FORTIFY_SOURCE=2 [PR116210]
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.
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc7
-rw-r--r--libstdc++-v3/testsuite/17_intro/names_fortify.cc6
2 files changed, 13 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index bea2d19..5deb310 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -383,4 +383,11 @@
#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
index 0000000..c975412
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
@@ -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"