Patchwork Add -std=c11 option, final __STDC_VERSION__ value, etc.

login
register
mail settings
Submitter Joseph S. Myers
Date Dec. 20, 2011, 8:45 p.m.
Message ID <Pine.LNX.4.64.1112202044280.2743@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/132515/
State New
Headers show

Comments

Joseph S. Myers - Dec. 20, 2011, 8:45 p.m.
Now that C11 has been published, this patch implements options
-std=c11, -std=iso9899:2011 and -std=gnu11 and deprecates -std=c1x and
-std=gnu1x.  The intended final __STDC_VERSION__ value, 201112L, is
also implemented (the editor forgot to update the 201ymmL placeholders
before sending the document for publication by ISO).

Documentation is updated accordingly.  (Jason, standards.texi still
has a paragraph about C++0x that needs updating for the publication of
C++11.)  I also changed headers testing __STDC_VERSION__ for C11
support to test against the final C11 value.  As testcases for the new
options, I added tests of __STDC_VERSION__ - and since we appeared to
be missing any such tests for C99 or C94, I added those as well.  I
don't plan to rename existing c1x-* tests, but new tests should be
named c11-*.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Applied
to mainline.

gcc:
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.

gcc/c-family:
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.

gcc/testsuite:
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.

libcpp:
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__.

Patch

Index: gcc/doc/cpp.texi
===================================================================
--- gcc/doc/cpp.texi	(revision 182544)
+++ gcc/doc/cpp.texi	(working copy)
@@ -216,7 +216,7 @@  few things required by the standard.  Th
 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}.
 
Index: gcc/doc/standards.texi
===================================================================
--- gcc/doc/standards.texi	(revision 182544)
+++ gcc/doc/standards.texi	(working copy)
@@ -33,6 +33,8 @@  with some exceptions, and possibly with 
 @cindex C99
 @cindex ISO C9X
 @cindex C9X
+@cindex ISO C11
+@cindex C11
 @cindex ISO C1X
 @cindex C1X
 @cindex Technical Corrigenda
@@ -95,9 +97,11 @@  Errors in the 1999 ISO C standard were c
 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
@@ -106,12 +110,14 @@  Extensions,,Extensions to the C Language
 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
@@ -119,8 +125,9 @@  whole standard including all the library
 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
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi	(revision 182544)
+++ gcc/doc/extend.texi	(working copy)
@@ -5298,8 +5298,8 @@  GCC implements three different semantics
 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++.
 
@@ -6313,7 +6313,7 @@  a general-purpose header file that shoul
 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
@@ -7623,7 +7623,7 @@  be emitted.
 @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},
@@ -7843,7 +7843,7 @@  future revisions.
 @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}.
@@ -14123,7 +14123,7 @@  versions earlier than 4.4.
 @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:
Index: gcc/doc/cppopts.texi
===================================================================
--- gcc/doc/cppopts.texi	(revision 182544)
+++ gcc/doc/cppopts.texi	(working copy)
@@ -392,8 +392,11 @@  The 1990 C standard, as amended in 1994.
 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
@@ -403,9 +406,9 @@  The 1990 C standard plus GNU extensions.
 @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.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 182544)
+++ gcc/doc/invoke.texi	(working copy)
@@ -1557,11 +1557,12 @@  ISO C99.  Note that this standard is not
 @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
@@ -1573,10 +1574,10 @@  is the default for C code.
 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
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt	(revision 182544)
+++ gcc/c-family/c.opt	(working copy)
@@ -1191,9 +1191,13 @@  std=c++0x
 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)
@@ -1229,9 +1233,13 @@  std=gnu++0x
 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)
@@ -1265,6 +1273,10 @@  std=iso9899:199x
 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
 
Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 182544)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -113,7 +113,7 @@  static void set_std_cxx98 (int);
 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);
@@ -799,14 +799,14 @@  c_common_handle_option (size_t scode, co
 	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:
@@ -1465,7 +1465,7 @@  set_std_c89 (int c94, int iso)
   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).  */
@@ -1476,20 +1476,20 @@  set_std_c99 (int 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;
 }
Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 182544)
+++ gcc/c-family/c-common.c	(working copy)
@@ -216,13 +216,13 @@  int flag_cond_mismatch;
 
 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.  */
 
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h	(revision 182544)
+++ gcc/c-family/c-common.h	(working copy)
@@ -106,7 +106,7 @@  enum rid
   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
@@ -607,13 +607,13 @@  extern int flag_cond_mismatch;
 
 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.  */
 
Index: gcc/c-family/c-cppbuiltin.c
===================================================================
--- gcc/c-family/c-cppbuiltin.c	(revision 182544)
+++ gcc/c-family/c-cppbuiltin.c	(working copy)
@@ -646,7 +646,7 @@  cpp_atomic_builtins (cpp_reader *pfile)
       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))
Index: gcc/ginclude/stddef.h
===================================================================
--- gcc/ginclude/stddef.h	(revision 182544)
+++ gcc/ginclude/stddef.h	(working copy)
@@ -412,7 +412,7 @@  typedef __WINT_TYPE__ wint_t;
 /* 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
@@ -424,7 +424,7 @@  typedef struct {
   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 */
 
