Mail Archives: djgpp/2015/06/05/02:57:44
> Date: Thu, 04 Jun 2015 23:15:51 +0300
> From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi)" <djgpp AT delorie DOT com>
>
> echo '#include <iostream>' | 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__.
- Raw text -