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-9513] testsuite: Define _POSIX_C_SOURCE for test Date: Mon, 18 Mar 2024 07:30:18 +0000 (GMT) [thread overview] Message-ID: <20240318073018.38A533858C98@sourceware.org> (raw) https://gcc.gnu.org/g:58753dba800de14144785199fd710e9b00544155 commit r14-9513-g58753dba800de14144785199fd710e9b00544155 Author: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Date: Sun Mar 10 18:18:51 2024 +0100 testsuite: Define _POSIX_C_SOURCE for test As the tests assume that strndup() is visible (only part of POSIX.1-2008) 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/strndup-1.c, -std=c++98 .../strndup-1.c: In function 'void test_1(const char*)': .../strndup-1.c:11:13: error: 'strndup' was not declared in this scope; did you mean 'strncmp'? .../strndup-1.c: In function 'void test_2(const char*)': .../strndup-1.c:16:13: error: 'strndup' was not declared in this scope; did you mean 'strncmp'? .../strndup-1.c: In function 'void test_3(const char*)': .../strndup-1.c:21:13: error: 'strndup' was not declared in this scope; did you mean 'strncmp'? Patch has been verified on Linux. gcc/testsuite/ChangeLog: * c-c++-common/analyzer/strndup-1.c: Define _POSIX_C_SOURCE. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Diff: --- gcc/testsuite/c-c++-common/analyzer/strndup-1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c index 85ccae85d83..577ece0cfba 100644 --- a/gcc/testsuite/c-c++-common/analyzer/strndup-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/strndup-1.c @@ -1,4 +1,5 @@ /* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* hppa*-*-hpux* *-*-mingw* *-*-vxworks* } } */ +/* { dg-additional-options "-D_POSIX_C_SOURCE=200809L" } */ #include <string.h> #include <stdlib.h>
reply other threads:[~2024-03-18 7:30 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=20240318073018.38A533858C98@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: linkBe 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).