OSDN Git Service

gcc:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Apr 2010 21:54:22 +0000 (21:54 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Apr 2010 21:54:22 +0000 (21:54 +0000)
* 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
__<type>_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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158711 138bc75d-0d04-0410-961f-82ee72b054a4

19 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-cppbuiltin.c
gcc/c-opts.c
gcc/c.opt
gcc/doc/cpp.texi
gcc/doc/cppopts.texi
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/doc/standards.texi
gcc/ginclude/float.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c1x-float-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c90-float-1.c
gcc/testsuite/gcc.dg/c99-float-1.c
libcpp/ChangeLog
libcpp/include/cpplib.h
libcpp/init.c

index 8ee8c20..a6fd13b 100644 (file)
@@ -1,3 +1,25 @@
+2010-04-25  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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
+       __<type>_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.
+
 2010-04-25  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/gmon-sol2.c (_mcleanup): Change format string
index ac11367..25ce2d7 100644 (file)
@@ -280,10 +280,14 @@ int flag_cond_mismatch;
 
 int flag_isoc94;
 
-/* Nonzero means use the ISO C99 dialect of C.  */
+/* Nonzero means use the ISO C99 (or C1X) dialect of C.  */
 
 int flag_isoc99;
 
+/* Nonzero means use the ISO C1X dialect of C.  */
+
+int flag_isoc1x;
+
 /* Nonzero means that we have builtin functions, and main is an int.  */
 
 int flag_hosted = 1;
index 6ed3849..8dadc24 100644 (file)
@@ -595,10 +595,14 @@ extern int flag_cond_mismatch;
 
 extern int flag_isoc94;
 
-/* Nonzero means use the ISO C99 dialect of C.  */
+/* Nonzero means use the ISO C99 (or C1X) dialect of C.  */
 
 extern int flag_isoc99;
 
+/* Nonzero means use the ISO C1X dialect of C.  */
+
+extern int flag_isoc1x;
+
 /* Nonzero means that we have builtin functions, and main is an int.  */
 
 extern int flag_hosted;
index 1565aac..fa4d9a1 100644 (file)
@@ -105,6 +105,7 @@ builtin_define_float_constants (const char *name_prefix,
   char name[64], buf[128];
   int dig, min_10_exp, max_10_exp;
   int decimal_dig;
+  int type_decimal_dig;
 
   fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
   gcc_assert (fmt->b != 10);
@@ -198,8 +199,20 @@ builtin_define_float_constants (const char *name_prefix,
     if (decimal_dig < d_decimal_dig)
       decimal_dig++;
   }
+  /* Similar, for this type rather than long double.  */
+  {
+    double type_d_decimal_dig = 1 + fmt->p * log10_b;
+    type_decimal_dig = type_d_decimal_dig;
+    if (type_decimal_dig < type_d_decimal_dig)
+      type_decimal_dig++;
+  }
   if (type == long_double_type_node)
     builtin_define_with_int_value ("__DECIMAL_DIG__", decimal_dig);
+  else
+    {
+      sprintf (name, "__%s_DECIMAL_DIG__", name_prefix);
+      builtin_define_with_int_value (name, type_decimal_dig);
+    }
 
   /* Since, for the supported formats, B is always a power of 2, we
      construct the following numbers directly as a hexadecimal
index a680f2d..66101b7 100644 (file)
@@ -112,6 +112,7 @@ static void set_std_cxx98 (int);
 static void set_std_cxx0x (int);
 static void set_std_c89 (int, int);
 static void set_std_c99 (int);
+static void set_std_c1x (int);
 static void check_deps_environment_vars (void);
 static void handle_deferred_opts (void);
 static void sanitize_cpp_opts (void);
@@ -1066,6 +1067,16 @@ c_common_handle_option (size_t scode, const char *arg, int value)
        set_std_c99 (false /* ISO */);
       break;
 
+    case OPT_std_c1x:
+      if (!preprocessing_asm_p)
+       set_std_c1x (true /* ISO */);
+      break;
+
+    case OPT_std_gnu1x:
+      if (!preprocessing_asm_p)
+       set_std_c1x (false /* ISO */);
+      break;
+
     case OPT_trigraphs:
       cpp_opts->trigraphs = 1;
       break;
@@ -1704,6 +1715,7 @@ set_std_c89 (int c94, int iso)
   flag_no_nonansi_builtin = iso;
   flag_isoc94 = c94;
   flag_isoc99 = 0;
+  flag_isoc1x = 0;
 }
 
 /* Set the C 99 standard (without GNU extensions if ISO).  */
@@ -1714,6 +1726,20 @@ set_std_c99 (int iso)
   flag_no_asm = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
