Add eat_token() for more clarity in the preprocessor.
[cparser] / attribute.c
index 0882141..71f91d3 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)
@@ -231,7 +228,7 @@ static const char *get_argument_string(const attribute_argument_t *argument)
        expression_t *expression = argument->v.expression;
        if (expression->kind != EXPR_STRING_LITERAL)
                return NULL;
-       return expression->literal.value.begin;
+       return expression->string_literal.value.begin;
 }
 
 static void handle_attribute_visibility(const attribute_t *attribute,
@@ -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