From f701d119a1bf48d31b234566a5e95aa18a134cfd Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 1 Nov 2008 17:11:17 +0000 Subject: [PATCH] partly fix local labels, %P already prints %P an at no need for additional ones in the messages [r23353] --- parser.c | 7 ++++--- parsetest/gnu99/local_label.c | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/parser.c b/parser.c index 435ca07..447b358 100644 --- a/parser.c +++ b/parser.c @@ -3016,7 +3016,7 @@ static compound_t *parse_compound_type_specifier(bool is_struct) compound = NULL; } else if (compound->complete && token.type == '{') { assert(symbol != NULL); - errorf(HERE, "multiple definitions of '%s %Y' (previous definition at %P)", + errorf(HERE, "multiple definitions of '%s %Y' (previous definition %P)", is_struct ? "struct" : "union", symbol, &compound->base.source_position); /* clear members in the hope to avoid further errors */ @@ -3146,7 +3146,7 @@ static type_t *parse_enum_specifier(void) if (token.type == '{') { if (entity->enume.complete) { - errorf(HERE, "multiple definitions of enum %Y (previous definition at %P)", + errorf(HERE, "multiple definitions of enum %Y (previous definition %P)", symbol, &entity->base.source_position); } if (symbol != NULL) { @@ -10137,11 +10137,12 @@ static statement_t *parse_local_label_declaration(void) symbol_t *symbol = token.v.symbol; entity_t *entity = get_entity(symbol, NAMESPACE_LOCAL_LABEL); if (entity != NULL) { - errorf(HERE, "multiple definitions of '__label__ %Y' (previous definition at %P)", + errorf(HERE, "multiple definitions of '__label__ %Y' (previous definition %P)", symbol, &entity->base.source_position); } else { entity = allocate_entity_zero(ENTITY_LOCAL_LABEL); + entity->base.parent_scope = scope; entity->base.namespc = NAMESPACE_LOCAL_LABEL; entity->base.source_position = token.source_position; entity->base.symbol = symbol; diff --git a/parsetest/gnu99/local_label.c b/parsetest/gnu99/local_label.c index d297634..345f2c5 100644 --- a/parsetest/gnu99/local_label.c +++ b/parsetest/gnu99/local_label.c @@ -10,11 +10,15 @@ label2: } if (a) { __label__ label; + if (a) { + __label__ label; + label: + ; + } if (b) goto label; b = 1; label: -label2: ++b; } return b; -- 2.20.1