aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cxx-pretty-print.c
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2006-11-21 20:23:03 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2006-11-21 20:23:03 +0000
commit55a3debe44095349b898ca6e297b0ecb9f9d16b6 (patch)
treeb93947409f894b645ef269b5199ac8efb6894453 /gcc/cp/cxx-pretty-print.c
parent218f00156cf583db14b1398ca52da12f59383fb3 (diff)
downloadgcc-55a3debe44095349b898ca6e297b0ecb9f9d16b6.zip
gcc-55a3debe44095349b898ca6e297b0ecb9f9d16b6.tar.gz
gcc-55a3debe44095349b898ca6e297b0ecb9f9d16b6.tar.bz2
cp-tree.def (STATIC_ASSERT): New.
2006-11-21 Douglas Gregor <doug.gregor@gmail.com> * cp-tree.def (STATIC_ASSERT): New. * cp-objcp-common.c (cp_tree_size): Handle STATIC_ASSERT. * error.c (dump_decl): Handle STATIC_ASSERT. * cp-tree.h (STATIC_ASSERT_CONDITION): New. (STATIC_ASSERT_MESSAGE): New. (STATIC_ASSERT_SOURCE_LOCATION): New. (struct tree_static_assert): New. (enum cp_tree_node_structure_enum): Add TS_CP_STATIC_ASSERT. (union lang_tree_node): Add static_assertion. (finish_static_assert): Declare. * cxx-pretty-print.c (pp_cxx_statement): Handle STATIC_ASSERT. (pp_cxx_declaration): Handle STATIC_ASSERT. * pt.c (instantiate_class_template): Handle STATIC_ASSERT members. (tsubst_expr): Handle STATIC_ASSERT statements. * semantics.c (finish_static_assert): New. * lex.c (D_CPP0X): New. (reswords): Add static_assert keyword. (init_reswords): If not flag_cpp0x, mask out C++0x keywords. * parser.c (cp_parser_block_declaration): Parse static assertions. (cp_parser_static_assert): New. (cp_parser_member_declaration): Parse static assertions. From-SVN: r119066
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r--gcc/cp/cxx-pretty-print.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 5ceca61..4f2bf86 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1711,6 +1711,10 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
pp_newline_and_indent (pp, -2);
break;
+ case STATIC_ASSERT:
+ pp_cxx_declaration (pp, t);
+ break;
+
default:
pp_c_statement (pp_c_base (pp), t);
break;
@@ -1906,11 +1910,21 @@ pp_cxx_explicit_instantiation (cxx_pretty_printer *pp, tree t)
asm-definition
namespace-alias-definition
using-declaration
- using-directive */
+ using-directive
+ static_assert-declaration */
void
pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
{
- if (!DECL_LANG_SPECIFIC (t))
+ if (TREE_CODE (t) == STATIC_ASSERT)
+ {
+ pp_cxx_identifier (pp, "static_assert");
+ pp_cxx_left_paren (pp);
+ pp_cxx_expression (pp, STATIC_ASSERT_CONDITION (t));
+ pp_cxx_separate_with (pp, ',');
+ pp_cxx_expression (pp, STATIC_ASSERT_MESSAGE (t));
+ pp_cxx_right_paren (pp);
+ }
+ else if (!DECL_LANG_SPECIFIC (t))
pp_cxx_simple_declaration (pp, t);
else if (DECL_USE_TEMPLATE (t))
switch (DECL_USE_TEMPLATE (t))