From 97e3ad20b12a5a317d98085df6f18a87f681f377 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 31 Oct 2011 15:34:14 -0400 Subject: re PR c++/50920 (add a -std=c++11 option to the driver) PR c++/50920 gcc/c-family * c-common.h (cxx_dialect): Add cxx11 and cxx03. * c.opt: Add -std=c++11, -std=gnu++11, -std=gnu++03, and -Wc++11-compat. * c-opts.c (set_std_cxx11): Rename from set_std_cxx0x. gcc/cp * class.c (check_field_decl): Change c++0x in diags to c++11. * error.c (maybe_warn_cpp0x): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. * pt.c (check_default_tmpl_args): Likewise. libcpp * include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11, CLK_GNUCXX0X to CLK_GNUCXX11. libstdc++-v3 * include/bits/c++0x_warning.h: Change -std=c++0x to -std=c++11. From-SVN: r180707 --- gcc/c-family/ChangeLog | 8 ++++++++ gcc/c-family/c-common.h | 9 +++++---- gcc/c-family/c-opts.c | 18 +++++++++--------- gcc/c-family/c.opt | 36 ++++++++++++++++++++++++------------ 4 files changed, 46 insertions(+), 25 deletions(-) (limited to 'gcc/c-family') diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 02e823f6548..d77004eb794 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2011-10-31 Jason Merrill + + PR c++/50920 + * c-common.h (cxx_dialect): Add cxx11 and cxx03. + * c.opt: Add -std=c++11, -std=gnu++11, -std=gnu++03, + and -Wc++11-compat. + * c-opts.c (set_std_cxx11): Rename from set_std_cxx0x. + 2011-10-27 Roberto Agostino Vitillo PR c++/30066 diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index be9d7295b2a..71746a949d3 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -643,11 +643,12 @@ extern int flag_use_repository; /* The supported C++ dialects. */ enum cxx_dialect { - /* C++98 */ + /* C++98 with TC1 */ cxx98, - /* Experimental features that are likely to become part of - C++0x. */ - cxx0x + cxx03 = cxx98, + /* C++11 */ + cxx0x, + cxx11 = cxx0x }; /* The C++ dialect being used. C++98 is the default. */ diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 6869d5c35ef..b56aec79906 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -110,7 +110,7 @@ static size_t include_cursor; static void handle_OPT_d (const char *); static void set_std_cxx98 (int); -static void set_std_cxx0x (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); @@ -775,10 +775,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, set_std_cxx98 (code == OPT_std_c__98 /* ISO */); break; - case OPT_std_c__0x: - case OPT_std_gnu__0x: + case OPT_std_c__11: + case OPT_std_gnu__11: if (!preprocessing_asm_p) - set_std_cxx0x (code == OPT_std_c__0x /* ISO */); + set_std_cxx11 (code == OPT_std_c__11 /* ISO */); break; case OPT_std_c90: @@ -1501,18 +1501,18 @@ set_std_cxx98 (int iso) cxx_dialect = cxx98; } -/* Set the C++ 0x working draft "standard" (without GNU extensions if ISO). */ +/* Set the C++ 2011 standard (without GNU extensions if ISO). */ static void -set_std_cxx0x (int iso) +set_std_cxx11 (int iso) { - cpp_set_lang (parse_in, iso ? CLK_CXX0X: CLK_GNUCXX0X); + cpp_set_lang (parse_in, iso ? CLK_CXX11: CLK_GNUCXX11); flag_no_gnu_keywords = iso; flag_no_nonansi_builtin = iso; flag_iso = iso; - /* C++0x includes the C99 standard library. */ + /* C++11 includes the C99 standard library. */ flag_isoc94 = 1; flag_isoc99 = 1; - cxx_dialect = cxx0x; + cxx_dialect = cxx11; } /* Args to -d specify what to dump. Silently ignore diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 693f1914c8c..336a75aa7b8 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -289,7 +289,11 @@ Warn about C constructs that are not in the common subset of C and C++ Wc++0x-compat C++ ObjC++ Var(warn_cxx0x_compat) Warning -Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 200x +Deprecated in favor of -Wc++11-compat + +Wc++11-compat +C++ ObjC++ Warning Alias(Wc++0x-compat) +Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011 Wcast-qual C ObjC C++ ObjC++ Var(warn_cast_qual) Warning @@ -1175,12 +1179,13 @@ std=c++03 C++ ObjC++ Alias(std=c++98) Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum -std=c++0x +std=c++11 C++ ObjC++ -Conform to the ISO 1998 C++ standard, with 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. +Conform to the ISO 2011 C++ standard (experimental and incomplete support) + +std=c++0x +C++ ObjC++ Alias(std=c++11) +Deprecated in favor of -std=c++11 std=c1x C ObjC @@ -1204,14 +1209,21 @@ Deprecated in favor of -std=c99 std=gnu++98 C++ ObjC++ -Conform to the ISO 1998 C++ standard with GNU extensions +Conform to the ISO 1998 C++ standard revised by the 2003 technical +corrigendum with GNU extensions -std=gnu++0x +std=gnu++03 +C++ ObjC++ Alias(std=gnu++98) +Conform to the ISO 1998 C++ standard revised by the 2003 technical +corrigendum with GNU extensions + +std=gnu++11 C++ ObjC++ -Conform to the ISO 1998 C++ standard, with GNU extensions and -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. +Conform to the ISO 2011 C++ standard with GNU extensions (experimental and incomplete support) + +std=gnu++0x +C++ ObjC++ Alias(std=gnu++11) +Deprecated in favor of -std=gnu++11 std=gnu1x C ObjC -- cgit v1.2.1