[PATCH] diagnose built-in declarations without prototype (PR 83656)
Joseph Myers
joseph@codesourcery.com
Fri Nov 2 22:52:00 GMT 2018
On Fri, 2 Nov 2018, Martin Sebor wrote:
> I have reworked the patch to resolve any lingering concerns about
> warnings in configure tests. The attached revision only warns
> with -Wextra and only for incompatible declarations of built-ins
> that take arguments. For void built-ins like abort() it only
> warns with -Wpedantic (this required adjustments to several
> tests that are being compiled with -pedantic-errors).
I don't think this use of -Wpedantic is appropriate. -Wpedantic is not a
catch-all for warnings we don't want to enable with some other option;
it's specifically for programs doing something that is disallowed by ISO C
(such warnings may or may not also be enabled by other relevant options).
Since this declaration is not disallowed by ISO C, -Wpedantic should not
result in a warning for it.
(I do consider declarations with () for built-in functions without
arguments to be more dubious than for user-defined functions without
arguments, simply because good practice would be to include the standard
header to get declarations of those functions, whereas for user-defined
functions the code might simply be using C++ style for declaring functions
without arguments.)
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list