* c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield)
(finish_struct): Refer to C11 in comments. Use flag_isoc11.
* c-parser.c (c_parser_static_assert_declaration)
(c_parser_static_assert_declaration_no_semi, c_parser_declspecs)
(c_parser_alignas_specifier, c_parser_alignof_expression): Refer
to C11 in comments. Use flag_isoc11.
* c-typeck.c (comptypes_check_different_types): Refer to C11 in
comment.
* doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x.
* doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference
to -std=c1x and -std=gnu1x.
* doc/extend.texi (Inline, Alternate Keywords, Other Builtins)
(__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11
instead of -std=c1x and C1X.
* doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in
preference to -std=c1x.
(-std=gnu11): Document in preference to -std=gnu1x.
* doc/standards.texi: Document C11 instead of C1X. Document C11
as actual standard. Document headers required from freestanding
C11 implementations.
* ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >=
201112L for C11. Update comments to refer to C11.
gcc/c-family:
* c-common.c (flag_isoc99): Update comment to refer to C11.
(flag_isoc1x): Change to flag_isoc11.
* c-common.h (flag_isoc99): Update comment to refer to C11.
(flag_isoc1x): Change to flag_isoc11.
* c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to
C11.
* c-opts.c (set_std_c1x): Change to set_std_c11.
(c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11.
Call set_std_c11.
(set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11.
(set_std_c1): Use CLK_STDC11 and CLK_GNUC11.
* c.opt (std=c1x): Change to std=c11. Document as non-draft
standard.
(std=c1x, std=iso9899:2011): Add as aliases of std=c11.
(std=gnu1x): Change to std=gnu11. Refer to non-draft standard.
(std=gnu1x): Make alias of std=gnu11.
gcc/testsuite:
* gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c,
gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c,
gcc.dg/gnu11-version-1.c: New tests.
libcpp:
* include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
(CLK_STDC1X): Change to CLK_STDC11.
* init.c (lang_defaults): Update comments.
(cpp_init_builtins): Update language tests. Use 201112L for C11
__STDC_VERSION__.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182551
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-12-20 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield)
+ (finish_struct): Refer to C11 in comments. Use flag_isoc11.
+ * c-parser.c (c_parser_static_assert_declaration)
+ (c_parser_static_assert_declaration_no_semi, c_parser_declspecs)
+ (c_parser_alignas_specifier, c_parser_alignof_expression): Refer
+ to C11 in comments. Use flag_isoc11.
+ * c-typeck.c (comptypes_check_different_types): Refer to C11 in
+ comment.
+ * doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x.
+ * doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference
+ to -std=c1x and -std=gnu1x.
+ * doc/extend.texi (Inline, Alternate Keywords, Other Builtins)
+ (__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11
+ instead of -std=c1x and C1X.
+ * doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in
+ preference to -std=c1x.
+ (-std=gnu11): Document in preference to -std=gnu1x.
+ * doc/standards.texi: Document C11 instead of C1X. Document C11
+ as actual standard. Document headers required from freestanding
+ C11 implementations.
+ * ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >=
+ 201112L for C11. Update comments to refer to C11.
+
2011-12-20 Andreas Schwab <schwab@linux-m68k.org>
* configure: Regenerate.
/* Redeclaration of a type is a constraint violation (6.7.2.3p1),
but silently ignore the redeclaration if either is in a system
header. (Conflicting redeclarations were handled above.) This
- is allowed for C1X if the types are the same, not just
+ is allowed for C11 if the types are the same, not just
compatible. */
if (TREE_CODE (newdecl) == TYPE_DECL)
{
newdecl);
locate_old_decl (olddecl);
}
- else if (pedantic && !flag_isoc1x)
+ else if (pedantic && !flag_isoc11)
{
pedwarn (input_location, OPT_pedantic,
"redefinition of typedef %q+D", newdecl);
DECL_DECLARED_INLINE_P (decl) = 1;
if (declspecs->noreturn_p)
{
- if (!flag_isoc1x)
+ if (!flag_isoc11)
{
if (flag_isoc99)
pedwarn (loc, OPT_pedantic,
If this is something of the form "foo;" and foo is a TYPE_DECL, then
If foo names a structure or union without a tag, then this
- is an anonymous struct (this is permitted by C1X).
+ is an anonymous struct (this is permitted by C11).
If MS or Plan 9 extensions are enabled and foo names a
structure, then again this is an anonymous struct.
Otherwise this is an error.
pedwarn (loc, 0, "declaration does not declare anything");
return NULL_TREE;
}
- if (!flag_isoc1x)
+ if (!flag_isoc11)
{
if (flag_isoc99)
pedwarn (loc, OPT_pedantic,
{
if (DECL_NAME (x) != 0)
break;
- if (flag_isoc1x
+ if (flag_isoc11
&& (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
break;
+2011-12-20 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (flag_isoc99): Update comment to refer to C11.
+ (flag_isoc1x): Change to flag_isoc11.
+ * c-common.h (flag_isoc99): Update comment to refer to C11.
+ (flag_isoc1x): Change to flag_isoc11.
+ * c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to
+ C11.
+ * c-opts.c (set_std_c1x): Change to set_std_c11.
+ (c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11.
+ Call set_std_c11.
+ (set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11.
+ (set_std_c1): Use CLK_STDC11 and CLK_GNUC11.
+ * c.opt (std=c1x): Change to std=c11. Document as non-draft
+ standard.
+ (std=c1x, std=iso9899:2011): Add as aliases of std=c11.
+ (std=gnu1x): Change to std=gnu11. Refer to non-draft standard.
+ (std=gnu1x): Make alias of std=gnu11.
+
2011-12-19 Jason Merrill <jason@redhat.com>
PR c++/51228
int flag_isoc94;
-/* Nonzero means use the ISO C99 (or C1X) dialect of C. */
+/* Nonzero means use the ISO C99 (or C11) dialect of C. */
int flag_isoc99;
-/* Nonzero means use the ISO C1X dialect of C. */
+/* Nonzero means use the ISO C11 dialect of C. */
-int flag_isoc1x;
+int flag_isoc11;
/* Nonzero means that we have builtin functions, and main is an int. */
RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
RID_FRACT, RID_ACCUM,
- /* C1X */
+ /* C11 */
RID_ALIGNAS,
/* This means to warn that this is a C++ keyword, and then treat it
extern int flag_isoc94;
-/* Nonzero means use the ISO C99 (or C1X) dialect of C. */
+/* Nonzero means use the ISO C99 (or C11) dialect of C. */
extern int flag_isoc99;
-/* Nonzero means use the ISO C1X dialect of C. */
+/* Nonzero means use the ISO C11 dialect of C. */
-extern int flag_isoc1x;
+extern int flag_isoc11;
/* Nonzero means that we have builtin functions, and main is an int. */
have_swap[16] = true;
}
- /* Tell the source code about various types. These map to the C++11 and C1x
+ /* Tell the source code about various types. These map to the C++11 and C11
macros where 2 indicates lock-free always, and 1 indicates sometimes
lock free. */
#define SIZEOF_NODE(T) (tree_low_cst (TYPE_SIZE_UNIT (T), 1))
static void set_std_cxx11 (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
-static void set_std_c1x (int);
+static void set_std_c11 (int);
static void check_deps_environment_vars (void);
static void handle_deferred_opts (void);
static void sanitize_cpp_opts (void);
set_std_c99 (false /* ISO */);
break;
- case OPT_std_c1x:
+ case OPT_std_c11:
if (!preprocessing_asm_p)
- set_std_c1x (true /* ISO */);
+ set_std_c11 (true /* ISO */);
break;
- case OPT_std_gnu1x:
+ case OPT_std_gnu11:
if (!preprocessing_asm_p)
- set_std_c1x (false /* ISO */);
+ set_std_c11 (false /* ISO */);
break;
case OPT_trigraphs:
flag_no_nonansi_builtin = iso;
flag_isoc94 = c94;
flag_isoc99 = 0;
- flag_isoc1x = 0;
+ flag_isoc11 = 0;
}
/* Set the C 99 standard (without GNU extensions if ISO). */
flag_no_asm = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
- flag_isoc1x = 0;
+ flag_isoc11 = 0;
flag_isoc99 = 1;
flag_isoc94 = 1;
}
-/* Set the C 1X standard draft (without GNU extensions if ISO). */
+/* Set the C 11 standard (without GNU extensions if ISO). */
static void
-set_std_c1x (int iso)
+set_std_c11 (int iso)
{
- cpp_set_lang (parse_in, iso ? CLK_STDC1X: CLK_GNUC1X);
+ cpp_set_lang (parse_in, iso ? CLK_STDC11: CLK_GNUC11);
flag_no_asm = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
- flag_isoc1x = 1;
+ flag_isoc11 = 1;
flag_isoc99 = 1;
flag_isoc94 = 1;
}
C++ ObjC++ Alias(std=c++11)
Deprecated in favor of -std=c++11
-std=c1x
+std=c11
C ObjC
-Conform to the ISO 201X C standard draft (experimental and incomplete support)
+Conform to the ISO 2011 C standard (experimental and incomplete support)
+
+std=c1x
+C ObjC Alias(std=c11)
+Deprecated in favor of -std=c11
std=c89
C ObjC Alias(std=c90)
C++ ObjC++ Alias(std=gnu++11)
Deprecated in favor of -std=gnu++11
-std=gnu1x
+std=gnu11
C ObjC
-Conform to the ISO 201X C standard draft with GNU extensions (experimental and incomplete support)
+Conform to the ISO 2011 C standard with GNU extensions (experimental and incomplete support)
+
+std=gnu1x
+C ObjC Alias(std=gnu11)
+Deprecated in favor of -std=gnu11
std=gnu89
C ObjC Alias(std=gnu90)
C ObjC Alias(std=c99)
Deprecated in favor of -std=iso9899:1999
+std=iso9899:2011
+C ObjC Alias(std=c11)
+Conform to the ISO 2011 C standard (experimental and incomplete support)
+
traditional
Driver
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
-/* Parse a static assertion (C1X N1425 6.7.10).
+/* Parse a static assertion (C11 6.7.10).
static_assert-declaration:
static_assert-declaration-no-semi ;
c_parser_skip_to_end_of_block_or_statement (parser);
}
-/* Parse a static assertion (C1X N1425 6.7.10), without the trailing
+/* Parse a static assertion (C11 6.7.10), without the trailing
semicolon.
static_assert-declaration-no-semi:
gcc_assert (c_parser_next_token_is_keyword (parser, RID_STATIC_ASSERT));
assert_loc = c_parser_peek_token (parser)->location;
- if (!flag_isoc1x)
+ if (!flag_isoc11)
{
if (flag_isoc99)
pedwarn (assert_loc, OPT_pedantic,
Function specifiers (inline) are from C99, and are currently
handled as storage class specifiers, as is __thread. Alignment
- specifiers are from C1X.
+ specifiers are from C11.
C90 6.5.1, C99 6.7.1:
storage-class-specifier:
inline
_Noreturn
- (_Noreturn is new in C1X.)
+ (_Noreturn is new in C11.)
C90 6.5.2, C99 6.7.2:
type-specifier:
/* Parse an alignment-specifier.
- C1X 6.7.5:
+ C11 6.7.5:
alignment-specifier:
_Alignas ( type-name )
location_t loc = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS));
c_parser_consume_token (parser);
- if (!flag_isoc1x)
+ if (!flag_isoc11)
{
if (flag_isoc99)
pedwarn (loc, OPT_pedantic,
__alignof__ ( type-name )
&& identifier
- (C1X permits _Alignof with type names only.)
+ (C11 permits _Alignof with type names only.)
unary-operator: one of
__extension__ __real__ __imag__
tree alignof_spelling = c_parser_peek_token (parser)->value;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));
/* A diagnostic is not required for the use of this identifier in
- the implementation namespace; only diagnose it for the C1X
+ the implementation namespace; only diagnose it for the C11
spelling because of existing code using the other spellings. */
- if (!flag_isoc1x
+ if (!flag_isoc11
&& strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0)
{
if (flag_isoc99)
compatible integer type, then this sets *ENUM_AND_INT_P to true;
*ENUM_AND_INT_P is never set to false. If DIFFERENT_TYPES_P is not
NULL, and the types are compatible but different enough not to be
- permitted in C1X typedef redeclarations, then this sets
+ permitted in C11 typedef redeclarations, then this sets
*DIFFERENT_TYPES_P to true; *DIFFERENT_TYPES_P is never set to
false, but may or may not be set if the types are incompatible.
This differs from comptypes, in that we don't free the seen
rarely, if ever, used, and may cause surprising changes to the meaning
of a program which does not expect them. To get strict ISO Standard C,
you should use the @option{-std=c90}, @option{-std=c99} or
-@option{-std=c1x} options, depending
+@option{-std=c11} options, depending
on which version of the standard you want. To get all the mandatory
diagnostics, you must also use @option{-pedantic}. @xref{Invocation}.
The revised ISO C standard, published in December 1999. Before
publication, this was known as C9X@.
-@item c1x
-The next version of the ISO C standard, still under development.
+@item iso9899:2011
+@itemx c11
+@itemx c1x
+The revised ISO C standard, published in December 2011. Before
+publication, this was known as C1X@.
@item gnu90
@itemx gnu89
@itemx gnu9x
The 1999 C standard plus GNU extensions.
-@item gnu1x
-The next version of the ISO C standard, still under development, plus
-GNU extensions.
+@item gnu11
+@itemx gnu1x
+The 2011 C standard plus GNU extensions.
@item c++98
The 1998 ISO C++ standard plus amendments.
inline. One is available with @option{-std=gnu89} or
@option{-fgnu89-inline} or when @code{gnu_inline} attribute is present
on all inline declarations, another when
-@option{-std=c99}, @option{-std=c1x},
-@option{-std=gnu99} or @option{-std=gnu1x}
+@option{-std=c99}, @option{-std=c11},
+@option{-std=gnu99} or @option{-std=gnu11}
(without @option{-fgnu89-inline}), and the third
is used when compiling C++.
including ISO C programs. The keywords @code{asm}, @code{typeof} and
@code{inline} are not available in programs compiled with
@option{-ansi} or @option{-std} (although @code{inline} can be used in a
-program compiled with @option{-std=c99} or @option{-std=c1x}). The
+program compiled with @option{-std=c99} or @option{-std=c11}). The
ISO C99 keyword
@code{restrict} is only available when @option{-std=gnu99} (which will
eventually be the default) or @option{-std=c99} (or the equivalent
@opindex ansi
@opindex std
Outside strict ISO C mode (@option{-ansi}, @option{-std=c90},
-@option{-std=c99} or @option{-std=c1x}), the functions
+@option{-std=c99} or @option{-std=c11}), the functions
@code{_exit}, @code{alloca}, @code{bcmp}, @code{bzero},
@code{dcgettext}, @code{dgettext}, @code{dremf}, @code{dreml},
@code{drem}, @code{exp10f}, @code{exp10l}, @code{exp10}, @code{ffsll},
@deftypefn {Built-in Function} @var{type} __builtin_complex (@var{real}, @var{imag})
The built-in function @code{__builtin_complex} is provided for use in
-implementing the ISO C1X macros @code{CMPLXF}, @code{CMPLX} and
+implementing the ISO C11 macros @code{CMPLXF}, @code{CMPLX} and
@code{CMPLXL}. @var{real} and @var{imag} must have the same type, a
real binary floating-point type, and the result has the corresponding
complex type with real and imaginary parts @var{real} and @var{imag}.
@cindex @code{struct}
@cindex @code{union}
-As permitted by ISO C1X and for compatibility with other compilers,
+As permitted by ISO C11 and for compatibility with other compilers,
GCC allows you to define
a structure or union that contains, as fields, structures and unions
without names. For example:
@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
names @samp{c9x} and @samp{iso9899:199x} are deprecated.
-@item c1x
-ISO C1X, the draft of the next revision of the ISO C standard.
-Support is limited and experimental and features enabled by this
-option may be changed or removed if changed in or removed from the
-standard draft.
+@item c11
+@itemx c1x
+@itemx iso9899:2011
+ISO C11, the 2011 revision of the ISO C standard.
+Support is incomplete and experimental. The name @samp{c1x} is
+deprecated.
@item gnu90
@itemx gnu89
GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
this will become the default. The name @samp{gnu9x} is deprecated.
+@item gnu11
@item gnu1x
-GNU dialect of ISO C1X. Support is limited and experimental and
-features enabled by this option may be changed or removed if changed
-in or removed from the standard draft.
+GNU dialect of ISO C11. Support is incomplete and experimental. The
+name @samp{gnu1x} is deprecated.
@item c++98
The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
@cindex C99
@cindex ISO C9X
@cindex C9X
+@cindex ISO C11
+@cindex C11
@cindex ISO C1X
@cindex C1X
@cindex Technical Corrigenda
Corrigenda published in 2001, 2004 and 2007. GCC does not support the
uncorrected version.
-A fourth version of the C standard, known as @dfn{C1X}, is under
-development; GCC has limited preliminary support for parts of this
-standard, enabled with @option{-std=c1x}.
+A fourth version of the C standard, known as @dfn{C11}, was published
+in 2011 as ISO/IEC 9899:2011. GCC has limited incomplete support for
+parts of this standard, enabled with @option{-std=c11} or
+@option{-std=iso9899:2011}. (While in development, drafts of this
+standard version were referred to as @dfn{C1X}.)
By default, GCC provides some extensions to the C language that on
rare occasions conflict with the C standard. @xref{C
they conflict with the C standard version selected. You may also
select an extended version of the C language explicitly with
@option{-std=gnu90} (for C90 with GNU extensions), @option{-std=gnu99}
-(for C99 with GNU extensions) or @option{-std=gnu1x} (for C1X with GNU
+(for C99 with GNU extensions) or @option{-std=gnu11} (for C11 with GNU
extensions). The default, if no C language dialect
options are given, is @option{-std=gnu90}; this will change to
-@option{-std=gnu99} in some future release when the C99 support is
+@option{-std=gnu99} or @option{-std=gnu11} in some future release when
+the C99 or C11 support is
complete. Some features that are part of the C99 standard are
-accepted as extensions in C90 mode.
+accepted as extensions in C90 mode, and some features that are part of
+the C11 standard are accepted as extensions in C90 and C99 modes.
The ISO C standard defines (in clause 4) two classes of conforming
implementation. A @dfn{conforming hosted implementation} supports the
freestanding implementation} is only required to provide certain
library facilities: those in @code{<float.h>}, @code{<limits.h>},
@code{<stdarg.h>}, and @code{<stddef.h>}; since AMD1, also those in
-@code{<iso646.h>}; and in C99, also those in @code{<stdbool.h>} and
-@code{<stdint.h>}. In addition, complex types, added in C99, are not
+@code{<iso646.h>}; since C99, also those in @code{<stdbool.h>} and
+@code{<stdint.h>}; and since C11, also those in @code{<stdalign.h>}
+and @code{<stdnoreturn.h>}. In addition, complex types, added in C99, are not
required for freestanding implementations. The standard also defines
two environments for programs, a @dfn{freestanding environment},
required of all implementations and which may not have library
-/* Copyright (C) 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of GCC.
#endif /* C99 */
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
/* Versions of DECIMAL_DIG for each floating-point type. */
#undef FLT_DECIMAL_DIG
#undef DBL_DECIMAL_DIG
#define LDBL_TRUE_MIN __LDBL_MIN__
#endif
-#endif /* C1X */
+#endif /* C11 */
#ifdef __STDC_WANT_DEC_FP__
/* Draft Technical Report 24732, extension for decimal floating-point
/* Offset of member MEMBER in a struct of type TYPE. */
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 199901L) \
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|| (defined(__cplusplus) && __cplusplus >= 201103L)
#ifndef _GCC_MAX_ALIGN_T
#define _GCC_MAX_ALIGN_T
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
#endif
-#endif /* C1X or C++11. */
+#endif /* C11 or C++11. */
#endif /* _STDDEF_H was defined this time */
+2011-12-20 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c,
+ gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c,
+ gcc.dg/gnu11-version-1.c: New tests.
+
2011-12-20 Bernd Schmidt <bernds@codesourcery.com>
PR middle-end/51200
--- /dev/null
+/* Test __STDC_VERSION__ for C11. Test -std=c11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 201112L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
--- /dev/null
+/* Test __STDC_VERSION__ for C11. Test -std=iso9899:2011. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:2011 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 201112L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
--- /dev/null
+/* Test __STDC_VERSION__ for C94. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:199409 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 199409L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
--- /dev/null
+/* Test __STDC_VERSION__ for C99. */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 199901L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
--- /dev/null
+/* Test __STDC_VERSION__ for C11 with GNU extensions. Test -std=gnu11. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu11 -pedantic-errors" } */
+
+#if __STDC_VERSION__ == 201112L
+int i;
+#else
+#error "Bad __STDC_VERSION__."
+#endif
+2011-12-20 Joseph Myers <joseph@codesourcery.com>
+
+ * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
+ (CLK_STDC1X): Change to CLK_STDC11.
+ * init.c (lang_defaults): Update comments.
+ (cpp_init_builtins): Update language tests. Use 201112L for C11
+ __STDC_VERSION__.
+
2011-12-20 Andreas Schwab <schwab@linux-m68k.org>
* configure: Regenerate.
#undef TK
/* C language kind, used when calling cpp_create_reader. */
-enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC1X,
- CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC1X,
+enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11,
+ CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11,
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
{ /* c99 c++ xnum xid std // digr ulit rlit user_literals */
/* GNUC89 */ { 0, 0, 1, 0, 0, 1, 1, 0, 0, 0 },
/* GNUC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0 },
- /* GNUC1X */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0 },
+ /* GNUC11 */ { 1, 0, 1, 0, 0, 1, 1, 1, 1, 0 },
/* STDC89 */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
/* STDC94 */ { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0 },
/* STDC99 */ { 1, 0, 1, 0, 1, 1, 1, 0, 0, 0 },
- /* STDC1X */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0 },
+ /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0 },
/* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1, 0, 0, 0 },
/* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0 },
/* GNUCXX11 */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1 },
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
- else if (CPP_OPTION (pfile, lang) == CLK_STDC1X
- || CPP_OPTION (pfile, lang) == CLK_GNUC1X)
- _cpp_define_builtin (pfile, "__STDC_VERSION__ 201000L");
+ else if (CPP_OPTION (pfile, lang) == CLK_STDC11
+ || CPP_OPTION (pfile, lang) == CLK_GNUC11)
+ _cpp_define_builtin (pfile, "__STDC_VERSION__ 201112L");
else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");