diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-09-30 08:23:37 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-09-30 08:23:37 +0000 |
commit | 49b91f055dbcf33c0230356a6ff41916c7cac917 (patch) | |
tree | febeddb29ba321d8891cab7a7b66a19df3e27ea9 /gcc/cp/parser.c | |
parent | 10ad386ac38c8c9de3e7eb4fcdfaf597c8e1d591 (diff) | |
download | gcc-49b91f055dbcf33c0230356a6ff41916c7cac917.zip gcc-49b91f055dbcf33c0230356a6ff41916c7cac917.tar.gz gcc-49b91f055dbcf33c0230356a6ff41916c7cac917.tar.bz2 |
In gcc/c-family/: 2010-09-30 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/c-family/:
2010-09-30 Nicola Pero <nicola.pero@meta-innovation.com>
* c-lex.c (c_lex_with_flags): Updated comments for CPP_AT_NAME
Objective-C/Objective-C++ keywords.
In gcc/cp/:
2010-09-30 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_lexer_get_preprocessor_token): Tidied up comments
and indentation when finding an Objective-C++ CPP_AT_NAME token.
In gcc/:
2010-09-30 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_lex_one_token): When finding a CPP_AT_NAME
Objective-C token, map RID_CLASS to RID_AT_CLASS and similar.
(c_parser_external_declaration): Use RID_AT_CLASS
instead of RID_CLASS.
(c_parser_objc_class_declaration): Same change.
(c_parser_objc_try_catch_statement): Use RID_AT_TRY instead of
RID_TRY and RID_AT_CATCH instead of RID_CATCH.
(c_parser_objc_class_instance_variables): Use RID_AT_PRIVATE
instead of RID_PRIVATE, RID_AT_PROTECTED instead of RID_PROTECTED
and RID_AT_PUBLIC instead of RID_PUBLIC.
(c_parser_statement_after_labels): Use RID_AT_TRY instead of
RID_TRY and RID_AT_CATCH instead of RID_CATCH.
From-SVN: r164744
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b622613..d9cc727 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -565,21 +565,28 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) token->keyword = RID_MAX; } } - /* Handle Objective-C++ keywords. */ else if (token->type == CPP_AT_NAME) { + /* This only happens in Objective-C++; it must be a keyword. */ token->type = CPP_KEYWORD; switch (C_RID_CODE (token->u.value)) { - /* Map 'class' to '@class', 'private' to '@private', etc. */ - case RID_CLASS: token->keyword = RID_AT_CLASS; break; - case RID_PRIVATE: token->keyword = RID_AT_PRIVATE; break; + /* Replace 'class' with '@class', 'private' with '@private', + etc. This prevents confusion with the C++ keyword + 'class', and makes the tokens consistent with other + Objective-C 'AT' keywords. For example '@class' is + reported as RID_AT_CLASS which is consistent with + '@synchronized', which is reported as + RID_AT_SYNCHRONIZED. + */ + case RID_CLASS: token->keyword = RID_AT_CLASS; break; + case RID_PRIVATE: token->keyword = RID_AT_PRIVATE; break; case RID_PROTECTED: token->keyword = RID_AT_PROTECTED; break; - case RID_PUBLIC: token->keyword = RID_AT_PUBLIC; break; - case RID_THROW: token->keyword = RID_AT_THROW; break; - case RID_TRY: token->keyword = RID_AT_TRY; break; - case RID_CATCH: token->keyword = RID_AT_CATCH; break; - default: token->keyword = C_RID_CODE (token->u.value); + case RID_PUBLIC: token->keyword = RID_AT_PUBLIC; break; + case RID_THROW: token->keyword = RID_AT_THROW; break; + case RID_TRY: token->keyword = RID_AT_TRY; break; + case RID_CATCH: token->keyword = RID_AT_CATCH; break; + default: token->keyword = C_RID_CODE (token->u.value); } } else if (token->type == CPP_PRAGMA) |