X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Subject: Re: __STRICT_ANSI__ and excluded definitions To: djgpp AT delorie DOT com References: <24514c64-0ebf-96cc-4db6-89beb7a1fcdf AT iki DOT fi> <83y2iiis9x DOT fsf AT gnu DOT org> From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com]" Message-ID: Date: Mon, 30 Nov 2020 21:55:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <83y2iiis9x.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US-large Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from Quoted-Printable to 8bit by delorie.com id 0AUJublN024001 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 11/30/20 9:00 PM, Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com] wrote: >> From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com]" >> Date: Mon, 30 Nov 2020 20:25:13 +0200 >> >> On 11/30/20 7:52 PM, DJ Delorie wrote: >>> Best thing to do is to file a bug with gcc and let them language-lawyer >>> it out. >> I mentioned as example the behavior in Linux. In this case its glibc implementation stuff not even >> gcc one: >> >> - gcc or clang only defines __STRICT_ANSI__ >> >> - glibc headers causes definitions of pid_t and ino_t and other stuff not to be excluded >> >> Another question whether specifying for example -std=c++11 (which implies __STRICT_ANSI__) also >> implies ANSI C  for used C headers. > IME, no useful program can be compiled with strict ANSI, so using > -std=c++11 when building a compiler is counter-productive. I'd > suggest to try -std=gnu++11 instead. Seems to come from use of https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_cxx_compile_stdcxx.m4 Familiar nuisance: nice C++ standard support detection but result return way is bad: it causes -std=... appended directly after compiler path before other options. Even overriding CXX for Makefile may break stuff. Noticed it in one my own project. Cannot build it for DJGPP for testing (threads, jne). Could however try yto check whether I can reasonably easy get it to replace std=c++11 with gnu++11 (easier with project than builds under 1 minute) From the other side Linux do not follow these restrictions. As result developers do not even notice a problem. Even my earlier mentioned project builds for Linux without problems when c++17 is specified Andris PS. Checked: Replacing 'AX_CXX_COMPILE_STDCXX_17([noext], [optional])' with 'AX_CXX_COMPILE_STDCXX_17([ext], [optional])' causes 'clang++ -std=gnu++17' to be used instead of '-std=c++11'