Hi,
I wasn't sure where to post this question but I'm trying to find out what
extensions GNU89 provides over C89. I did find the
<http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html> website, but I
wasn't sure if these were the GNU89 extensions used by clang when you
specify -std:gnu89. If someone knows of a document or a way in the source to
find this list, please let me know.
Thanks
From include/clang/Frontend/LangStandards.def:
LANGSTANDARD(c89, “c89”,
“ISO C 1990”,
C89 | ImplicitInt)
LANGSTANDARD(gnu89, “gnu89”,
“ISO C 1990 with GNU extensions”,
LineComment | C89 | Digraphs | GNUMode | ImplicitInt)
So… -std=gnu89 adds:
- BCPL // comments
- C94 / C++ digraphs <: etc
- things enabled by GNUMode – grep the code for GNUMode to find those; they are:
- predefined macros without surrounding __ (use -dM -E to see them)
- GNU keywords without __s: inline, asm, typeof
- trigraphs disabled
- don’t define STDC_VERSION nor STRICT_ANSI
- enables special token-pasting rule for “, ## VA_ARGS” with empty args (note, this is always enabled outside of c99 modes anyway, since VA_ARGS is an extension there)
- allow main to return something other than ‘int’
- some cases allowing foldable non-constant expressions in places where a constant expression is required