[Bug c/85676] New: Obsolete function declarations should have warnings by default
david at westcontrol dot com
gcc-bugzilla@gcc.gnu.org
Mon May 7 11:09:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85676
Bug ID: 85676
Summary: Obsolete function declarations should have warnings by
default
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: david at westcontrol dot com
Target Milestone: ---
There are a number of features of C that are still legal code even in C11, but
have been obsolete for many generations of C because they are unnecessary and
have a high risk of errors. gcc has to be able to support old code, but it is
perfectly valid to give warnings on such old code.
A prime example is non-prototype function declarations, such as "void foo()".
This has been obsolete since C89, almost 30 years ago, yet if you have:
// a.c
void foo();
gcc -std=c11 -Wall -Wextra -pedantic -c a.c
it compiles without warning. You need "-Wstrict-prototypes" to get a warning.
Surely this warning ought to be part of -Wall, or enabled by default when a C11
or C99 standard is chosen?
The same applies to K&R style function definitions.
More information about the Gcc-bugs
mailing list