From: Jason Merrill Date: Tue, 30 Sep 2014 17:12:06 +0000 (-0400) Subject: c-common.h (enum rid): Remove RID_IS_CONVERTIBLE_TO. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d0cf15e1c9583723314193c1add818374d5f897;p=gcc.git c-common.h (enum rid): Remove RID_IS_CONVERTIBLE_TO. c-family/ * c-common.h (enum rid): Remove RID_IS_CONVERTIBLE_TO. * c-common.c (c_common_reswords): Remove __is_convertible_to. cp/ * cp-tree.h (cp_trait_kind): Remove CPTK_IS_CONVERTIBLE_TO. * cxx-pretty-print.c (pp_cxx_trait_expression): Likewise. * semantics.c (trait_expr_value): Likewise. (finish_trait_expr): Likewise. * parser.c (cp_parser_primary_expression): Likewise. (cp_parser_trait_expr): Likewise. Remove redundant grokdeclarator. From-SVN: r215735 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2278e779441..262b2d4de2f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2014-09-30 Jason Merrill + + * c-common.h (enum rid): Remove RID_IS_CONVERTIBLE_TO. + * c-common.c (c_common_reswords): Remove __is_convertible_to. + 2014-09-24 Marek Polacek PR c/61405 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index a9e019199cd..0324a0aaa30 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -472,7 +472,6 @@ const struct c_common_resword c_common_reswords[] = { "__is_abstract", RID_IS_ABSTRACT, D_CXXONLY }, { "__is_base_of", RID_IS_BASE_OF, D_CXXONLY }, { "__is_class", RID_IS_CLASS, D_CXXONLY }, - { "__is_convertible_to", RID_IS_CONVERTIBLE_TO, D_CXXONLY }, { "__is_empty", RID_IS_EMPTY, D_CXXONLY }, { "__is_enum", RID_IS_ENUM, D_CXXONLY }, { "__is_final", RID_IS_FINAL, D_CXXONLY }, diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 5ec79a06e98..5ba7859cb9d 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -138,7 +138,7 @@ enum rid RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, - RID_IS_CLASS, RID_IS_CONVERTIBLE_TO, + RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_FINAL, RID_IS_LITERAL_TYPE, RID_IS_POD, RID_IS_POLYMORPHIC, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3fe3f8d5775..00d3fe277f8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2014-09-30 Jason Merrill + + * cp-tree.h (cp_trait_kind): Remove CPTK_IS_CONVERTIBLE_TO. + * cxx-pretty-print.c (pp_cxx_trait_expression): Likewise. + * semantics.c (trait_expr_value): Likewise. + (finish_trait_expr): Likewise. + * parser.c (cp_parser_primary_expression): Likewise. + (cp_parser_trait_expr): Likewise. Remove redundant grokdeclarator. + 2014-09-30 Manuel López-Ibáñez PR c++/16564 diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index b4a72d6e30a..e6e90f76c02 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -354,9 +354,9 @@ DEFTREECODE (STMT_EXPR, "stmt_expr", tcc_expression, 1) is applied. */ DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", tcc_unary, 1) -/** C++0x extensions. */ +/** C++11 extensions. */ -/* A static assertion. This is a C++0x extension. +/* A static assertion. This is a C++11 extension. STATIC_ASSERT_CONDITION contains the condition that is being checked. STATIC_ASSERT_MESSAGE contains the message (a string literal) to be displayed if the condition fails to hold. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f0783abff2d..789ef1afb44 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -645,7 +645,6 @@ typedef enum cp_trait_kind CPTK_IS_ABSTRACT, CPTK_IS_BASE_OF, CPTK_IS_CLASS, - CPTK_IS_CONVERTIBLE_TO, CPTK_IS_EMPTY, CPTK_IS_ENUM, CPTK_IS_FINAL, diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index f5f91c804c1..f0734ec2f4f 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -388,7 +388,6 @@ pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t) __is_abstract ( type-id ) __is_base_of ( type-id , type-id ) __is_class ( type-id ) - __is_convertible_to ( type-id , type-id ) __is_empty ( type-id ) __is_enum ( type-id ) __is_literal_type ( type-id ) @@ -2373,9 +2372,6 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t) case CPTK_IS_CLASS: pp_cxx_ws_string (pp, "__is_class"); break; - case CPTK_IS_CONVERTIBLE_TO: - pp_cxx_ws_string (pp, "__is_convertible_to"); - break; case CPTK_IS_EMPTY: pp_cxx_ws_string (pp, "__is_empty"); break; @@ -2411,7 +2407,7 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t) pp_cxx_left_paren (pp); pp->type_id (TRAIT_EXPR_TYPE1 (t)); - if (kind == CPTK_IS_BASE_OF || kind == CPTK_IS_CONVERTIBLE_TO) + if (kind == CPTK_IS_BASE_OF) { pp_cxx_separate_with (pp, ','); pp->type_id (TRAIT_EXPR_TYPE2 (t)); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 45631455fa1..63cc0d3dd71 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4134,7 +4134,6 @@ complain_flags (bool decltype_p) __is_abstract ( type-id ) __is_base_of ( type-id , type-id ) __is_class ( type-id ) - __is_convertible_to ( type-id , type-id ) __is_empty ( type-id ) __is_enum ( type-id ) __is_final ( type-id ) @@ -4483,7 +4482,6 @@ cp_parser_primary_expression (cp_parser *parser, case RID_IS_ABSTRACT: case RID_IS_BASE_OF: case RID_IS_CLASS: - case RID_IS_CONVERTIBLE_TO: case RID_IS_EMPTY: case RID_IS_ENUM: case RID_IS_FINAL: @@ -8665,7 +8663,6 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) cp_trait_kind kind; tree type1, type2 = NULL_TREE; bool binary = false; - cp_decl_specifier_seq decl_specs; switch (keyword) { @@ -8703,10 +8700,6 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) case RID_IS_CLASS: kind = CPTK_IS_CLASS; break; - case RID_IS_CONVERTIBLE_TO: - kind = CPTK_IS_CONVERTIBLE_TO; - binary = true; - break; case RID_IS_EMPTY: kind = CPTK_IS_EMPTY; break; @@ -8757,14 +8750,6 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) if (type1 == error_mark_node) return error_mark_node; - /* Build a trivial decl-specifier-seq. */ - clear_decl_specs (&decl_specs); - decl_specs.type = type1; - - /* Call grokdeclarator to figure out what type this is. */ - type1 = grokdeclarator (NULL, &decl_specs, TYPENAME, - /*initialized=*/0, /*attrlist=*/NULL); - if (binary) { cp_parser_require (parser, CPP_COMMA, RT_COMMA); @@ -8773,14 +8758,6 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword) if (type2 == error_mark_node) return error_mark_node; - - /* Build a trivial decl-specifier-seq. */ - clear_decl_specs (&decl_specs); - decl_specs.type = type2; - - /* Call grokdeclarator to figure out what type this is. */ - type2 = grokdeclarator (NULL, &decl_specs, TYPENAME, - /*initialized=*/0, /*attrlist=*/NULL); } cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index debd78562fb..3fbbb17dc3d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7355,10 +7355,6 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_CLASS: return (NON_UNION_CLASS_TYPE_P (type1)); - case CPTK_IS_CONVERTIBLE_TO: - /* TODO */ - return false; - case CPTK_IS_EMPTY: return (NON_UNION_CLASS_TYPE_P (type1) && CLASSTYPE_EMPTY_P (type1)); @@ -7413,36 +7409,8 @@ check_trait_type (tree type) tree finish_trait_expr (cp_trait_kind kind, tree type1, tree type2) { - gcc_assert (kind == CPTK_HAS_NOTHROW_ASSIGN - || kind == CPTK_HAS_NOTHROW_CONSTRUCTOR - || kind == CPTK_HAS_NOTHROW_COPY - || kind == CPTK_HAS_TRIVIAL_ASSIGN - || kind == CPTK_HAS_TRIVIAL_CONSTRUCTOR - || kind == CPTK_HAS_TRIVIAL_COPY - || kind == CPTK_HAS_TRIVIAL_DESTRUCTOR - || kind == CPTK_HAS_VIRTUAL_DESTRUCTOR - || kind == CPTK_IS_ABSTRACT - || kind == CPTK_IS_BASE_OF - || kind == CPTK_IS_CLASS - || kind == CPTK_IS_CONVERTIBLE_TO - || kind == CPTK_IS_EMPTY - || kind == CPTK_IS_ENUM - || kind == CPTK_IS_FINAL - || kind == CPTK_IS_LITERAL_TYPE - || kind == CPTK_IS_POD - || kind == CPTK_IS_POLYMORPHIC - || kind == CPTK_IS_STD_LAYOUT - || kind == CPTK_IS_TRIVIAL - || kind == CPTK_IS_UNION); - - if (kind == CPTK_IS_CONVERTIBLE_TO) - { - sorry ("__is_convertible_to"); - return error_mark_node; - } - if (type1 == error_mark_node - || ((kind == CPTK_IS_BASE_OF || kind == CPTK_IS_CONVERTIBLE_TO) + || ((kind == CPTK_IS_BASE_OF) && type2 == error_mark_node)) return error_mark_node; @@ -7491,7 +7459,6 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_UNION: break; - case CPTK_IS_CONVERTIBLE_TO: default: gcc_unreachable (); } diff --git a/gcc/testsuite/g++.dg/ext/is_class_error2.C b/gcc/testsuite/g++.dg/ext/is_class_error2.C index 8649dc4410f..b8c0385d3d8 100644 --- a/gcc/testsuite/g++.dg/ext/is_class_error2.C +++ b/gcc/testsuite/g++.dg/ext/is_class_error2.C @@ -13,7 +13,6 @@ template void foo() __is_abstract(int)(); // { dg-error "'__is_abstract\\(int\\)' cannot be used" } __is_base_of(int, float)(); // { dg-error "'__is_base_of\\(int, float\\)' cannot be used" } __is_class(int)(); // { dg-error "'__is_class\\(int\\)' cannot be used" } - __is_convertible_to(int, float)(); // { dg-message "unimplemented" } __is_empty(int)(); // { dg-error "'__is_empty\\(int\\)' cannot be used" } __is_enum(int)(); // { dg-error "'__is_enum\\(int\\)' cannot be used" } __is_pod(int)(); // { dg-error "'__is_pod\\(int\\)' cannot be used" }