Use %N to print entities.
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 15 May 2012 08:39:03 +0000 (10:39 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 15 May 2012 08:39:03 +0000 (10:39 +0200)
attribute.c

index 0882141..ce97cc6 100644 (file)
@@ -212,14 +212,11 @@ static void handle_attribute_aligned(const attribute_t *attribute,
                        entity->compound.alignment = alignment;
                }
                break;
-       default: {
-               source_position_t const *const pos  = &attribute->source_position;
-               char              const *const what = get_entity_kind_name(entity->kind);
-               symbol_t          const *const sym  = entity->base.symbol;
-               warningf(WARN_OTHER, pos, "alignment attribute specification on %s '%S' ignored", what, sym);
+
+       default:
+               warningf(WARN_OTHER, &attribute->source_position, "alignment attribute specification on '%N' ignored", entity);
                break;
        }
-       }
 }
 
 static const char *get_argument_string(const attribute_argument_t *argument)
@@ -265,14 +262,11 @@ static void handle_attribute_visibility(const attribute_t *attribute,
        case ENTITY_FUNCTION:
                entity->function.elf_visibility = visibility;
                break;
-       default: {
-               source_position_t const *const pos  = &attribute->source_position;
-               char              const *const what = get_entity_kind_name(entity->kind);
-               symbol_t          const *const sym  = entity->base.symbol;
-               warningf(WARN_OTHER, pos, "visibility attribute specification on %s '%S' ignored", what, sym);
+
+       default:
+               warningf(WARN_OTHER, &attribute->source_position, "visibility attribute specification on '%N' ignored", entity);
                break;
        }
-       }
 }
 
 static void warn_arguments(const attribute_t *attribute)
@@ -290,10 +284,7 @@ static void handle_attribute_packed_e(const attribute_t *attribute,
 {
 #if 0
        if (entity->kind != ENTITY_STRUCT) {
-               source_position_t const *const pos  = &attribute->source_position;
-               char              const *const what = get_entity_kind_name(entity->kind);
-               symbol_t          const *const sym  = entity->base.symbol;
-               warningf(WARN_OTHER, pos, "packed attribute on %s '%S' ignored", what, sym);
+               warningf(WARN_OTHER, &attribute->source_position, "packed attribute on '%N' ignored", entity);
                return;
        }
 #endif