[PATCH/RFC] enable -Wstrict-prototypes (PR 82922)

Martin Sebor msebor@gmail.com
Thu Jan 11 18:52:00 GMT 2018


Declaring a function without a prototype has been deprecated
for nearly two decades (since C99) and may be removed from
the C language in C2X.  To prompt programs to transition to
the more modern and safer style, PR 82922 requests to enable
Wstrict-prototypes in -Wextra.

With the recent changes to add prototypes to a handful of
functions in Go and libgo, GCC bootstraps with the option
on x86_64 but there are a number of testsuite failures.
The attached patch either avoids or, in a small number of
instances, prunes out the warnings to let the tests pass
on x86_64.

It's possible that enabling the option could cause bootstrap
to break on other targets but since (if) only libraries are
compiled as C code anymore and not GCC back-end code, it seems
unlikely.  Handling such cases is also trivial, so unless I'm
missing something, enabling the option should be low risk for
GCC.

It seems more plausible that are tests for other targets that
would fail with the option, but if the the small number of
x86_64-specific tests in the patch is any indication (AFAICS
just 1) they could be dealt with as they are uncovered during
testing with only a minimum of disruption.

Assuming there is consensus to enable -Wstrict-prototypes, does
enabling the option and dealing with individual failures case-
by-case sound like a reasonable approach, or are are there
other/better ways to proceed without a lot of overhead that
I'm not thinking of?

I'm in the process of testing powerpc64le but I don't have
the ability or the cycles to do other targets.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-82922-testsuite.diff
Type: text/x-patch
Size: 22973 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180111/ffe31757/attachment.bin>


More information about the Gcc-patches mailing list