From patchwork Tue Jan 25 21:10:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 50442 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D47A83853801 for ; Tue, 25 Jan 2022 21:13:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D47A83853801 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643145239; bh=4NRn0lwTGagpym8HVXRH/RZzxyxd6QbNTMoNwoR6OkA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lVyYrgHItcVS1946eCjDO9IxC8btw4SROwIOGplDEwp5d3k43j9A8/qoSdXYwjemh sKegJpW3gqjX8eYE+Ow2LGyz+qMokWd5f+7tf2Y7De7hPhrQVi0zEsRIyjMLYHTU3y 2b5CyWJkOmBSKClQzIJKppy8XjbUd+9CeYJeSuOA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 EBCE2385C40A for ; Tue, 25 Jan 2022 21:10:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBCE2385C40A 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) 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 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=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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