[RFC] Enabling -Wstrict-prototypes by default in C

I’d like to reach some closure on this. As best I can tell, it sounds like the path forward is:

  • Add -Wdeprecated-non-prototype that is on-by-default and warns about functions without a prototype that change behavior in C2x. Add it to the -Wstrict-prototypes diagnostic group.
  • Change -Wstrict-prototypes to diagnose functions without a prototype that don’t change behavior in C2x, it remains off-by-default but is automatically enabled by -pedantic as it’s still warning the user about a deprecation.
  • Add -Wstrict-calls-without-prototype that is on-by-default and warns about any call to a function without a prototype but is passed args, group it under -Wdeprecated-non-prototype.
  • Optionally, when enabling the C2x behavior, add -fstrict-prototypes to use the C2x prototype rules in any C language mode

The resulting behavior would be:

// Off by default warnings, enabled by -pedantic
void other_func(); // expected-warning {{this function declaration without a prototype is deprecated in all versions of C}}
void other_func() {} // expected-warning {{this function declaration without a prototype is deprecated in all versions of C}}

void never_defined(); // expected-warning {{this function declaration without a prototype is deprecated in all versions of C}}

typedef void (*fp)(); // expected-warning {{this function declaration without a prototype is deprecated in all versions of C}}

void whatever(void) {
  extern void hoo_boy();  // expected-warning {{this function declaration without a prototype is deprecated in all versions of C}}
}

// On by default warnings
void func(); // expected-warning {{this function declaration without a prototype is deprecated in all versions of C and changes behavior in C2x}}
void func(a, b) int a, b; {} // expected-warning {{this function declaration without a prototype is deprecated in all versions of C and changes behavior in C2x}}

void another(); // No warning on by default for this

int main(void) {
  another(1, 2); // expected-warning {{calling function 'another' with arguments when the function has no prototype}}
}