This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] diagnose built-in declarations without prototype (PR 83656)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Nov 2018 22:52:34 +0000
- Subject: Re: [PATCH] diagnose built-in declarations without prototype (PR 83656)
- References: <393ca33b-647d-c180-311b-5e89c98ae34e@gmail.com> <f46744a6-4b3e-139c-976b-7b96c48239dd@redhat.com> <20180627152728.GB7166@tucnak> <95fd48a4-2323-8b05-8196-870e8d56c94a@redhat.com> <4cf3ad40-9df8-41df-37d1-cbc3a41adc80@gmail.com> <0bbabf25-e727-163f-623a-7cc194bc7829@redhat.com> <5c4a50fc-6415-ee93-7435-6dbd3de7d1a6@gmail.com> <83825920-1535-a02c-1256-86bace24bccf@redhat.com> <f388cc87-df8f-f1c5-efa0-628efaa2150c@gmail.com> <0c668da8-9b19-854d-1fc7-634d1c340c18@redhat.com> <e494035b-aa21-0bd3-6f38-796eef19c6dd@gmail.com>
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