aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2024-02-15 17:46:24 +0100
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2024-02-15 18:31:06 +0100
commit8e8c2d2b34971bb29e74341a3efc625f1db06639 (patch)
treeb629768592a7a0ddcdf7c09fadd1e59eef0feea2 /gcc
parentf995f5677305b3ae782d41750e29175cb77e0147 (diff)
downloadgcc-8e8c2d2b34971bb29e74341a3efc625f1db06639.zip
gcc-8e8c2d2b34971bb29e74341a3efc625f1db06639.tar.gz
gcc-8e8c2d2b34971bb29e74341a3efc625f1db06639.tar.bz2
testsuite: Define _POSIX_SOURCE for tests [PR113278]
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/fileno-1.c2
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c1
-rw-r--r--gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c1
3 files changed, 4 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/analyzer/fileno-1.c b/gcc/testsuite/c-c++-common/analyzer/fileno-1.c
index d34e51a..9f9af71 100644
--- a/gcc/testsuite/c-c++-common/analyzer/fileno-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/fileno-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-D_POSIX_SOURCE" } */
+
#include <stdio.h>
int test_pass_through (FILE *stream)
diff --git a/gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c b/gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c
index 963a84b..cbb953a 100644
--- a/gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c
+++ b/gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c
@@ -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 */
diff --git a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
index b1c2331..c6ecb25d 100644
--- a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
+++ b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
@@ -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 */