+  flag_isoc1x = 0;
+  flag_isoc99 = 1;
+  flag_isoc94 = 1;
+}
+
+/* Set the C 1X standard draft (without GNU extensions if ISO).  */
+static void
+set_std_c1x (int iso)
+{
+  cpp_set_lang (parse_in, iso ? CLK_STDC1X: CLK_GNUC1X);
+  flag_no_asm = iso;
+  flag_no_nonansi_builtin = iso;
+  flag_iso = iso;
+  flag_isoc1x = 1;
   flag_isoc99 = 1;
   flag_isoc94 = 1;
 }
index 973acf4..2e1933c 100644 (file)
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -961,6 +961,10 @@ become a part of the upcoming ISO C++ standard, dubbed C++0x. Note that the
 extensions enabled by this mode are experimental and may be removed in
 future releases of GCC.
 
+std=c1x
+C ObjC
+Conform to the ISO 201X C standard draft (experimental and incomplete support)
+
 std=c89
 C ObjC
 Conform to the ISO 1990 C standard
@@ -988,6 +992,10 @@ extensions that are likely to become a part of the upcoming ISO C++
 standard, dubbed C++0x. Note that the extensions enabled by this mode
 are experimental and may be removed in future releases of GCC.
 
+std=gnu1x
+C ObjC
+Conform to the ISO 201X C standard draft with GNU extensions (experimental and incomplete support)
+
 std=gnu89
 C ObjC
 Conform to the ISO 1990 C standard with GNU extensions
index 02e2be7..7a250bd 100644 (file)
@@ -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}.
 
index e73f77d..b5c77c7 100644 (file)
@@ -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.
 
index 0e499cc..e7880a3 100644 (file)
@@ -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},
index 0e39234..9829c1f 100644 (file)
@@ -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.
index b9761bb..f6d8acd 100644 (file)
@@ -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
index 9969f1c..5c472c5 100644 (file)
@@ -157,6 +157,45 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #endif /* C99 */
 
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 199901L
+/* Versions of DECIMAL_DIG for each floating-point type.  */
+#undef FLT_DECIMAL_DIG
+#undef DBL_DECIMAL_DIG
+#undef LDBL_DECIMAL_DIG
+#define FLT_DECIMAL_DIG                __FLT_DECIMAL_DIG__
+#define DBL_DECIMAL_DIG                __DBL_DECIMAL_DIG__
+#define LDBL_DECIMAL_DIG       __DECIMAL_DIG__
+
+/* Whether types support subnormal numbers.  */
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
+#define FLT_HAS_SUBNORM                __FLT_HAS_DENORM__
+#define DBL_HAS_SUBNORM                __DBL_HAS_DENORM__
+#define LDBL_HAS_SUBNORM       __LDBL_HAS_DENORM__
+
+/* Minimum positive values, including subnormals.  */
+#undef FLT_TRUE_MIN
+#undef DBL_TRUE_MIN
+#undef LDBL_TRUE_MIN
+#if __FLT_HAS_DENORM__
+#define FLT_TRUE_MIN   __FLT_DENORM_MIN__
+#else
+#define FLT_TRUE_MIN   __FLT_MIN__
+#endif
+#if __DBL_HAS_DENORM__
+#define DBL_TRUE_MIN   __DBL_DENORM_MIN__
+#else
+#define DBL_TRUE_MIN   __DBL_MIN__
+#endif
+#if __LDBL_HAS_DENORM__
+#define LDBL_TRUE_MIN  __LDBL_DENORM_MIN__
+#else
+#define LDBL_TRUE_MIN  __LDBL_MIN__
+#endif
+
+#endif /* C1X */
+
 #ifdef __STDC_WANT_DEC_FP__
 /* Draft Technical Report 24732, extension for decimal floating-point
    arithmetic: Characteristic of decimal floating types <float.h>.  */
index d098b8a..c4a24bb 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-25  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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.
+
 2010-04-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.target/i386/pr43766.c: Scan "lea\[lq\]?\[ \t\]" instead
