- type_t *const orig_type = declaration->type;
- type_t *const type = skip_typeref(orig_type);
- if (is_type_function(type) &&
- type->function.unspecified_parameters &&
- warning.strict_prototypes &&
- previous_declaration == NULL) {
- warningf(&declaration->source_position,
- "function declaration '%#T' is not a prototype",
- orig_type, symbol);
- }
-
- if (warning.main && is_type_function(type) && is_sym_main(symbol)) {
- check_type_of_main(declaration, &type->function);
- }
-
- if (warning.nested_externs &&
- declaration->storage_class == STORAGE_CLASS_EXTERN &&
- scope != file_scope) {
- warningf(&declaration->source_position,
- "nested extern declaration of '%#T'", declaration->type, symbol);
- }
-
- assert(declaration != previous_declaration);
- if (previous_declaration != NULL &&
- previous_declaration->parent_scope == ¤t_function->scope &&
- scope->depth == previous_declaration->parent_scope->depth + 1) {
- errorf(&declaration->source_position,
- "declaration '%#T' redeclares the parameter '%#T' (declared %P)",
- orig_type, symbol, previous_declaration->type, symbol,
- &previous_declaration->source_position);
+ if (entity->kind == ENTITY_FUNCTION) {
+ type_t *const orig_type = entity->declaration.type;
+ type_t *const type = skip_typeref(orig_type);
+
+ assert(is_type_function(type));
+ if (type->function.unspecified_parameters &&
+ warning.strict_prototypes &&
+ previous_entity == NULL) {
+ warningf(pos, "function declaration '%#T' is not a prototype",
+ orig_type, symbol);
+ }
+
+ if (warning.main && current_scope == file_scope
+ && is_sym_main(symbol)) {
+ check_type_of_main(entity);
+ }
+ }
+
+ if (is_declaration(entity)) {
+ if (warning.nested_externs
+ && entity->declaration.storage_class == STORAGE_CLASS_EXTERN
+ && current_scope != file_scope) {
+ warningf(pos, "nested extern declaration of '%#T'",
+ entity->declaration.type, symbol);
+ }
+ }
+
+ if (previous_entity != NULL
+ && previous_entity->base.parent_scope == ¤t_function->parameters
+ && current_scope->depth == previous_entity->base.parent_scope->depth+1){
+
+ assert(previous_entity->kind == ENTITY_VARIABLE);
+ errorf(pos,
+ "declaration '%#T' redeclares the parameter '%#T' (declared %P)",
+ entity->declaration.type, symbol,
+ previous_entity->declaration.type, symbol,
+ &previous_entity->base.source_position);