[gcc r15-4304] libstdc++: testsuite: adjust name_fortify test for pre-defined _FORTIFY_SOURCE

2024-10-13 Thread Sam James via Libstdc++-cvs
https://gcc.gnu.org/g:90a4851b08270678352f4f53f86d94af78647499

commit r15-4304-g90a4851b08270678352f4f53f86d94af78647499
Author: Sam James 
Date:   Sun Oct 13 23:22:02 2024 +0100

libstdc++: testsuite: adjust name_fortify test for pre-defined 
_FORTIFY_SOURCE

Otherwise we get failures with toolchains that have _FORTIFY_SOURCE
defined already to a different value like 3.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/names_fortify.cc: Undefine _FORTIFY_SOURCE.

Diff:
---
 libstdc++-v3/testsuite/17_intro/names_fortify.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/testsuite/17_intro/names_fortify.cc 
b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
index c975412074be..f24af21f8a70 100644
--- a/libstdc++-v3/testsuite/17_intro/names_fortify.cc
+++ b/libstdc++-v3/testsuite/17_intro/names_fortify.cc
@@ -1,6 +1,7 @@
 // { dg-do compile { target *-*-linux* } }
 // { dg-add-options no_pch }
 
+#undef _FORTIFY_SOURCE
 #define _FORTIFY_SOURCE 2
 // Now we can define the macros to poison uses of non-reserved names:
 #include "names.cc"


[gcc r15-8975] testsuite: fix dg-* typos

2025-03-27 Thread Sam James via Libstdc++-cvs
https://gcc.gnu.org/g:7d3bbdcc9df57b16c5b582de317161f96a70e491

commit r15-8975-g7d3bbdcc9df57b16c5b582de317161f96a70e491
Author: Sam James 
Date:   Thu Mar 27 13:26:34 2025 +

testsuite: fix dg-* typos

I have a handful more of these left but those introduce FAILs, while
these all introduce new PASSes.

libstdc++-v3/ChangeLog:

* testsuite/std/format/string_neg.cc: Add missing brace for 
dg-error.

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/fd-datagram-socket.c: Fix 'dg-message' spelling.
* gcc.dg/analyzer/out-of-bounds-zero.c: Fix whitespace in 
'dg-additional-options'.
* gcc.dg/analyzer/strchr-1.c: Fix 'dg-message' whitespace.
* gnat.dg/sso/q11.adb: Fix 'dg-output' whitespace.

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/fd-datagram-socket.c | 2 +-
 gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c | 2 +-
 gcc/testsuite/gcc.dg/analyzer/strchr-1.c   | 4 ++--
 gcc/testsuite/gnat.dg/sso/q11.adb  | 2 +-
 libstdc++-v3/testsuite/std/format/string_neg.cc| 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-datagram-socket.c 
b/gcc/testsuite/gcc.dg/analyzer/fd-datagram-socket.c
index 8d32e858111a..37c715912469 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-datagram-socket.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-datagram-socket.c
@@ -102,7 +102,7 @@ void test_listen_on_datagram_socket_with_bind (const char 
*sockname)
   memset (&addr, 0, sizeof (addr));
   addr.sun_family = AF_UNIX;
   strncpy (addr.sun_path, sockname, sizeof(addr.sun_path) - 1);
-  if (bind (fd, (struct sockaddr *)&addr, sizeof (addr)) == -1) /* { dg 
message "datagram socket bound here" } */
+  if (bind (fd, (struct sockaddr *)&addr, sizeof (addr)) == -1) /* { 
dg-message "datagram socket bound here" } */
 {
   close (fd);
   return;
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c 
b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
index 201ca00ebdbb..6e62a9d2611f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-Wno-stringop-overflow"} */
+/* { dg-additional-options "-Wno-stringop-overflow" } */
 /* -Wstringop-overflow= triggers on test5.  */
 
 #include 
diff --git a/gcc/testsuite/gcc.dg/analyzer/strchr-1.c 
b/gcc/testsuite/gcc.dg/analyzer/strchr-1.c
index 08c429d8f909..181f1829724f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/strchr-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/strchr-1.c
@@ -16,13 +16,13 @@ const char* test_literal (int x)
 
 void test_2 (const char *s, int c)
 {
-  char *p = __builtin_strchr (s, c); /* { dg-message "when '__builtin_strchr' 
returns NULL"} */
+  char *p = __builtin_strchr (s, c); /* { dg-message "when '__builtin_strchr' 
returns NULL" } */
   *p = 'A'; /* { dg-warning "dereference of NULL 'p'" "null deref" } */
 }
 
 void test_3 (const char *s, int c)
 {
-  char *p = strchr (s, c); /* { dg-message "when 'strchr' returns NULL"} */
+  char *p = strchr (s, c); /* { dg-message "when 'strchr' returns NULL" } */
   *p = 'A'; /* { dg-warning "dereference of NULL 'p'" "null deref" } */
 }
 
diff --git a/gcc/testsuite/gnat.dg/sso/q11.adb 
b/gcc/testsuite/gnat.dg/sso/q11.adb
index 22ac5578dd71..39853ef12422 100644
--- a/gcc/testsuite/gnat.dg/sso/q11.adb
+++ b/gcc/testsuite/gnat.dg/sso/q11.adb
@@ -31,7 +31,7 @@ begin
   Put ("B2 :");
   Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
   New_Line;
-  -- { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n"} 
+  -- { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
 
   if A1.I /= B1.I or A1.A(1) /= B1.A(1) then
 raise Program_Error;
diff --git a/libstdc++-v3/testsuite/std/format/string_neg.cc 
b/libstdc++-v3/testsuite/std/format/string_neg.cc
index d5963145b185..09cc9a25b3e1 100644
--- a/libstdc++-v3/testsuite/std/format/string_neg.cc
+++ b/libstdc++-v3/testsuite/std/format/string_neg.cc
@@ -6,5 +6,5 @@ auto s = std::format(" {9} "); // { dg-error "call to consteval 
function" }
 // { dg-error "invalid.arg.id" "" { target *-*-* } 0 }
 
 struct X { };
-std::format_string str(""); // dg-error "here" }
+std::format_string str(""); // { dg-error "here" }
 // { dg-error "std::formatter must be specialized" "" { target *-*-* } 0 }