From 55a3debe44095349b898ca6e297b0ecb9f9d16b6 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 21 Nov 2006 20:23:03 +0000 Subject: cp-tree.def (STATIC_ASSERT): New. 2006-11-21 Douglas Gregor * 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 --- gcc/cp/lex.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/cp/lex.c') diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index d14a1ba..27a17c3 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -176,6 +176,7 @@ struct resword #define D_EXT 0x01 /* GCC extension */ #define D_ASM 0x02 /* in C99, but has a switch to turn it off */ #define D_OBJC 0x04 /* Objective C++ only */ +#define D_CPP0X 0x08 /* C++0x only */ CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT); @@ -259,6 +260,7 @@ static const struct resword reswords[] = { "signed", RID_SIGNED, 0 }, { "sizeof", RID_SIZEOF, 0 }, { "static", RID_STATIC, 0 }, + { "static_assert", RID_STATIC_ASSERT, D_CPP0X }, { "static_cast", RID_STATCAST, 0 }, { "struct", RID_STRUCT, 0 }, { "switch", RID_SWITCH, 0 }, @@ -314,7 +316,8 @@ init_reswords (void) tree id; int mask = ((flag_no_asm ? D_ASM : 0) | D_OBJC - | (flag_no_gnu_keywords ? D_EXT : 0)); + | (flag_no_gnu_keywords ? D_EXT : 0) + | (flag_cpp0x ? 0 : D_CPP0X)); ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX); for (i = 0; i < ARRAY_SIZE (reswords); i++) -- cgit v1.1