diff --git a/gcc/testsuite/gcc.dg/c1x-float-1.c b/gcc/testsuite/gcc.dg/c1x-float-1.c
new file mode 100644 (file)
index 0000000..75233ac
--- /dev/null
@@ -0,0 +1,169 @@
+/* Test for <float.h> C1X macros.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do preprocess } */
+/* { dg-options "-std=c1x -pedantic-errors" } */
+
+/* This test checks that the C1X macros are defined;
+   it does not check the correctness of their values.  */
+
+#include <float.h>
+
+#ifndef FLT_ROUNDS
+#error "FLT_ROUNDS undefined"
+#endif
+
+#ifndef FLT_RADIX
+#error "FLT_RADIX undefined"
+#endif
+
+#ifndef FLT_MANT_DIG
+#error "FLT_MANT_DIG undefined"
+#endif
+
+#ifndef FLT_DIG
+#error "FLT_DIG undefined"
+#endif
+
+#ifndef FLT_MIN_EXP
+#error "FLT_MIN_EXP undefined"
+#endif
+
+#ifndef FLT_MIN_10_EXP
+#error "FLT_MIN_10_EXP undefined"
+#endif
+
+#ifndef FLT_MAX_EXP
+#error "FLT_MAX_EXP undefined"
+#endif
+
+#ifndef FLT_MAX_10_EXP
+#error "FLT_MAX_10_EXP undefined"
+#endif
+
+#ifndef FLT_MAX
+#error "FLT_MAX undefined"
+#endif
+
+#ifndef FLT_EPSILON
+#error "FLT_EPSILON undefined"
+#endif
+
+#ifndef FLT_MIN
+#error "FLT_MIN undefined"
+#endif
+
+#ifndef DBL_MANT_DIG
+#error "DBL_MANT_DIG undefined"
+#endif
+
+#ifndef DBL_DIG
+#error "DBL_DIG undefined"
+#endif
+
+#ifndef DBL_MIN_EXP
+#error "DBL_MIN_EXP undefined"
+#endif
+
+#ifndef DBL_MIN_10_EXP
+#error "DBL_MIN_10_EXP undefined"
+#endif
+
+#ifndef DBL_MAX_EXP
+#error "DBL_MAX_EXP undefined"
+#endif
+
+#ifndef DBL_MAX_10_EXP
+#error "DBL_MAX_10_EXP undefined"
+#endif
+
+#ifndef DBL_MAX
+#error "DBL_MAX undefined"
+#endif
+
+#ifndef DBL_EPSILON
+#error "DBL_EPSILON undefined"
+#endif
+
+#ifndef DBL_MIN
+#error "DBL_MIN undefined"
+#endif
+
+#ifndef LDBL_MANT_DIG
+#error "LDBL_MANT_DIG undefined"
+#endif
+
+#ifndef LDBL_DIG
+#error "LDBL_DIG undefined"
+#endif
+
+#ifndef LDBL_MIN_EXP
+#error "LDBL_MIN_EXP undefined"
+#endif
+
+#ifndef LDBL_MIN_10_EXP
+#error "LDBL_MIN_10_EXP undefined"
+#endif
+
+#ifndef LDBL_MAX_EXP
+#error "LDBL_MAX_EXP undefined"
+#endif
+
+#ifndef LDBL_MAX_10_EXP
+#error "LDBL_MAX_10_EXP undefined"
+#endif
+
+#ifndef LDBL_MAX
+#error "LDBL_MAX undefined"
+#endif
+
+#ifndef LDBL_EPSILON
+#error "LDBL_EPSILON undefined"
+#endif
+
+#ifndef LDBL_MIN
+#error "LDBL_MIN undefined"
+#endif
+
+#ifndef FLT_EVAL_METHOD
+#error "FLT_EVAL_METHOD undefined"
+#endif
+
+#ifndef DECIMAL_DIG
+#error "DECIMAL_DIG undefined"
+#endif
+
+#ifndef FLT_DECIMAL_DIG
+#error "FLT_DECIMAL_DIG undefined"
+#endif
+
+#ifndef DBL_DECIMAL_DIG
+#error "DBL_DECIMAL_DIG undefined"
+#endif
+
+#ifndef LDBL_DECIMAL_DIG
+#error "LDBL_DECIMAL_DIG undefined"
+#endif
+
+#ifndef FLT_HAS_SUBNORM
+#error "FLT_HAS_SUBNORM undefined"
+#endif
+
+#ifndef DBL_HAS_SUBNORM
+#error "DBL_HAS_SUBNORM undefined"
+#endif
+
+#ifndef LDBL_HAS_SUBNORM
+#error "LDBL_HAS_SUBNORM undefined"
+#endif
+
+#ifndef FLT_TRUE_MIN
+#error "FLT_TRUE_MIN undefined"
+#endif
+
+#ifndef DBL_TRUE_MIN
+#error "DBL_TRUE_MIN undefined"
+#endif
+
+#ifndef LDBL_TRUE_MIN
+#error "LDBL_TRUE_MIN undefined"
+#endif
index 39a585b..5a2cab6 100644 (file)
@@ -3,8 +3,8 @@
 /* { dg-do preprocess } */
 /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
 
-/* This test checks that the C90 macros (but not the C99 ones) are defined;
-   it does not check the correctness of their values.  */
+/* This test checks that the C90 macros (but not the C99 or C1X ones)
+   are defined; it does not check the correctness of their values.  */
 
 #include <float.h>
 
 #ifdef DECIMAL_DIG
 #error "DECIMAL_DIG defined"
 #endif
+
+#ifdef FLT_DECIMAL_DIG
+#error "FLT_DECIMAL_DIG defined"
+#endif
+
+#ifdef DBL_DECIMAL_DIG
+#error "DBL_DECIMAL_DIG defined"
+#endif
+
+#ifdef LDBL_DECIMAL_DIG
+#error "LDBL_DECIMAL_DIG defined"
+#endif
+
+#ifdef FLT_HAS_SUBNORM
+#error "FLT_HAS_SUBNORM defined"
+#endif
+
+#ifdef DBL_HAS_SUBNORM
+#error "DBL_HAS_SUBNORM defined"
+#endif
+
+#ifdef LDBL_HAS_SUBNORM
+#error "LDBL_HAS_SUBNORM defined"
+#endif
+
+#ifdef FLT_TRUE_MIN
+#error "FLT_TRUE_MIN defined"
+#endif
+
+#ifdef DBL_TRUE_MIN
+#error "DBL_TRUE_MIN defined"
+#endif
+
+#ifdef LDBL_TRUE_MIN
+#error "LDBL_TRUE_MIN defined"
+#endif
index 07fb9ee..f0dc391 100644 (file)
@@ -3,7 +3,7 @@
 /* { dg-do preprocess } */
 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
 
-/* This test checks that the C99 macros are defined;
+/* This test checks that the C99 macros (but not the C1X ones) are defined;
    it does not check the correctness of their values.  */
 
 #include <float.h>
 #ifndef DECIMAL_DIG
 #error "DECIMAL_DIG undefined"
 #endif
+
+#ifdef FLT_DECIMAL_DIG
+#error "FLT_DECIMAL_DIG defined"
+#endif
+
+#ifdef DBL_DECIMAL_DIG
+#error "DBL_DECIMAL_DIG defined"
+#endif
+
+#ifdef LDBL_DECIMAL_DIG
+#error "LDBL_DECIMAL_DIG defined"
+#endif
+
+#ifdef FLT_HAS_SUBNORM
+#error "FLT_HAS_SUBNORM defined"
+#endif
+
+#ifdef DBL_HAS_SUBNORM
+#error "DBL_HAS_SUBNORM defined"
+#endif
+
+#ifdef LDBL_HAS_SUBNORM
+#error "LDBL_HAS_SUBNORM defined"
+#endif
+
+#ifdef FLT_TRUE_MIN
+#error "FLT_TRUE_MIN defined"
+#endif
+
+#ifdef DBL_TRUE_MIN
+#error "DBL_TRUE_MIN defined"
+#endif
+
+#ifdef LDBL_TRUE_MIN
+#error "LDBL_TRUE_MIN defined"
+#endif
index 24838d3..cc77ca0 100644 (file)
@@ -1,3 +1,10 @@
+2010-04-25  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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.
+
 2010-04-09  Manuel López-Ibáñez <manu@gcc.gnu.org>
 
        PR cpp/43195
index 9f29e6e..0828ea4 100644 (file)
@@ -155,7 +155,8 @@ enum cpp_ttype
 #undef TK
 
 /* C language kind, used when calling cpp_create_reader.  */
-enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
+enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC1X,
+            CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC1X,
             CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX0X, CLK_CXX0X, CLK_ASM};
 
 /* Payload of a NUMBER, STRING, CHAR or COMMENT token.  */
index f5bf0ea..ae5ae45 100644 (file)
@@ -84,9 +84,11 @@ static const struct lang_flags lang_defaults[] =
 { /*              c99 c++ xnum xid std  //   digr ulit */
   /* GNUC89   */  { 0,  0,  1,   0,  0,   1,   1,   0 },
   /* GNUC99   */  { 1,  0,  1,   0,  0,   1,   1,   1 },
+  /* GNUC1X   */  { 1,  0,  1,   0,  0,   1,   1,   1 },
   /* STDC89   */  { 0,  0,  0,   0,  1,   0,   0,   0 },
   /* STDC94   */  { 0,  0,  0,   0,  1,   0,   1,   0 },
   /* STDC99   */  { 1,  0,  1,   0,  1,   1,   1,   0 },
+  /* STDC1X   */  { 1,  0,  1,   0,  1,   1,   1,   0 },
   /* GNUCXX   */  { 0,  1,  1,   0,  0,   1,   1,   0 },
   /* CXX98    */  { 0,  1,  1,   0,  1,   1,   1,   0 },
   /* GNUCXX0X */  { 1,  1,  1,   0,  0,   1,   1,   1 },
@@ -457,6 +459,9 @@ cpp_init_builtins (cpp_reader *pfile, int hosted)
     _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, c99))
     _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");