public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6867] libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217]
@ 2022-01-25 21:09 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-01-25 21:09 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:e20486d508afdf22790a271e90ca76d8df5fa7a5
commit r12-6867-ge20486d508afdf22790a271e90ca76d8df5fa7a5
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.
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 1d3693af06c..321944d73f7 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 f1bf96aab50..d5b11f25297 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 324c6afc7a9..cd98caf73f2 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>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-25 21:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 21:09 [gcc r12-6867] libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217] Jonathan Wakely
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).