Index: gcc/ginclude/float.h
===================================================================
--- gcc/ginclude/float.h	(revision 182544)
+++ gcc/ginclude/float.h	(working copy)
@@ -1,4 +1,5 @@ 
-/* 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.
 
@@ -157,7 +158,7 @@  see the files COPYING3 and COPYING.RUNTI
 
 #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
@@ -194,7 +195,7 @@  see the files COPYING3 and COPYING.RUNTI
 #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
Index: gcc/testsuite/gcc.dg/c99-version-1.c
===================================================================
--- gcc/testsuite/gcc.dg/c99-version-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/c99-version-1.c	(revision 0)
@@ -0,0 +1,9 @@ 
+/* 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
Index: gcc/testsuite/gcc.dg/c94-version-1.c
===================================================================
--- gcc/testsuite/gcc.dg/c94-version-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/c94-version-1.c	(revision 0)
@@ -0,0 +1,9 @@ 
+/* 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
Index: gcc/testsuite/gcc.dg/gnu11-version-1.c
===================================================================
--- gcc/testsuite/gcc.dg/gnu11-version-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/gnu11-version-1.c	(revision 0)
@@ -0,0 +1,9 @@ 
+/* 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
Index: gcc/testsuite/gcc.dg/c11-version-1.c
===================================================================
--- gcc/testsuite/gcc.dg/c11-version-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/c11-version-1.c	(revision 0)
@@ -0,0 +1,9 @@ 
+/* 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
Index: gcc/testsuite/gcc.dg/c11-version-2.c
===================================================================
--- gcc/testsuite/gcc.dg/c11-version-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/c11-version-2.c	(revision 0)
@@ -0,0 +1,9 @@ 
+/* 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
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 182544)
+++ gcc/c-decl.c	(working copy)
@@ -1786,7 +1786,7 @@  diagnose_mismatched_decls (tree newdecl,
   /* 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)
     {
@@ -1815,7 +1815,7 @@  diagnose_mismatched_decls (tree newdecl,
 		 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);
@@ -6077,7 +6077,7 @@  grokdeclarator (const struct c_declarato
 	      DECL_DECLARED_INLINE_P (decl) = 1;
 	    if (declspecs->noreturn_p)
 	      {
-		if (!flag_isoc1x)
+		if (!flag_isoc11)
 		  {
 		    if (flag_isoc99)
 		      pedwarn (loc, OPT_pedantic,
@@ -6761,7 +6761,7 @@  grokfield (location_t loc,
 
 	 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.
@@ -6792,7 +6792,7 @@  grokfield (location_t loc,
 	  pedwarn (loc, 0, "declaration does not declare anything");
 	  return NULL_TREE;
 	}
-      if (!flag_isoc1x)
+      if (!flag_isoc11)
 	{
 	  if (flag_isoc99)
 	    pedwarn (loc, OPT_pedantic,
@@ -7072,7 +7072,7 @@  finish_struct (location_t loc, tree t, t
 	{
 	  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;
Index: gcc/c-typeck.c
===================================================================
--- gcc/c-typeck.c	(revision 182544)
+++ gcc/c-typeck.c	(working copy)
@@ -1014,7 +1014,7 @@  comptypes_check_different_types (tree ty
    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
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c	(revision 182544)
+++ gcc/c-parser.c	(working copy)
@@ -1796,7 +1796,7 @@  c_parser_asm_definition (c_parser *parse
   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 ;
@@ -1811,7 +1811,7 @@  c_parser_static_assert_declaration (c_pa
     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:
@@ -1827,7 +1827,7 @@  c_parser_static_assert_declaration_no_se
 
   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,
@@ -1902,7 +1902,7 @@  c_parser_static_assert_declaration_no_se
 
    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:
@@ -1917,7 +1917,7 @@  c_parser_static_assert_declaration_no_se
      inline
      _Noreturn
 
-   (_Noreturn is new in C1X.)
+   (_Noreturn is new in C11.)
 
    C90 6.5.2, C99 6.7.2:
    type-specifier:
@@ -2768,7 +2768,7 @@  c_parser_typeof_specifier (c_parser *par
 
 /* Parse an alignment-specifier.
 
-   C1X 6.7.5:
+   C11 6.7.5:
 
    alignment-specifier:
      _Alignas ( type-name )
@@ -2782,7 +2782,7 @@  c_parser_alignas_specifier (c_parser * p
   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,
@@ -5841,7 +5841,7 @@  c_parser_cast_expression (c_parser *pars
      __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__
@@ -6038,9 +6038,9 @@  c_parser_alignof_expression (c_parser *p
   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)
Index: libcpp/include/cpplib.h
===================================================================
--- libcpp/include/cpplib.h	(revision 182544)
+++ libcpp/include/cpplib.h	(working copy)
@@ -165,8 +165,8 @@  enum cpp_ttype
 #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.  */
Index: libcpp/init.c
===================================================================
--- libcpp/init.c	(revision 182544)
+++ libcpp/init.c	(working copy)
@@ -87,11 +87,11 @@  static const struct lang_flags lang_defa
 { /*              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 },
@@ -474,9 +474,9 @@  cpp_init_builtins (cpp_reader *pfile, in
     _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");