Commit 97e3ad20 by Jason Merrill Committed by Jason Merrill

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
parent fdb0e1b4
2011-10-31 Jason Merrill <jason@redhat.com>
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 <ravitillo@lbl.gov> 2011-10-27 Roberto Agostino Vitillo <ravitillo@lbl.gov>
PR c++/30066 PR c++/30066
......
...@@ -643,11 +643,12 @@ extern int flag_use_repository; ...@@ -643,11 +643,12 @@ extern int flag_use_repository;
/* The supported C++ dialects. */ /* The supported C++ dialects. */
enum cxx_dialect { enum cxx_dialect {
/* C++98 */ /* C++98 with TC1 */
cxx98, cxx98,
/* Experimental features that are likely to become part of cxx03 = cxx98,
C++0x. */ /* C++11 */
cxx0x cxx0x,
cxx11 = cxx0x
}; };
/* The C++ dialect being used. C++98 is the default. */ /* The C++ dialect being used. C++98 is the default. */
......
...@@ -110,7 +110,7 @@ static size_t include_cursor; ...@@ -110,7 +110,7 @@ static size_t include_cursor;
static void handle_OPT_d (const char *); static void handle_OPT_d (const char *);
static void set_std_cxx98 (int); 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_c89 (int, int);
static void set_std_c99 (int); static void set_std_c99 (int);
static void set_std_c1x (int); static void set_std_c1x (int);
...@@ -775,10 +775,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -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 */); set_std_cxx98 (code == OPT_std_c__98 /* ISO */);
break; break;
case OPT_std_c__0x: case OPT_std_c__11:
case OPT_std_gnu__0x: case OPT_std_gnu__11:
if (!preprocessing_asm_p) if (!preprocessing_asm_p)
set_std_cxx0x (code == OPT_std_c__0x /* ISO */); set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
break; break;
case OPT_std_c90: case OPT_std_c90:
...@@ -1501,18 +1501,18 @@ set_std_cxx98 (int iso) ...@@ -1501,18 +1501,18 @@ set_std_cxx98 (int iso)
cxx_dialect = cxx98; 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 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_gnu_keywords = iso;
flag_no_nonansi_builtin = iso; flag_no_nonansi_builtin = iso;
flag_iso = iso; flag_iso = iso;
/* C++0x includes the C99 standard library. */ /* C++11 includes the C99 standard library. */
flag_isoc94 = 1; flag_isoc94 = 1;
flag_isoc99 = 1; flag_isoc99 = 1;
cxx_dialect = cxx0x; cxx_dialect = cxx11;
} }
/* Args to -d specify what to dump. Silently ignore /* Args to -d specify what to dump. Silently ignore
......
...@@ -289,7 +289,11 @@ Warn about C constructs that are not in the common subset of C and C++ ...@@ -289,7 +289,11 @@ Warn about C constructs that are not in the common subset of C and C++
Wc++0x-compat Wc++0x-compat
C++ ObjC++ Var(warn_cxx0x_compat) Warning 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 Wcast-qual
C ObjC C++ ObjC++ Var(warn_cast_qual) Warning C ObjC C++ ObjC++ Var(warn_cast_qual) Warning
...@@ -1175,12 +1179,13 @@ std=c++03 ...@@ -1175,12 +1179,13 @@ std=c++03
C++ ObjC++ Alias(std=c++98) C++ ObjC++ Alias(std=c++98)
Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum
std=c++0x std=c++11
C++ ObjC++ C++ ObjC++
Conform to the ISO 1998 C++ standard, with extensions that are likely to Conform to the ISO 2011 C++ standard (experimental and incomplete support)
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 std=c++0x
future releases of GCC. C++ ObjC++ Alias(std=c++11)
Deprecated in favor of -std=c++11
std=c1x std=c1x
C ObjC C ObjC
...@@ -1204,14 +1209,21 @@ Deprecated in favor of -std=c99 ...@@ -1204,14 +1209,21 @@ Deprecated in favor of -std=c99
std=gnu++98 std=gnu++98
C++ ObjC++ 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++ C++ ObjC++
Conform to the ISO 1998 C++ standard, with GNU extensions and Conform to the ISO 2011 C++ standard with GNU extensions (experimental and incomplete support)
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 std=gnu++0x
are experimental and may be removed in future releases of GCC. C++ ObjC++ Alias(std=gnu++11)
Deprecated in favor of -std=gnu++11
std=gnu1x std=gnu1x
C ObjC C ObjC
......
2011-10-31 Jason Merrill <jason@redhat.com>
PR c++/50920
* 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.
2011-10-31 Diego Novillo <dnovillo@google.com> 2011-10-31 Diego Novillo <dnovillo@google.com>
* mangle.c (get_mangled_id): Factor from ... * mangle.c (get_mangled_id): Factor from ...
......
...@@ -2924,7 +2924,7 @@ check_field_decl (tree field, ...@@ -2924,7 +2924,7 @@ check_field_decl (tree field,
if (!warned && errorcount > oldcount) if (!warned && errorcount > oldcount)
{ {
inform (DECL_SOURCE_LOCATION (field), "unrestricted unions " inform (DECL_SOURCE_LOCATION (field), "unrestricted unions "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
warned = true; warned = true;
} }
} }
......
...@@ -3205,55 +3205,55 @@ maybe_warn_cpp0x (cpp0x_warn_str str) ...@@ -3205,55 +3205,55 @@ maybe_warn_cpp0x (cpp0x_warn_str str)
case CPP0X_INITIALIZER_LISTS: case CPP0X_INITIALIZER_LISTS:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"extended initializer lists " "extended initializer lists "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_EXPLICIT_CONVERSION: case CPP0X_EXPLICIT_CONVERSION:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"explicit conversion operators " "explicit conversion operators "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_VARIADIC_TEMPLATES: case CPP0X_VARIADIC_TEMPLATES:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"variadic templates " "variadic templates "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_LAMBDA_EXPR: case CPP0X_LAMBDA_EXPR:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"lambda expressions " "lambda expressions "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_AUTO: case CPP0X_AUTO:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"C++0x auto only available with -std=c++0x or -std=gnu++0x"); "C++0x auto only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_SCOPED_ENUMS: case CPP0X_SCOPED_ENUMS:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"scoped enums only available with -std=c++0x or -std=gnu++0x"); "scoped enums only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_DEFAULTED_DELETED: case CPP0X_DEFAULTED_DELETED:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"defaulted and deleted functions " "defaulted and deleted functions "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_INLINE_NAMESPACES: case CPP0X_INLINE_NAMESPACES:
pedwarn (input_location, OPT_pedantic, pedwarn (input_location, OPT_pedantic,
"inline namespaces " "inline namespaces "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_OVERRIDE_CONTROLS: case CPP0X_OVERRIDE_CONTROLS:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"override controls (override/final) " "override controls (override/final) "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_NSDMI: case CPP0X_NSDMI:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"non-static data member initializers " "non-static data member initializers "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
case CPP0X_USER_DEFINED_LITERALS: case CPP0X_USER_DEFINED_LITERALS:
pedwarn (input_location, 0, pedwarn (input_location, 0,
"user-defined literals " "user-defined literals "
"only available with -std=c++0x or -std=gnu++0x"); "only available with -std=c++11 or -std=gnu++11");
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
......
...@@ -2759,8 +2759,8 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, ...@@ -2759,8 +2759,8 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
The user should have said "typename A<T>::X". */ The user should have said "typename A<T>::X". */
if (cxx_dialect < cxx0x && id == ridpointers[(int)RID_CONSTEXPR]) if (cxx_dialect < cxx0x && id == ridpointers[(int)RID_CONSTEXPR])
inform (location, "C++0x %<constexpr%> only available with " inform (location, "C++11 %<constexpr%> only available with "
"-std=c++0x or -std=gnu++0x"); "-std=c++11 or -std=gnu++11");
else if (processing_template_decl && current_class_type else if (processing_template_decl && current_class_type
&& TYPE_BINFO (current_class_type)) && TYPE_BINFO (current_class_type))
{ {
......
...@@ -4650,7 +4650,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary, ...@@ -4650,7 +4650,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
"friend declarations"); "friend declarations");
else if (TREE_CODE (decl) == FUNCTION_DECL && (cxx_dialect == cxx98)) else if (TREE_CODE (decl) == FUNCTION_DECL && (cxx_dialect == cxx98))
msg = G_("default template arguments may not be used in function templates " msg = G_("default template arguments may not be used in function templates "
"without -std=c++0x or -std=gnu++0x"); "without -std=c++11 or -std=gnu++11");
else if (is_partial) else if (is_partial)
msg = G_("default template arguments may not be used in " msg = G_("default template arguments may not be used in "
"partial specializations"); "partial specializations");
......
// { dg-options "-std=c++98" } // { dg-options "-std=c++98" }
constexpr int i = 42; // { dg-message "std=c\\+\\+0x" } constexpr int i = 42; // { dg-message "std=c\\+\\+11" }
// { dg-error "constexpr" "" { target *-*-* } 3 } // { dg-error "constexpr" "" { target *-*-* } 3 }
2011-10-31 Jason Merrill <jason@redhat.com>
PR c++/50920
* include/cpplib.h (enum c_lang): Rename CLK_CXX0X to CLK_CXX11,
CLK_GNUCXX0X to CLK_GNUCXX11.
2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net> 2011-10-26 Ed Smith-Rowland <3dw4rd@verizon.net>
Implement C++11 user-defined literals. Implement C++11 user-defined literals.
......
...@@ -167,7 +167,7 @@ enum cpp_ttype ...@@ -167,7 +167,7 @@ enum cpp_ttype
/* C language kind, used when calling cpp_create_reader. */ /* C language kind, used when calling cpp_create_reader. */
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC1X, enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC1X,
CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC1X, CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC1X,
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX0X, CLK_CXX0X, CLK_ASM}; CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string { struct GTY(()) cpp_string {
......
...@@ -94,11 +94,11 @@ static const struct lang_flags lang_defaults[] = ...@@ -94,11 +94,11 @@ static const struct lang_flags lang_defaults[] =
/* STDC1X */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0 }, /* STDC1X */ { 1, 0, 1, 0, 1, 1, 1, 1, 0, 0 },
/* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1, 0, 0, 0 }, /* GNUCXX */ { 0, 1, 1, 0, 0, 1, 1, 0, 0, 0 },
/* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0 }, /* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0 },
/* GNUCXX0X */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1 }, /* GNUCXX11 */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1 },
/* CXX0X */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }, /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 },
/* ASM */ { 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 } /* ASM */ { 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 }
/* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX0X, and /* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, and
CXX0X when no longer experimental (when all uses of identifiers CXX11 when no longer experimental (when all uses of identifiers
in the compiler have been audited for correct handling of in the compiler have been audited for correct handling of
extended identifiers). */ extended identifiers). */
}; };
......
2011-10-31 Jason Merrill <jason@redhat.com>
PR c++/50920
* include/bits/c++0x_warning.h: Change -std=c++0x to -std=c++11.
2011-10-30 Gerald Pfeifer <gerald@pfeifer.com> 2011-10-30 Gerald Pfeifer <gerald@pfeifer.com>
* prerequisites.xml: Refer to GCC (instead of gcc) and GNU/Linux. * prerequisites.xml: Refer to GCC (instead of gcc) and GNU/Linux.
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#define _CXX0X_WARNING_H 1 #define _CXX0X_WARNING_H 1
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#error This file requires compiler and library support for the upcoming \ #error This file requires compiler and library support for the \
ISO C++ standard, C++0x. This support is currently experimental, and must be \ ISO C++ 2011 standard. This support is currently experimental, and must be \
enabled with the -std=c++0x or -std=gnu++0x compiler options. enabled with the -std=c++11 or -std=gnu++11 compiler options.
#endif #endif
#endif #endif
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <cstdbool> #include <cstdbool>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <cstdint> #include <cstdint>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <system_error> #include <system_error>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <type_traits> #include <type_traits>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <array> #include <array>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <tuple> #include <tuple>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <unordered_map> #include <unordered_map>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <unordered_set> #include <unordered_set>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <ccomplex> #include <ccomplex>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <cfenv> #include <cfenv>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <ctgmath> #include <ctgmath>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <random> #include <random>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <cinttypes> #include <cinttypes>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <regex> #include <regex>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <atomic> // { dg-excess-errors "In file included from" } #include <atomic> // { dg-excess-errors "In file included from" }
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <condition_variable> #include <condition_variable>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <future> #include <future>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <mutex> #include <mutex>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
#include <thread> #include <thread>
// { dg-error "upcoming ISO" "" { target *-*-* } 32 } // { dg-error "ISO C.. 2011" "" { target *-*-* } 32 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment