diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-18 14:35:42 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-18 14:35:42 +0000 |
commit | 94c6406ea70f16affd7669b43dda85d89ff38baa (patch) | |
tree | 5be54ba711fa5c187ecc10d930f60b988e4e7f1c /gcc/cp/cxx-pretty-print.c | |
parent | e777906b6bdfc147361a00f7aaee5334ff601210 (diff) | |
download | gcc-94c6406ea70f16affd7669b43dda85d89ff38baa.tar.gz |
/cp
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33464
* cxx-pretty-print.c (pp_cxx_trait_expression): Add.
(pp_cxx_primary_expression): Use it.
* cxx-pretty-print.h (pp_cxx_trait_expression): Declare.
* error.c (dump_expr): Use it.
/testsuite
2007-09-18 Paolo Carlini <pcarlini@suse.de>
PR c++/33464
* g++.dg/ext/is_class_error.C: Rename to is_class_error1.C.
* g++.dg/ext/is_class_error2.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 99 |
1 files changed, 98 insertions, 1 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 4bdd19d57e6..156f579b6b5 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -348,7 +348,26 @@ pp_cxx_id_expression (cxx_pretty_printer *pp, tree t) :: operator-function-id :: qualifier-id ( expression ) - id-expression */ + id-expression + + GNU Extensions: + __has_nothrow_assign ( type-id ) + __has_nothrow_constructor ( type-id ) + __has_nothrow_copy ( type-id ) + __has_trivial_assign ( type-id ) + __has_trivial_constructor ( type-id ) + __has_trivial_copy ( type-id ) + __has_trivial_destructor ( type-id ) + __has_virtual_destructor ( type-id ) + __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_pod ( type-id ) + __is_polymorphic ( type-id ) + __is_union ( type-id ) */ static void pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) @@ -387,6 +406,10 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) pp_cxx_right_paren (pp); break; + case TRAIT_EXPR: + pp_cxx_trait_expression (pp, t); + break; + default: pp_c_primary_expression (pp_c_base (pp), t); break; @@ -2123,6 +2146,80 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t) } } +void +pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t) +{ + cp_trait_kind kind = TRAIT_EXPR_KIND (t); + + switch (kind) + { + case CPTK_HAS_NOTHROW_ASSIGN: + pp_cxx_identifier (pp, "__has_nothrow_assign"); + break; + case CPTK_HAS_TRIVIAL_ASSIGN: + pp_cxx_identifier (pp, "__has_trivial_assign"); + break; + case CPTK_HAS_NOTHROW_CONSTRUCTOR: + pp_cxx_identifier (pp, "__has_nothrow_constructor"); + break; + case CPTK_HAS_TRIVIAL_CONSTRUCTOR: + pp_cxx_identifier (pp, "__has_trivial_constructor"); + break; + case CPTK_HAS_NOTHROW_COPY: + pp_cxx_identifier (pp, "__has_nothrow_copy"); + break; + case CPTK_HAS_TRIVIAL_COPY: + pp_cxx_identifier (pp, "__has_trivial_copy"); + break; + case CPTK_HAS_TRIVIAL_DESTRUCTOR: + pp_cxx_identifier (pp, "__has_trivial_destructor"); + break; + case CPTK_HAS_VIRTUAL_DESTRUCTOR: + pp_cxx_identifier (pp, "__has_virtual_destructor"); + break; + case CPTK_IS_ABSTRACT: + pp_cxx_identifier (pp, "__is_abstract"); + break; + case CPTK_IS_BASE_OF: + pp_cxx_identifier (pp, "__is_base_of"); + break; + case CPTK_IS_CLASS: + pp_cxx_identifier (pp, "__is_class"); + break; + case CPTK_IS_CONVERTIBLE_TO: + pp_cxx_identifier (pp, "__is_convertible_to"); + break; + case CPTK_IS_EMPTY: + pp_cxx_identifier (pp, "__is_empty"); + break; + case CPTK_IS_ENUM: + pp_cxx_identifier (pp, "__is_enum"); + break; + case CPTK_IS_POD: + pp_cxx_identifier (pp, "__is_pod"); + break; + case CPTK_IS_POLYMORPHIC: + pp_cxx_identifier (pp, "__is_polymorphic"); + break; + case CPTK_IS_UNION: + pp_cxx_identifier (pp, "__is_union"); + break; + + default: + gcc_unreachable (); + } + + pp_cxx_left_paren (pp); + pp_cxx_type_id (pp, TRAIT_EXPR_TYPE1 (t)); + + if (kind == CPTK_IS_BASE_OF || kind == CPTK_IS_CONVERTIBLE_TO) + { + pp_cxx_separate_with (pp, ','); + pp_cxx_type_id (pp, TRAIT_EXPR_TYPE2 (t)); + } + + pp_cxx_right_paren (pp); +} typedef c_pretty_print_fn pp_fun; |