public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-9971] libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217]
Date: Mon,  9 May 2022 21:44:16 +0000 (GMT)	[thread overview]
Message-ID: <20220509214416.494073857364@sourceware.org> (raw)

https://gcc.gnu.org/g:8562fbaae9d0c06316188c4749a2171071b6b926

commit r11-9971-g8562fbaae9d0c06316188c4749a2171071b6b926
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 25 10:11:36 2022 +0000

    libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217]
    
    For GNU/Linux G++ defines _GNU_SOURCE automatically, but not for Cygwin.
    This means secure_getenv is not declared by Cygwin's <stdlib.h>, even
    though autoconf detected it is present in the library. Define it in the
    source files that want to use secure_getenv.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/104217
            * src/c++17/fs_ops.cc (_GNU_SOURCE): Define.
            * src/filesystem/dir.cc (_GNU_SOURCE): Define.
            * src/filesystem/ops.cc (_GNU_SOURCE): Define.
    
    (cherry picked from commit e20486d508afdf22790a271e90ca76d8df5fa7a5)

Diff:
---
 libstdc++-v3/src/c++17/fs_ops.cc   | 4 ++++
 libstdc++-v3/src/filesystem/dir.cc | 4 ++++
 libstdc++-v3/src/filesystem/ops.cc | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc
index e308cab6fa0..481b49d20be 100644
--- a/libstdc++-v3/src/c++17/fs_ops.cc
+++ b/libstdc++-v3/src/c++17/fs_ops.cc
@@ -27,6 +27,10 @@
 # define NEED_DO_COPY_FILE
 # define NEED_DO_SPACE
 #endif
+#ifndef _GNU_SOURCE
+// Cygwin needs this for secure_getenv
+# define _GNU_SOURCE 1
+#endif
 
 #include <bits/largefile-config.h>
 #include <filesystem>
diff --git a/libstdc++-v3/src/filesystem/dir.cc b/libstdc++-v3/src/filesystem/dir.cc
index 06e165b8888..446ddf0d2f2 100644
--- a/libstdc++-v3/src/filesystem/dir.cc
+++ b/libstdc++-v3/src/filesystem/dir.cc
@@ -25,6 +25,10 @@
 #ifndef _GLIBCXX_USE_CXX11_ABI
 # define _GLIBCXX_USE_CXX11_ABI 1
 #endif
+#ifndef _GNU_SOURCE
+// Cygwin needs this for secure_getenv
+# define _GNU_SOURCE 1
+#endif
 
 #include <bits/largefile-config.h>
 #include <experimental/filesystem>
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index bd5347468cf..0eaa4b655a1 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -27,6 +27,10 @@
 # define NEED_DO_COPY_FILE
 # define NEED_DO_SPACE
 #endif
+#ifndef _GNU_SOURCE
+// Cygwin needs this for secure_getenv
+# define _GNU_SOURCE 1
+#endif
 
 #include <bits/largefile-config.h>
 #include <experimental/filesystem>


                 reply	other threads:[~2022-05-09 21:44 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=20220509214416.494073857364@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-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).