summaryrefslogtreecommitdiff
path: root/gcc/cp/cxx-pretty-print.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-05 19:30:39 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-05 19:30:39 +0000
commit121296eee0b21d064dffa3c77bcc96caf5571701 (patch)
treecdaa38c550b113c61c8a82ec24f6b0febfad9e1d /gcc/cp/cxx-pretty-print.c
parent896972cc51c03770b6445399a44f9549c1a6bdea (diff)
downloadgcc-121296eee0b21d064dffa3c77bcc96caf5571701.tar.gz
cp/
* cp-tree.h (SIZEOF_EXPR_TYPE_P): Define. * tree.c (cp_tree_equal): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. * mangle.c (write_expression): Likewise. * cxx-pretty-print.c (pp_cxx_unary_expression): Likewise. * error.c (dump_expr): Likewise. * parser.c (cp_parser_unary_expression): For sizeof call cxx_sizeof_or_alignof_{type,expr} just for diagnostics and return SIZEOF_EXPR with the operand. * pt.c (tsubst_copy, tsubst_copy_and_build): For SIZEOF_EXPR, call cxx_sizeof_or_alignof_{type,expr} for diagnostics, but return SIZEOF_EXPR with tsubsted operand. (value_dependent_expression_p): Handle SIZEOF_EXPR with SIZEOF_EXPR_TYPE_P. (instantiation_dependent_r): Likewise. * call.c (null_ptr_cst_p): Call maybe_constant_value for C++98. * semantics.c (finish_call_expr): Call sizeof_pointer_memaccess_warning if needed. (cxx_eval_constant_expression): Handle SIZEOF_EXPR. (potential_constant_expression_1): Remove early exit for C++98. Handle PROPERTY_REF. * decl.c (duplicate_decls): When redeclaring a builtin function, keep the merged decl builtin also if newdecl is a gnu_inline inline definition. (fold_sizeof_expr_r): New function. (compute_array_index_type): Fold SIZEOF_EXPRs in itype. * cp-gimplify.c (cp_genericize_r): Fold SIZEOF_EXPR. * typeck.c (cp_build_binary_op): For warn_for_sign_compare try harder using maybe_constant_value to get INTEGER_CSTs. * decl.c (stabilize_vla_size): Call pointer_set_destroy at the end. testsuite/ * g++.dg/torture/Wsizeof-pointer-memaccess1.C: New test. * g++.dg/torture/Wsizeof-pointer-memaccess2.C: New test. * g++.dg/warn/Wsign-compare-5.C: New test. * g++.dg/warn/Wsizeof-pointer-memaccess-1.C: New test. * g++.dg/warn/Wnull-conversion-1.C: For c++11 add dg-error. * g++.dg/ext/builtin30.C: New test. * g++.dg/ext/vla12.C: New test. * gcc.dg/builtins-85.c: New test. libstdc++-v3/ * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192141 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r--gcc/cp/cxx-pretty-print.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 03d9149f4cf..ce64a7b2377 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1,6 +1,6 @@
/* Implementation of subroutines for the GNU C++ pretty-printer.
Copyright (C) 2003, 2004, 2005, 2007, 2008,
- 2009, 2010, 2011 Free Software Foundation, Inc.
+ 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
@@ -798,7 +798,13 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
case ALIGNOF_EXPR:
pp_cxx_ws_string (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
pp_cxx_whitespace (pp);
- if (TYPE_P (TREE_OPERAND (t, 0)))
+ if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))
+ {
+ pp_cxx_left_paren (pp);
+ pp_cxx_type_id (pp, TREE_TYPE (TREE_OPERAND (t, 0)));
+ pp_cxx_right_paren (pp);
+ }
+ else if (TYPE_P (TREE_OPERAND (t, 0)))
{
pp_cxx_left_paren (pp);
pp_cxx_type_id (pp, TREE_OPERAND (t, 0));