X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Date: Fri, 05 Jun 2015 09:57:11 +0300 From: "Eli Zaretskii (eliz AT gnu DOT org)" Subject: Re: DJGPP v2.05: some thoughts In-reply-to: <5570B1F7.1070509@iki.fi> X-012-Sender: halo1 AT inter DOT net DOT il To: djgpp AT delorie DOT com Message-id: <83pp5aprqw.fsf@gnu.org> References: <55673F0B DOT 1090103 AT iki DOT fi> <83twuwwshg DOT fsf AT gnu DOT org> <55675040 DOT 9030008 AT iki DOT fi> <556F6E49 DOT 8010006 AT gmx DOT de> <556FCCDF DOT 7080005 AT iki DOT fi> <83bngvr0ef DOT fsf AT gnu DOT org> <557078B1 DOT 9040004 AT iki DOT fi> <201506041613 DOT t54GDT8m014488 AT envy DOT delorie DOT com> <5570B1F7 DOT 1070509 AT iki DOT fi> 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 > Date: Thu, 04 Jun 2015 23:15:51 +0300 > From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi)" > > echo '#include ' | i586-pc-msdosdjgpp-gcc -c -x c++ -std=c++11 - -o /dev/null > > (hint: replace i586-pc-msdosdjgpp-gcc with simple gcc for native build) > > Works OK with with -std=c++03, fails with -std=c++11 and -std=c++14 > > The problem is that our errno.h gets almost completely excluded > > Andris > > PS. following seems to workaround the problem: > > Konsole output > --- errno.h.orig 2015-06-04 23:12:46.745892048 +0300 > +++ errno.h 2015-06-04 23:13:13.382210708 +0300 > @@ -25,7 +25,7 @@ > > #endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */ > > -#ifndef __STRICT_ANSI__ > +#if !defined(__STRICT_ANSI__) || defined(__cplusplus) > > #define E2BIG 3 > #define EACCES 4 This looks wrong: we shouldn't have errno values visible under ANSI compilation which are not defined by the ANSI C standard. E.g., C99 only defines EDOM, EILSEQ, and ERANGE. If the later standards define more errno values, they should be only visible when the corresponding -std= option was specified for compiler. They should not be defined unconditionally, that is definitely not TRT. What preprocessor macros are defined by GCC that depend on -std= value? Assuming that it's __STDC_VERSION__, and that -stdc=c11 sets it to 201112L and specifies that E2BIG should be in errno.h, then we should do something like this: #if defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 201112L #define E2BIG 3 However, the C11 draft standard I see still defines only the same 3 macros in errno that the old C99 standard did. So I think this is a C++ only thing, and we should also allow those values when __cplusplus is defined, even under __STRICT_ANSI__.