const symbol_t *const symbol = declaration->symbol;
const namespace_t namespc = (namespace_t)declaration->namespc;
- assert(declaration->symbol != NULL);
+ assert(symbol != NULL);
declaration_t *previous_declaration = get_declaration(symbol, namespc);
type_t *const orig_type = declaration->type;
check_type_of_main(declaration, &type->function);
}
+ if (warning.nested_externs &&
+ declaration->storage_class == STORAGE_CLASS_EXTERN &&
+ scope != global_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 == scope) {
.missing_declarations = false,
.missing_prototypes = false,
.multichar = true,
+ .nested_externs = false,
.nonnull = true,
.redundant_decls = true,
.return_type = true,
OPT("missing-declarations", missing_declarations);
OPT("missing-prototypes", missing_prototypes);
OPT("multichar", multichar);
+ OPT("nested-externs", nested_externs);
OPT("nonnull", nonnull);
OPT("redundant-decls", redundant_decls);
OPT("return-type", return_type);
#endif
bool missing_prototypes:1; /**< Warn if a global function is defined without a previous prototype declaration */
bool multichar:1; /**< Warn if a multicharacter constant ('FOOF') is used. */
-#if 0 // TODO
bool nested_externs:1; /**< Warn if an 'extern' declaration is encountered within a function */
+#if 0 // TODO
bool packed:1; /**< Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure */
bool padded:1; /**< Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure */
bool parentheses:1; /**< Warn if parentheses are omitted in certain contexts (assignment where truth value is expected, if-else-braces) */