From: Christoph Mallon Date: Thu, 6 Mar 2008 15:36:27 +0000 (+0000) Subject: Generate an error when redeclaring enum entries. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=6b2c75a672eb5549fe870334966501668e888129;p=cparser Generate an error when redeclaring enum entries. [r18916] --- diff --git a/parser.c b/parser.c index 856c580..c7e1ae9 100644 --- a/parser.c +++ b/parser.c @@ -2823,8 +2823,13 @@ static declaration_t *internal_record_declaration( errorf(previous_declaration->source_position, "previous declaration of '%Y' was here", symbol); } else { - unsigned old_storage_class - = previous_declaration->storage_class; + unsigned old_storage_class = previous_declaration->storage_class; + if (old_storage_class == STORAGE_CLASS_ENUM_ENTRY) { + errorf(declaration->source_position, "redeclaration of enum entry '%Y'", symbol); + errorf(previous_declaration->source_position, "previous declaration of '%Y' was here", symbol); + return previous_declaration; + } + unsigned new_storage_class = declaration->storage_class; if(is_type_incomplete(prev_type)) {