aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-11-17 20:05:22 +0000
committerIain Sandoe <iain@sandoe.co.uk>2020-11-18 20:42:35 +0000
commit08028093211c1b57f33e5669f816157934ab23dd (patch)
tree3c640e6d313469f9d95d0a8d845fa5cd328d935f /gcc/cp/parser.c
parentf44e6091627372bd8fc4e72874a003643b021dca (diff)
downloadgcc-08028093211c1b57f33e5669f816157934ab23dd.zip
gcc-08028093211c1b57f33e5669f816157934ab23dd.tar.gz
gcc-08028093211c1b57f33e5669f816157934ab23dd.tar.bz2
Objective-C++ : Avoid ICE on invalid with empty attributes.
Empty prefix attributes like: __attribute__ (()) @interface MyClass @end cause an ICE at present, check for that case and skip them. gcc/cp/ChangeLog: * parser.c (cp_parser_objc_valid_prefix_attributes): Check for empty attributes.
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b7ef259..cf4e4aa 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -33992,8 +33992,8 @@ cp_parser_objc_valid_prefix_attributes (cp_parser* parser, tree *attrib)
{
cp_lexer_save_tokens (parser->lexer);
tree addon = cp_parser_attributes_opt (parser);
- gcc_checking_assert (addon);
- if (OBJC_IS_AT_KEYWORD (cp_lexer_peek_token (parser->lexer)->keyword))
+ if (addon
+ && OBJC_IS_AT_KEYWORD (cp_lexer_peek_token (parser->lexer)->keyword))
{
cp_lexer_commit_tokens (parser->lexer);
if (*attrib)