public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Torbjorn Svensson <azoff@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-9015] testsuite: Define _POSIX_SOURCE for tests [PR113278]
Date: Thu, 15 Feb 2024 17:31:31 +0000 (GMT)	[thread overview]
Message-ID: <20240215173131.9CF2838654AD@sourceware.org> (raw)

https://gcc.gnu.org/g:8e8c2d2b34971bb29e74341a3efc625f1db06639

commit r14-9015-g8e8c2d2b34971bb29e74341a3efc625f1db06639
Author: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Date:   Thu Feb 15 17:46:24 2024 +0100

    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>

Diff:
---
 gcc/testsuite/c-c++-common/analyzer/fileno-1.c                    | 2 ++
 gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c    | 1 +
 gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c | 1 +
 3 files changed, 4 insertions(+)

diff --git a/gcc/testsuite/c-c++-common/analyzer/fileno-1.c b/gcc/testsuite/c-c++-common/analyzer/fileno-1.c
index d34e51a50223..9f9af7116e63 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 963a84bc9ab8..cbb953ad06ac 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 b1c233121378..c6ecb25d25d5 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 */

                 reply	other threads:[~2024-02-15 17:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240215173131.9CF2838654AD@sourceware.org \
    --to=azoff@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).