X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55600388A839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1589371956; bh=S8zYpabpgbnPKF7s+9DdRClgwf3JiU/r124f6tS2t2w=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FHIO6/+GhH+09Zx8CBixhqalqzFS2L20bvzaYp4Idq3n+8qcLRh+QsMkdizQaGOSD +FBoAZalTb8DAe7pplf0T4fbkG59Ffq7o935u3MqvT65H/Oo5Kj0+jlAwbdXx0bYPL vOYvK+CWeZpI/1Xz0qeToD1Y7F6l6uCAwRjGk/Qg= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 43B143851C1E X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=GqEIGxsFDV0Q3t6YLokUn+3Dv7JUDK3Th5TvMdpr7sg=; b=BEYswpSj+y6P0SscEzK3hojjzvEuBunl5xIbGOK6uvYxZFiBl4F7R6L8DG+uN/80mj 8oPtb6y5z40aRXIXfmrZbsmuRqeOJgrvwd/fqaf+zKTlX9oCu1NOW4kIwDbCln8Y4O/l iFX1WV22vWkrohQ8unvqf+V4os1izQhHfQRINJCJNtdyqWcck5VPOCH/5KlwERFTOIVQ wfI8MDih8g9H7q0fJya0fQ7Me5cDxqvQ2adhKRW2PGxZVlXR88ff3LoGrn+6S+Z00R5V y6MfIioS+BRJaS53pmmzil0bSlLTzCTCK0rsz2nlTTAGbgvhpFYy3rtcqkYuH4Pb06rw yXNw== X-Gm-Message-State: AGi0PuZKa0RVDz48cY5EZJtp4KXVOMLjAibBwSHdoOqUEjOzNmEV1iFW mz9wegpd2BR+LqJAnweymvZi7fSa X-Google-Smtp-Source: APiQypIGYGvhEXIlB/b5s9BUn4C10TXScgBFSiC5jkL79STGsUpI8YoYKPxqpMH/pH0VMT0dZcG7Cw== X-Received: by 2002:a7b:c759:: with SMTP id w25mr46419242wmk.68.1589371953073; Wed, 13 May 2020 05:12:33 -0700 (PDT) Subject: Re: Symbol visibility problems with -std= To: cygwin AT cygwin DOT com References: <00a001d62910$4120ea20$c362be60$@samsung.com> Message-ID: Date: Wed, 13 May 2020 14:12:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <00a001d62910$4120ea20$c362be60$@samsung.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Marco Atzeri via Cygwin Reply-To: Marco Atzeri Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Am 13.05.2020 um 12:21 schrieb Pavel Fedin via Cygwin: > Hello everyone! > > While compiling various software packages for Cygwin i notice that very often i have to add something like #define _GNU_SOURCE to > them in order to compile correctly. Meanwhile on Linux they compile with no problems at all. I've narrowed it down to -std=??? > option using a simple test case: > --- cut test.cpp --- > #include > #include > #include > > int main(void) > { > char *p = strdup("hello"); > > printf("%s\n", p); > free(p); > return 0; > } > --- cut test.cpp --- > > $ g++ test.cpp -o test - compiles OK > $ g++ test.cpp -o test -std=c++14 - error: 'strdup' was not declared in this scope; did you mean 'strcmp'? > > By printing out predefined macros (-dM -E) i found out that -std=something option adds " #define __STRICT_ANSI__ 1" to builtin > macros, but removes all *_SOURCE definitions, so _DEFAULT_SOURCE is not triggered any more. > I've compared the behavior with Linux system. On Linux -std=c++14 also defines __STRICT_ANSI__, but various *_SOURCE macros are not > omitted. > Isn't this a Cygwin bug? By the way, clang does not suffer from this problem. > > Kind regards, > Pavel Fedin strdup is an extension of C standard so strictly behaviour of Cgywin is correct, see /usr/include/sys/features.h for details -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple