aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-04-25 22:54:22 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-04-25 22:54:22 +0100
commit2778d7667c9ef15520b1679417467934e24ffa0f (patch)
treefeff2a16895d1da5319551fc1b48b05b2a464692 /gcc/c-opts.c
parent045d4002b76c990d99a66dc6f6c1c014808a2e79 (diff)
downloadgcc-2778d7667c9ef15520b1679417467934e24ffa0f.zip
gcc-2778d7667c9ef15520b1679417467934e24ffa0f.tar.gz
gcc-2778d7667c9ef15520b1679417467934e24ffa0f.tar.bz2
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 __<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. From-SVN: r158711
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index a680f2d..66101b7 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -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;
}