From 60777f693d3ac0ad238b9c009f6d094d2a550d24 Mon Sep 17 00:00:00 2001 From: gdr Date: Sun, 23 Jun 2013 02:27:03 +0000 Subject: 2013-06-22 Gabriel Dos Reis * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. * c-cppbuiltin.c (c_cpp_builtins): Likewise. * c-opts.c (c_common_post_options): Likewise. cp/ 2013-06-22 Gabriel Dos Reis * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. * class.c (add_implicitly_declared_members): Likewise. (check_field_decl): Likewise. (finalize_literal_type_property): Likewise. (check_bases_and_members): Likewise. * decl.c (poplevel): Likewise. (case_conversion): Likewise. (check_initializer): Likewise. (grokfndecl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (grokdeclarator): Likewise. (build_enumerator): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (init_reswords): Likewise. * method.c (synthesized_method_walk): Likewise. (implicitly_declare_fn): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_constant_expression): Likewise. (cp_parser_for_init_statement): Likewise. (cp_parser_block_declaration): Likewise. (cp_parser_type_name): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_member_declaration): Likewise. (cp_nth_tokens_can_be_std_attribute_p): Likewise. (cp_parser_template_declaration_after_export): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (tsubst_copy_and_build): Likewise. (build_non_dependent_expr): Likewise. * semantics.c (non_const_var_error): Likewise. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. (build_vec_init_expr): Likewise. (cast_valid_in_integral_constant_expression_p): Likewise. * typeck.c (build_x_conditional_expr): Likewise. * typeck2.c (check_narrowing): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200348 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 8 +++++++- gcc/c-family/c-common.c | 4 ++-- gcc/c-family/c-cppbuiltin.c | 2 +- gcc/c-family/c-opts.c | 2 +- gcc/cp/ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ gcc/cp/call.c | 2 +- gcc/cp/class.c | 12 ++++++------ gcc/cp/decl.c | 16 ++++++++-------- gcc/cp/friend.c | 4 ++-- gcc/cp/lex.c | 2 +- gcc/cp/method.c | 8 ++++---- gcc/cp/parser.c | 32 ++++++++++++++++---------------- gcc/cp/pt.c | 24 ++++++++++++------------ gcc/cp/semantics.c | 4 ++-- gcc/cp/tree.c | 6 +++--- gcc/cp/typeck.c | 2 +- gcc/cp/typeck2.c | 2 +- 17 files changed, 110 insertions(+), 62 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 224e27be679..03269e906c3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2013-06-22 Gabriel Dos Reis + + * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. + * c-cppbuiltin.c (c_cpp_builtins): Likewise. + * c-opts.c (c_common_post_options): Likewise. + 2013-06-21 Balaji V. Iyer * c-common.h (struct cilkplus_an_parts): New structure. @@ -6,7 +12,7 @@ (fix_sec_implicit_args): Likewise. * array-notation-common.c (cilkplus_extract_an_triplets): New function. (fix_sec_implicit_args): Likewise. - + 2013-06-20 Balaji V. Iyer * array-notation-common.c (find_inv_trees): Removed an unwanted diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 7cb87345a80..8b780c20845 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5454,7 +5454,7 @@ c_common_nodes_and_builtins (void) { char16_type_node = make_unsigned_type (char16_type_size); - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) record_builtin_type (RID_CHAR16, "char16_t", char16_type_node); } @@ -5470,7 +5470,7 @@ c_common_nodes_and_builtins (void) { char32_type_node = make_unsigned_type (char32_type_size); - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) record_builtin_type (RID_CHAR32, "char32_t", char32_type_node); } diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 0059626f6e3..94078c00460 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -713,7 +713,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__DEPRECATED"); if (flag_rtti) cpp_define (pfile, "__GXX_RTTI"); - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__"); } /* Note that we define this for C as well, so that we know if diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index ea5a605891c..702fe1a8bdf 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -889,7 +889,7 @@ c_common_post_options (const char **pfilename) if (warn_implicit_function_declaration == -1) warn_implicit_function_declaration = flag_isoc99; - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) { /* If we're allowing C++0x constructs, don't warn about C++98 identifiers which are keywords in C++0x. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b4f36b017eb..55ed6a5659f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,45 @@ +2013-06-22 Gabriel Dos Reis + + * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. + * class.c (add_implicitly_declared_members): Likewise. + (check_field_decl): Likewise. + (finalize_literal_type_property): Likewise. + (check_bases_and_members): Likewise. + * decl.c (poplevel): Likewise. + (case_conversion): Likewise. + (check_initializer): Likewise. + (grokfndecl): Likewise. + (check_static_variable_definition): Likewise. + (compute_array_index_type): Likewise. + (grokdeclarator): Likewise. + (build_enumerator): Likewise. + * friend.c (make_friend_class): Likewise. + * lex.c (init_reswords): Likewise. + * method.c (synthesized_method_walk): Likewise. + (implicitly_declare_fn): Likewise. + * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. + (cp_parser_constant_expression): Likewise. + (cp_parser_for_init_statement): Likewise. + (cp_parser_block_declaration): Likewise. + (cp_parser_type_name): Likewise. + (cp_parser_enum_specifier): Likewise. + (cp_parser_enumerator_list): Likewise. + (cp_parser_member_declaration): Likewise. + (cp_nth_tokens_can_be_std_attribute_p): Likewise. + (cp_parser_template_declaration_after_export): Likewise. + * pt.c (convert_nontype_argument_function): Likewise. + (convert_nontype_argument): Likewise. + (convert_template_argument): Likewise. + (tsubst_copy_and_build): Likewise. + (build_non_dependent_expr): Likewise. + * semantics.c (non_const_var_error): Likewise. + (potential_constant_expression_1): Likewise. + * tree.c (lvalue_kind): Likewise. + (build_vec_init_expr): Likewise. + (cast_valid_in_integral_constant_expression_p): Likewise. + * typeck.c (build_x_conditional_expr): Likewise. + * typeck2.c (check_narrowing): Likewise. + 2013-06-21 Balaji V. Iyer * call.c (convert_like_real): Added a check if array notation is present diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 0c729e86626..6817bfc25a0 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -554,7 +554,7 @@ null_ptr_cst_p (tree t) if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t))) { /* Core issue 903 says only literal 0 is a null pointer constant. */ - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none)); STRIP_NOPS (t); if (integer_zerop (t) && !TREE_OVERFLOW (t)) diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 286164d0202..0067605969a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2971,7 +2971,7 @@ add_implicitly_declared_members (tree t, tree* access_decls, { bool move_ok = false; - if (cxx_dialect >= cxx0x && !CLASSTYPE_DESTRUCTORS (t) + if (cxx_dialect >= cxx11 && !CLASSTYPE_DESTRUCTORS (t) && !TYPE_HAS_COPY_CTOR (t) && !TYPE_HAS_COPY_ASSIGN (t) && !type_has_move_constructor (t) && !type_has_move_assign (t)) move_ok = true; @@ -2998,7 +2998,7 @@ add_implicitly_declared_members (tree t, tree* access_decls, { TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 1; CLASSTYPE_LAZY_DEFAULT_CTOR (t) = 1; - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) TYPE_HAS_CONSTEXPR_CTOR (t) /* This might force the declaration. */ = type_has_constexpr_default_constructor (t); @@ -3199,7 +3199,7 @@ check_field_decl (tree field, /* In C++98 an anonymous union cannot contain any fields which would change the settings of CANT_HAVE_CONST_CTOR and friends. */ - if (ANON_UNION_TYPE_P (type) && cxx_dialect < cxx0x) + if (ANON_UNION_TYPE_P (type) && cxx_dialect < cxx11) ; /* And, we don't set TYPE_HAS_CONST_COPY_CTOR, etc., for anonymous structs. So, we recurse through their fields here. */ @@ -3220,7 +3220,7 @@ check_field_decl (tree field, make it through without complaint. */ abstract_virtuals_error (field, type); - if (TREE_CODE (t) == UNION_TYPE && cxx_dialect < cxx0x) + if (TREE_CODE (t) == UNION_TYPE && cxx_dialect < cxx11) { static bool warned; int oldcount = errorcount; @@ -5181,7 +5181,7 @@ finalize_literal_type_property (tree t) { tree fn; - if (cxx_dialect < cxx0x + if (cxx_dialect < cxx11 || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) CLASSTYPE_LITERAL_P (t) = false; else if (CLASSTYPE_LITERAL_P (t) && !TYPE_HAS_TRIVIAL_DFLT (t) @@ -5321,7 +5321,7 @@ check_bases_and_members (tree t) /* Deduce noexcept on destructors. This needs to happen after we've set triviality flags appropriately for our bases. */ - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) deduce_noexcept_on_destructors (t); /* Check all the method declarations. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 225f13122ac..f562546db0c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -652,7 +652,7 @@ poplevel (int keep, int reverse, int functionbody) if (leaving_for_scope && VAR_P (link) /* It's hard to make this ARM compatibility hack play nicely with lambdas, and it really isn't necessary in C++11 mode. */ - && cxx_dialect < cxx0x + && cxx_dialect < cxx11 && DECL_NAME (link)) { tree name = DECL_NAME (link); @@ -3090,7 +3090,7 @@ case_conversion (tree type, tree value) if (value == NULL_TREE) return value; - if (cxx_dialect >= cxx0x + if (cxx_dialect >= cxx11 && (SCOPED_ENUM_P (type) || !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (value)))) { @@ -5757,7 +5757,7 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) { static int explained = 0; - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) error ("initializer invalid for static member with constructor"); else error ("non-constant in-class initialization invalid for static " @@ -7653,7 +7653,7 @@ grokfndecl (tree ctype, grokclassfn (ctype, decl, flags); /* 12.4/3 */ - if (cxx_dialect >= cxx0x + if (cxx_dialect >= cxx11 && DECL_DESTRUCTOR_P (decl) && !TYPE_BEING_DEFINED (DECL_CONTEXT (decl)) && !processing_template_decl) @@ -8053,7 +8053,7 @@ check_static_variable_definition (tree decl, tree type) in check_initializer. */ if (DECL_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl)) return 0; - else if (cxx_dialect >= cxx0x && !INTEGRAL_OR_ENUMERATION_TYPE_P (type)) + else if (cxx_dialect >= cxx11 && !INTEGRAL_OR_ENUMERATION_TYPE_P (type)) { if (!COMPLETE_TYPE_P (type)) error ("in-class initialization of static data member %q#D of " @@ -8175,7 +8175,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) mark_rvalue_use (size); - if (cxx_dialect < cxx0x && TREE_CODE (size) == NOP_EXPR + if (cxx_dialect < cxx11 && TREE_CODE (size) == NOP_EXPR && TREE_SIDE_EFFECTS (size)) /* In C++98, we mark a non-constant array bound with a magic NOP_EXPR with TREE_SIDE_EFFECTS; don't fold in that case. */; @@ -9534,7 +9534,7 @@ grokdeclarator (const cp_declarator *declarator, } else if (declarator->u.function.late_return_type) { - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) /* Not using maybe_warn_cpp0x because this should always be an error. */ error ("trailing return type only available with " @@ -12842,7 +12842,7 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc) && double_int_fits_to_tree_p (type, di)) break; } - if (type && cxx_dialect < cxx0x + if (type && cxx_dialect < cxx11 && itk > itk_unsigned_long) pedwarn (input_location, OPT_Wlong_long, pos ? "\ incremented enumerator value is too large for %" : "\ diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 3c63ea6dbb9..3e018e8e84c 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -230,8 +230,8 @@ make_friend_class (tree type, tree friend_type, bool complain) (possibly cv-qualified) class type, that class is declared as a friend; otherwise, the friend declaration is ignored. - So don't complain in C++0x mode. */ - if (cxx_dialect < cxx0x) + So don't complain in C++11 mode. */ + if (cxx_dialect < cxx11) pedwarn (input_location, complain ? 0 : OPT_Wpedantic, "invalid type %qT declared %", friend_type); return; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index e00d25a2a85..d6ed809d61d 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -171,7 +171,7 @@ init_reswords (void) tree id; int mask = 0; - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) mask |= D_CXX0X; if (flag_no_asm) mask |= D_ASM | D_EXT; diff --git a/gcc/cp/method.c b/gcc/cp/method.c index f314d0d6daf..4ac533eacf7 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1179,7 +1179,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, bool ctor_p; if (spec_p) - *spec_p = (cxx_dialect >= cxx0x ? noexcept_true_spec : empty_except_spec); + *spec_p = (cxx_dialect >= cxx11 ? noexcept_true_spec : empty_except_spec); if (deleted_p) { @@ -1271,7 +1271,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, resolution, so a constructor can be trivial even if it would otherwise call a non-trivial constructor. */ if (expected_trivial - && (!copy_arg_p || cxx_dialect < cxx0x)) + && (!copy_arg_p || cxx_dialect < cxx11)) { if (constexpr_p && sfk == sfk_constructor) { @@ -1632,7 +1632,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, if (deleted_p) constexpr_p = false; /* A trivial copy/move constructor is also a constexpr constructor. */ - else if (trivial_p && cxx_dialect >= cxx0x + else if (trivial_p && cxx_dialect >= cxx11 && (kind == sfk_copy_constructor || kind == sfk_move_constructor)) gcc_assert (constexpr_p); @@ -1713,7 +1713,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, DECL_IN_AGGR_P (fn) = 1; DECL_ARTIFICIAL (fn) = 1; DECL_DEFAULTED_FN (fn) = 1; - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) { DECL_DELETED_FN (fn) = deleted_p; DECL_DECLARED_CONSTEXPR_P (fn) = constexpr_p; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6fc45f30b36..f3bc27a698a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2829,7 +2829,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, template struct B : public A { X x; }; The user should have said "typename A::X". */ - if (cxx_dialect < cxx0x && id == ridpointers[(int)RID_CONSTEXPR]) + if (cxx_dialect < cxx11 && id == ridpointers[(int)RID_CONSTEXPR]) inform (location, "C++11 % only available with " "-std=c++11 or -std=gnu++11"); else if (processing_template_decl && current_class_type @@ -8259,7 +8259,7 @@ cp_parser_constant_expression (cp_parser* parser, /* We are now parsing a constant-expression. */ parser->integral_constant_expression_p = true; parser->allow_non_integral_constant_expression_p - = (allow_non_constant_p || cxx_dialect >= cxx0x); + = (allow_non_constant_p || cxx_dialect >= cxx11); parser->non_integral_constant_expression_p = false; /* Although the grammar says "conditional-expression", we parse an "assignment-expression", which also permits "throw-expression" @@ -8276,7 +8276,7 @@ cp_parser_constant_expression (cp_parser* parser, = saved_integral_constant_expression_p; parser->allow_non_integral_constant_expression_p = saved_allow_non_integral_constant_expression_p; - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) { /* Require an rvalue constant expression here; that's what our callers expect. Reference constant expressions are handled @@ -10428,7 +10428,7 @@ cp_parser_for_init_statement (cp_parser* parser, tree *decl) /* It is a range-for, consume the ':' */ cp_lexer_consume_token (parser->lexer); is_range_for = true; - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) { error_at (cp_lexer_peek_token (parser->lexer)->location, "range-based % loops are not allowed " @@ -10916,7 +10916,7 @@ cp_parser_block_declaration (cp_parser *parser, cp_parser_using_directive (parser); /* If the second token after 'using' is '=', then we have an alias-declaration. */ - else if (cxx_dialect >= cxx0x + else if (cxx_dialect >= cxx11 && token2->type == CPP_NAME && ((cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_EQ) || (cp_nth_tokens_can_be_attribute_p (parser, 3)))) @@ -14533,7 +14533,7 @@ cp_parser_type_name (cp_parser* parser) /* If it's not a class-name, keep looking. */ if (!cp_parser_parse_definitely (parser)) { - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) /* It must be a typedef-name or an enum-name. */ return cp_parser_nonclass_name (parser); @@ -15069,7 +15069,7 @@ cp_parser_enum_specifier (cp_parser* parser) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_CLASS) || cp_lexer_next_token_is_keyword (parser->lexer, RID_STRUCT)) { - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) maybe_warn_cpp0x (CPP0X_SCOPED_ENUMS); /* Consume the `struct' or `class' token. */ @@ -15163,7 +15163,7 @@ cp_parser_enum_specifier (cp_parser* parser) if (!cp_parser_parse_definitely (parser)) return NULL_TREE; - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) maybe_warn_cpp0x (CPP0X_SCOPED_ENUMS); has_underlying_type = true; @@ -15181,7 +15181,7 @@ cp_parser_enum_specifier (cp_parser* parser) /* Look for the `{' but don't consume it yet. */ if (!cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { - if (cxx_dialect < cxx0x || (!scoped_enum_p && !underlying_type)) + if (cxx_dialect < cxx11 || (!scoped_enum_p && !underlying_type)) { cp_parser_error (parser, "expected %<{%>"); if (has_underlying_type) @@ -15381,7 +15381,7 @@ cp_parser_enumerator_list (cp_parser* parser, tree type) /* If the next token is a `}', there is a trailing comma. */ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)) { - if (cxx_dialect < cxx0x && !in_system_header) + if (cxx_dialect < cxx11 && !in_system_header) pedwarn (input_location, OPT_Wpedantic, "comma at end of enumerator list"); break; @@ -19730,7 +19730,7 @@ cp_parser_member_declaration (cp_parser* parser) /* Check for a using-declaration. */ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_USING)) { - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) { /* Parse the using-declaration. */ cp_parser_using_declaration (parser, @@ -19834,7 +19834,7 @@ cp_parser_member_declaration (cp_parser* parser) { /* If the `friend' keyword was present, the friend must be introduced with a class-key. */ - if (!declares_class_or_enum && cxx_dialect < cxx0x) + if (!declares_class_or_enum && cxx_dialect < cxx11) pedwarn (decl_spec_token_start->location, OPT_Wpedantic, "in C++03 a class-key must be used " "when declaring a friend"); @@ -20034,7 +20034,7 @@ cp_parser_member_declaration (cp_parser* parser) initializer = cp_parser_pure_specifier (parser); else if (decl_specifiers.storage_class != sc_static) initializer = cp_parser_save_nsdmi (parser); - else if (cxx_dialect >= cxx0x) + else if (cxx_dialect >= cxx11) { bool nonconst; /* Don't require a constant rvalue in C++11, since we @@ -20573,7 +20573,7 @@ cp_parser_exception_specification_opt (cp_parser* parser) #if 0 /* Enable this once a lot of code has transitioned to noexcept? */ - if (cxx_dialect >= cxx0x && !in_system_header) + if (cxx_dialect >= cxx11 && !in_system_header) warning (OPT_Wdeprecated, "dynamic exception specifications are " "deprecated in C++0x; use % instead"); #endif @@ -21041,7 +21041,7 @@ cp_nth_tokens_can_be_std_attribute_p (cp_parser *parser, size_t n) { cp_token *token = cp_lexer_peek_nth_token (parser->lexer, n); - return (cxx_dialect >= cxx0x + return (cxx_dialect >= cxx11 && ((token->type == CPP_KEYWORD && token->keyword == RID_ALIGNAS) || (token->type == CPP_OPEN_SQUARE && (token = cp_lexer_peek_nth_token (parser->lexer, n + 1)) @@ -22457,7 +22457,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE)) cp_parser_template_declaration_after_export (parser, member_p); - else if (cxx_dialect >= cxx0x + else if (cxx_dialect >= cxx11 && cp_lexer_next_token_is_keyword (parser->lexer, RID_USING)) decl = cp_parser_alias_declaration (parser); else diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c9e376c69c5..667e37f2ec9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5151,9 +5151,9 @@ convert_nontype_argument_function (tree type, tree expr) } linkage = decl_linkage (fn_no_ptr); - if (cxx_dialect >= cxx0x ? linkage == lk_none : linkage != lk_external) + if (cxx_dialect >= cxx11 ? linkage == lk_none : linkage != lk_external) { - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) error ("%qE is not a valid template argument for type %qT " "because %qD has no linkage", expr, type, fn_no_ptr); @@ -5178,7 +5178,7 @@ check_valid_ptrmem_cst_expr (tree type, tree expr, STRIP_NOPS (expr); if (expr && (null_ptr_cst_p (expr) || TREE_CODE (expr) == PTRMEM_CST)) return true; - if (cxx_dialect >= cxx0x && null_member_pointer_value_p (expr)) + if (cxx_dialect >= cxx11 && null_member_pointer_value_p (expr)) return true; if (complain & tf_error) { @@ -5510,7 +5510,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) arbitrary constant expressions. Pointer and pointer to member arguments can be general constant expressions that evaluate to a null value, but otherwise still need to be of a specific form. */ - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) { if (TREE_CODE (expr) == PTRMEM_CST) /* A PTRMEM_CST is already constant, and a valid template @@ -5644,7 +5644,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) if (DECL_P (expr) && DECL_TEMPLATE_PARM_P (expr)) /* Non-type template parameters are OK. */ ; - else if (cxx_dialect >= cxx0x && integer_zerop (expr)) + else if (cxx_dialect >= cxx11 && integer_zerop (expr)) /* Null pointer values are OK in C++11. */; else if (TREE_CODE (expr) != ADDR_EXPR && TREE_CODE (expr_type) != ARRAY_TYPE) @@ -5681,14 +5681,14 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) expr, type, decl); return NULL_TREE; } - else if (cxx_dialect < cxx0x && !DECL_EXTERNAL_LINKAGE_P (decl)) + else if (cxx_dialect < cxx11 && !DECL_EXTERNAL_LINKAGE_P (decl)) { error ("%qE is not a valid template argument of type %qT " "because %qD does not have external linkage", expr, type, decl); return NULL_TREE; } - else if (cxx_dialect >= cxx0x && decl_linkage (decl) == lk_none) + else if (cxx_dialect >= cxx11 && decl_linkage (decl) == lk_none) { error ("%qE is not a valid template argument of type %qT " "because %qD has no linkage", @@ -5787,7 +5787,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) return error_mark_node; } - if (cxx_dialect >= cxx0x && integer_zerop (expr)) + if (cxx_dialect >= cxx11 && integer_zerop (expr)) /* Null pointer values are OK in C++11. */ return perform_qualification_conversions (type, expr); @@ -6216,7 +6216,7 @@ convert_template_argument (tree parm, tree t = maybe_get_template_decl_from_type_decl (TYPE_NAME (arg)); if (TREE_CODE (t) == TEMPLATE_DECL) { - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) /* OK under DR 1004. */; else if (complain & tf_warning_or_error) pedwarn (input_location, OPT_Wpedantic, "injected-class-name %qD" @@ -13518,7 +13518,7 @@ tsubst_copy_and_build (tree t, decl = finish_id_expression (t, decl, NULL_TREE, &idk, integral_constant_expression_p, - /*allow_non_integral_constant_expression_p=*/(cxx_dialect >= cxx0x), + /*allow_non_integral_constant_expression_p=*/(cxx_dialect >= cxx11), &non_integral_constant_expression_p, /*template_p=*/false, /*done=*/true, @@ -19834,7 +19834,7 @@ value_dependent_expression_p (tree expression) /* If there are no operands, it must be an expression such as "int()". This should not happen for aggregate types because it would form non-constant expressions. */ - gcc_assert (cxx_dialect >= cxx0x + gcc_assert (cxx_dialect >= cxx11 || INTEGRAL_OR_ENUMERATION_TYPE_P (type)); return false; @@ -20701,7 +20701,7 @@ build_non_dependent_expr (tree expr) #ifdef ENABLE_CHECKING /* Try to get a constant value for all non-dependent expressions in order to expose bugs in *_dependent_expression_p and constexpr. */ - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) maybe_constant_value (fold_non_dependent_expr_sfinae (expr, tf_none)); #endif diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3f0faa8081d..0a460a42544 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7790,7 +7790,7 @@ non_const_var_error (tree r) } else { - if (cxx_dialect >= cxx0x && !DECL_DECLARED_CONSTEXPR_P (r)) + if (cxx_dialect >= cxx11 && !DECL_DECLARED_CONSTEXPR_P (r)) inform (DECL_SOURCE_LOCATION (r), "%qD was not declared %", r); else @@ -8741,7 +8741,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) case STATIC_CAST_EXPR: case REINTERPRET_CAST_EXPR: case IMPLICIT_CONV_EXPR: - if (cxx_dialect < cxx0x + if (cxx_dialect < cxx11 && !dependent_type_p (TREE_TYPE (t)) && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (t))) /* In C++98, a conversion to non-integral type can't be part of a diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 4f71351f8eb..f8b4bbce822 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -211,7 +211,7 @@ lvalue_kind (const_tree ref) /* We just return clk_ordinary for NON_DEPENDENT_EXPR in C++98, but in C++11 lvalues don't bind to rvalue references, so we need to work harder to avoid bogus errors (c++/44870). */ - if (cxx_dialect < cxx0x) + if (cxx_dialect < cxx11) return clk_ordinary; else return lvalue_kind (TREE_OPERAND (ref, 0)); @@ -566,7 +566,7 @@ build_vec_init_expr (tree type, tree init, tsubst_flags_t complain) TREE_SIDE_EFFECTS (init) = true; SET_EXPR_LOCATION (init, input_location); - if (cxx_dialect >= cxx0x + if (cxx_dialect >= cxx11 && potential_constant_expression (elt_init)) VEC_INIT_EXPR_IS_CONSTEXPR (init) = true; VEC_INIT_EXPR_VALUE_INIT (init) = value_init; @@ -3956,7 +3956,7 @@ bool cast_valid_in_integral_constant_expression_p (tree type) { return (INTEGRAL_OR_ENUMERATION_TYPE_P (type) - || cxx_dialect >= cxx0x + || cxx_dialect >= cxx11 || dependent_type_p (type) || type == error_mark_node); } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 316a657d924..5b321ce5a7f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5945,7 +5945,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2, orig_ifexp, orig_op1, orig_op2); /* In C++11, remember that the result is an lvalue or xvalue. In C++98, lvalue_kind can just assume lvalue in a template. */ - if (cxx_dialect >= cxx0x + if (cxx_dialect >= cxx11 && lvalue_or_rvalue_with_address_p (expr) && !lvalue_or_rvalue_with_address_p (min)) TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min), diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 401904d8ea4..a44789362e3 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -890,7 +890,7 @@ check_narrowing (tree type, tree init) if (!ok) { - if (cxx_dialect >= cxx0x) + if (cxx_dialect >= cxx11) pedwarn (EXPR_LOC_OR_HERE (init), OPT_Wnarrowing, "narrowing conversion of %qE from %qT to %qT inside { }", init, ftype, type); -- cgit v1.2.1