From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53236 invoked by alias); 6 Apr 2017 05:26:55 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 52291 invoked by uid 89); 6 Apr 2017 05:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=contrary, Sherrill, sherrill, prototyped X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Apr 2017 05:25:31 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02C267E9DA for ; Thu, 6 Apr 2017 05:25:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 02C267E9DA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cygwin.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=yselkowitz@cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 02C267E9DA Received: from [10.10.120.19] (ovpn-120-19.rdu2.redhat.com [10.10.120.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE52080B90 for ; Thu, 6 Apr 2017 05:25:31 +0000 (UTC) Subject: Re: C++ and feature guards Warning Question To: newlib@sourceware.org References: From: Yaakov Selkowitz Message-ID: Date: Thu, 06 Apr 2017 05:26:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00281.txt.bz2 On 2017-04-05 16:18, Joel Sherrill wrote: > Trying to compile an open source package for RTEMS, I > came across something I need help to figure out how > best to address. The package is in C++ and giving a > lot of warnings on methods which I would have thought > are prototyped. But clearly the compiler settings > are tripping the guards different than the package > authors expect. > > Native GCC on CentOS 7 with glibc gives no warnings. G++ defines _GNU_SOURCE on glibc targets, meaning that -std=c++NN is, contrary to the documentation, *not* strict ISO C++: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/gnu-user.h#L105 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749 Per my comments in that BZ, I believe there is a better way of doing this, but it will require patches to both gcc and glibc. Once this is done -- and while it's on my wishlist, I don't know when I'll have time to work on it -- software will finally stop taking -std=c++NN for granted. In the meantime, building for newlib/Cygwin/RTEMS is going to be different from glibc in some cases. In any case, the fix is either to use proper feature test macros, or use -std=gnu++NN instead. I have had to do this on a number of occasions while building software for Cygwin. -- Yaakov