[cfe-dev] Finding List of C Extensions Used by GNU89

Richard Smith richard at metafoo.co.uk
Sat Apr 20 01:16:05 PDT 2013

>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

On Fri, Apr 19, 2013 at 12:20 PM, JonathanN <Jonathan.Newton at ni.com> wrote:

> 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
> <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
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Finding-List-of-C-Extensions-Used-by-GNU89-tp4031598.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130420/fcda52dc/attachment.html>

More information about the cfe-dev mailing list