old_storage_class = STORAGE_CLASS_EXTERN;
case STORAGE_CLASS_EXTERN:
- if (new_storage_class == STORAGE_CLASS_NONE && !is_function_definition) {
+ if (is_function_definition) {
+ if (warning.missing_prototypes &&
+ prev_type->function.unspecified_parameters) {
+ warningf(declaration->source_position, "no previous prototype for '%#T'", type, symbol);
+ }
+ } else if (new_storage_class == STORAGE_CLASS_NONE) {
new_storage_class = STORAGE_CLASS_EXTERN;
}
break;
if (old_storage_class == STORAGE_CLASS_EXTERN &&
new_storage_class == STORAGE_CLASS_EXTERN) {
- warn_redundant_declaration:
+warn_redundant_declaration:
if (warning.redundant_decls) {
warningf(declaration->source_position, "redundant declaration for '%Y'", symbol);
warningf(previous_declaration->source_position, "previous declaration of '%Y' was here", symbol);
return previous_declaration;
}
} else if (is_function_definition &&
- declaration->storage_class != STORAGE_CLASS_STATIC &&
- warning.missing_declarations) {
- warningf(declaration->source_position, "no previous declaration for '%#T'", type, symbol);
+ declaration->storage_class != STORAGE_CLASS_STATIC) {
+ if (warning.missing_prototypes) {
+ warningf(declaration->source_position, "no previous prototype for '%#T'", type, symbol);
+ } else if (warning.missing_declarations) {
+ warningf(declaration->source_position, "no previous declaration for '%#T'", type, symbol);
+ }
}
assert(declaration->parent_context == NULL);
OPT("implicit-function-declaration", implicit_function_declaration)
OPT("implicit-int", implicit_int)
OPT("missing-declarations", missing_declarations)
+ OPT("missing-prototypes", missing_prototypes)
OPT("redundant-decls", redundant_decls)
OPT("strict-prototypes", strict_prototypes)
#if 0
.implicit_function_declaration = true,
.implicit_int = true,
.missing_declarations = true,
+ .missing_prototypes = true,
.strict_prototypes = true,
.redundant_decls = true,
.unused_value = true
#if 0 // TODO
bool missing_format_attribute:1; /* If '-Wformat' is enabled, also warn about functions which might be candidates for 'format' attributes */
bool missing_noreturn:1; /* Warn about functions which might be candidates for attribute 'noreturn' */
+#endif
bool missing_prototypes:1; /* Warn if a global function is defined without a previous prototype declaration */
+#if 0 // TODO
bool multichar:1; /* Warn if a multicharacter constant ('FOOF') is used. */
bool nested_externs:1; /* Warn if an 'extern' declaration is encountered within a function */
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 */