public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Define _POSIX_SOURCE for tests [PR113278]
@ 2024-02-15 17:03 Torbjörn SVENSSON
  2024-02-15 17:18 ` Mike Stump
  0 siblings, 1 reply; 3+ messages in thread
From: Torbjörn SVENSSON @ 2024-02-15 17:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: mikestump, rearnsha, christophe.lyon, Torbjörn SVENSSON

Ok for trunk?

--

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:
	PR113278
	* 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                  | 2 ++
 gcc/testsuite/c-c++-common/analyzer/flex-with-call-summaries.c  | 1 +
 .../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 d34e51a5022..9f9af7116e6 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 963a84bc9ab..cbb953ad06a 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 b1c23312137..c6ecb25d25d 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 */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Define _POSIX_SOURCE for tests [PR113278]
  2024-02-15 17:03 [PATCH] testsuite: Define _POSIX_SOURCE for tests [PR113278] Torbjörn SVENSSON
@ 2024-02-15 17:18 ` Mike Stump
  2024-02-15 17:31   ` Torbjorn SVENSSON
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Stump @ 2024-02-15 17:18 UTC (permalink / raw)
  To: Torbjörn SVENSSON; +Cc: gcc-patches, rearnsha, christophe.lyon

On Feb 15, 2024, at 9:03 AM, Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> wrote:
> 
> Ok for trunk?

Ok.

> gcc/testsuite/ChangeLog:
> 	PR113278
> 	* 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Define _POSIX_SOURCE for tests [PR113278]
  2024-02-15 17:18 ` Mike Stump
@ 2024-02-15 17:31   ` Torbjorn SVENSSON
  0 siblings, 0 replies; 3+ messages in thread
From: Torbjorn SVENSSON @ 2024-02-15 17:31 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc-patches, rearnsha, christophe.lyon



On 2024-02-15 18:18, Mike Stump wrote:
> On Feb 15, 2024, at 9:03 AM, Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> wrote:
>>
>> Ok for trunk?
> 
> Ok.

Pushed as 8e8c2d2b34971bb29e74341a3efc625f1db06639.

> 
>> gcc/testsuite/ChangeLog:
>> 	PR113278
>> 	* 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-15 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 17:03 [PATCH] testsuite: Define _POSIX_SOURCE for tests [PR113278] Torbjörn SVENSSON
2024-02-15 17:18 ` Mike Stump
2024-02-15 17:31   ` Torbjorn SVENSSON

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).