From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 297533853803 for ; Tue, 25 Jan 2022 21:10:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 297533853803 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-YL9P6xHTMkuARyb6uo2t1w-1; Tue, 25 Jan 2022 16:10:46 -0500 X-MC-Unique: YL9P6xHTMkuARyb6uo2t1w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D1B21083F60; Tue, 25 Jan 2022 21:10:45 +0000 (UTC) Received: from localhost (unknown [10.33.37.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BD7D4BC51; Tue, 25 Jan 2022 21:10:45 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217] Date: Tue, 25 Jan 2022 21:10:44 +0000 Message-Id: <20220125211044.864444-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2022 21:10:54 -0000 Tested x86_64-linux, pushed to trunk. For GNU/Linux G++ defines _GNU_SOURCE automatically, but not for Cygwin. This means secure_getenv is not declared by Cygwin's , 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. --- 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 #include 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 #include 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 #include -- 2.31.1