]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Define _POSIX_SOURCE for tests [PR113278]
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 15 Feb 2024 16:46:24 +0000 (17:46 +0100)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 15 Feb 2024 17:31:06 +0000 (18:31 +0100)
As the tests assume that fileno() is visible (only part of POSIX),
define the guard to ensure that it's visible.  Currently, glibc appears
to always have this defined in C++, newlib does not.

Without this patch, fails like this can be seen:

Testing analyzer/fileno-1.c,  -std=c++98
.../fileno-1.c: In function 'int test_pass_through(FILE*)':
.../fileno-1.c:5:10: error: 'fileno' was not declared in this scope
FAIL: c-c++-common/analyzer/fileno-1.c  -std=c++98 (test for excess errors)

Patch has been verified on Linux.

gcc/testsuite/ChangeLog:
PR testsuite/113278
* c-c++-common/analyzer/fileno-1.c: Define _POSIX_SOURCE.
* c-c++-common/analyzer/flex-with-call-summaries.c: Same.
* c-c++-common/analyzer/flex-without-call-summaries.c: Same.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/testsuite/c-c++-common/analyzer/fileno-1.c
gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c
gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c

index d34e51a5022372f7c01538717b8da346fb3ec291..9f9af7116e63b0a3151a5afb7cb740a93fa093fa 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-D_POSIX_SOURCE" } */
+
 #include <stdio.h>
 
 int test_pass_through (FILE *stream)
index 963a84bc9ab8420851562b5f7a5a1c7a9d274947..cbb953ad06ace415ae73fb82ee41097652f570b5 100644 (file)
@@ -6,6 +6,7 @@
 /* { dg-additional-options "-fanalyzer-call-summaries" } */
 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
 /* { dg-additional-options "-Wno-analyzer-symbol-too-complex" } */
+/* { dg-additional-options "-D_POSIX_SOURCE" } */
 
 /* A lexical scanner generated by flex */
 
index b1c233121378383cccdf65b4817b05e7e2335285..c6ecb25d25d595e9e645630fff450f84f92bc9c9 100644 (file)
@@ -4,6 +4,7 @@
 /* { dg-additional-options "-fno-analyzer-call-summaries" } */
 
 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
+/* { dg-additional-options "-D_POSIX_SOURCE" } */
 
 
 /* A lexical scanner generated by flex */