From 2778d7667c9ef15520b1679417467934e24ffa0f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sun, 25 Apr 2010 22:54:22 +0100 Subject: c-common.c (flag_isoc1x): New. gcc: * c-common.c (flag_isoc1x): New. (flag_isoc99): Update comment. * c-common.h (flag_isoc1x): New. (flag_isoc99): Update comment. * c-cppbuiltin.c (builtin_define_float_constants): Also define ___DECIMAL_DIG__. * c-opts.c (set_std_c1x): New. (c_common_handle_option): Handle -std=c1x and -std=gnu1x. (set_std_c89, set_std_c99): Also set flag_isoc1x to 0. * c.opt (-std=c1x, -std=gnu1x): New options. * doc/cpp.texi: Mention -std=c1x. * doc/cppopts.texi (-std=c1x, -std=gnu1x): Document. * doc/extend.texi: Mention -std=c1x and -std=gnu1x. * doc/invoke.texi (-std=c1x, -std=gnu1x): Document. * doc/standards.texi: Mention C1X. * ginclude/float.h (FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG, FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, LDBL_HAS_SUBNORM, FLT_TRUE_MIN, DBL_TRUE_MIN, LDBL_TRUE_MIN): Define for C1X. gcc/testsuite: * gcc.dg/c90-float-1.c: Also test that C1X macros are not defined. * gcc.dg/c99-float-1.c: Also test that C1X macros are not defined. * gcc.dg/c1x-float-1.c: New test. libcpp: * include/cpplib.h (enum c_lang): Add CLK_GNUC1X and CLK_STDC1X. * init.c (lang_defaults): Add entries for new language variants. (cpp_init_builtins): Define __STDC_VERSION__ to 201000L for C1X variants. From-SVN: r158711 --- gcc/doc/cpp.texi | 3 ++- gcc/doc/cppopts.texi | 7 +++++++ gcc/doc/extend.texi | 16 ++++++++++------ gcc/doc/invoke.texi | 11 +++++++++++ gcc/doc/standards.texi | 11 +++++++++-- 5 files changed, 39 insertions(+), 9 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 02e2be7..7a250bd 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -215,7 +215,8 @@ Standard C@. In its default mode, the GNU C preprocessor does not do a few things required by the standard. These are features which are 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} or @option{-std=c99} options, depending +you should use the @option{-std=c90}, @option{-std=c99} or +@option{-std=c1x} options, depending on which version of the standard you want. To get all the mandatory diagnostics, you must also use @option{-pedantic}. @xref{Invocation}. diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index e73f77d..b5c77c7 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -392,6 +392,9 @@ 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 gnu90 @itemx gnu89 The 1990 C standard plus GNU extensions. This is the default. @@ -400,6 +403,10 @@ The 1990 C standard plus GNU extensions. This is the default. @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 c++98 The 1998 ISO C++ standard plus amendments. diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0e499cc..e7880a3 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4936,8 +4936,10 @@ into their callers with the option @option{-finline-functions}. GCC implements three different semantics of declaring a function 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} or -@option{-std=gnu99} (without @option{-fgnu89-inline}), and the third +on all inline declarations, another when +@option{-std=c99}, @option{-std=c1x}, +@option{-std=gnu99} or @option{-std=gnu1x} +(without @option{-fgnu89-inline}), and the third is used when compiling C++. To declare a function inline, use the @code{inline} keyword in its @@ -5868,10 +5870,12 @@ a general-purpose header file that should be usable by all programs, 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}). The ISO C99 keyword +program compiled with @option{-std=c99} or @option{-std=c1x}). 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 -@option{-std=iso9899:1999}) is used. +@option{-std=iso9899:1999}), or an option for a later standard +version, is used. The way to solve these problems is to put @samp{__} at the beginning and end of each problematical keyword. For example, use @code{__asm__} @@ -6857,8 +6861,8 @@ be emitted. @opindex ansi @opindex std -Outside strict ISO C mode (@option{-ansi}, @option{-std=c90} or -@option{-std=c99}), the functions +Outside strict ISO C mode (@option{-ansi}, @option{-std=c90}, +@option{-std=c99} or @option{-std=c1x}), 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}, diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0e39234..9829c1f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1500,6 +1500,12 @@ ISO C99. Note that this standard is not yet fully supported; see @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 gnu90 @itemx gnu89 GNU dialect of ISO C90 (including some C99 features). This @@ -1510,6 +1516,11 @@ 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 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. + @item c++98 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for C++ code. diff --git a/gcc/doc/standards.texi b/gcc/doc/standards.texi index b9761bb..f6d8acd 100644 --- a/gcc/doc/standards.texi +++ b/gcc/doc/standards.texi @@ -33,6 +33,8 @@ with some exceptions, and possibly with some extensions. @cindex C99 @cindex ISO C9X @cindex C9X +@cindex ISO C1X +@cindex C1X @cindex Technical Corrigenda @cindex TC1 @cindex Technical Corrigendum 1 @@ -93,14 +95,19 @@ Errors in the 1999 ISO C standard were corrected in three Technical 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}. + By default, GCC provides some extensions to the C language that on rare occasions conflict with the C standard. @xref{C Extensions,,Extensions to the C Language Family}. Use of the @option{-std} options listed above will disable these extensions where 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) or @option{-std=gnu99} -(for C99 with GNU extensions). The default, if no C language dialect +@option{-std=gnu90} (for C90 with GNU extensions), @option{-std=gnu99} +(for C99 with GNU extensions) or @option{-std=gnu1x} (for C1X 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 complete. Some features that are part of the C99 standard are -- cgit v1.1