mbox series

[v3,00/11] : More warnings as errors by default

Message ID cover.1700473918.git.fweimer@redhat.com
Headers show
Series : More warnings as errors by default | expand

Message

Florian Weimer Nov. 20, 2023, 9:55 a.m. UTC
This revision addresses Marek's comment about handing
-Wdeclaration-missing-parameter-type properly in conjunction with
-fpermissive.  A new test (permerror-fpermissive-nowarning.c)
demonstrates the expected behavior.  I added a test for -std=gnu89
-fno-permissive, too.

I'm including the precursor cleanup patches in this posting.  Hopefully
this will make the aarch64 tester happy.

Thanks,
Florian

Florian Weimer (11):
  aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder
  aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c
  gm2: Add missing declaration of m2pim_M2RTS_Terminate to test
  Add tests for validating future C permerrors
  c: Turn int-conversion warnings into permerrors
  c: Turn -Wimplicit-function-declaration into a permerror
  c: Turn -Wimplicit-int into a permerror
  c: Do not ignore some forms of -Wimplicit-int in system headers
  c: Turn -Wreturn-mismatch into a permerror
  c: Turn -Wincompatible-pointer-types into a permerror
  c: Add new -Wdeclaration-missing-parameter-type permerror

 gcc/c-family/c.opt                            |   4 +
 gcc/c/c-decl.cc                               |  71 +++----
 gcc/c/c-typeck.cc                             | 164 ++++++++-------
 gcc/doc/invoke.texi                           |  50 ++++-
 gcc/testsuite/c-c++-common/pr77624-1.c        |   4 +-
 .../c-c++-common/spellcheck-reserved.c        |   4 +-
 gcc/testsuite/gcc.dg/20030906-1.c             |   2 +-
 gcc/testsuite/gcc.dg/20030906-1a.c            |  21 ++
 gcc/testsuite/gcc.dg/20030906-2.c             |   2 +-
 gcc/testsuite/gcc.dg/20030906-2a.c            |  21 ++
 .../Wimplicit-function-declaration-c99-2.c    |   7 +
 .../Wimplicit-function-declaration-c99.c      |   2 +-
 gcc/testsuite/gcc.dg/Wimplicit-int-1.c        |   2 +-
 gcc/testsuite/gcc.dg/Wimplicit-int-1a.c       |  11 ++
 gcc/testsuite/gcc.dg/Wimplicit-int-4.c        |   2 +-
 gcc/testsuite/gcc.dg/Wimplicit-int-4a.c       |  11 ++
 .../gcc.dg/Wincompatible-pointer-types-2.c    |   2 +-
 .../gcc.dg/Wincompatible-pointer-types-5.c    |  10 +
 gcc/testsuite/gcc.dg/Wint-conversion-2.c      |   2 +-
 gcc/testsuite/gcc.dg/Wint-conversion-3.c      |   2 +-
 gcc/testsuite/gcc.dg/Wint-conversion-4.c      |  14 ++
 gcc/testsuite/gcc.dg/Wreturn-mismatch-1.c     |   2 +-
 gcc/testsuite/gcc.dg/Wreturn-mismatch-1a.c    |  40 ++++
 gcc/testsuite/gcc.dg/Wreturn-mismatch-2.c     |   2 +-
 gcc/testsuite/gcc.dg/Wreturn-mismatch-2a.c    |  41 ++++
 gcc/testsuite/gcc.dg/anon-struct-11.c         |   5 +-
 gcc/testsuite/gcc.dg/anon-struct-11a.c        | 111 +++++++++++
 gcc/testsuite/gcc.dg/anon-struct-13.c         |   2 +-
 gcc/testsuite/gcc.dg/anon-struct-13a.c        |  76 +++++++
 gcc/testsuite/gcc.dg/assign-warn-1.c          |   2 +-
 gcc/testsuite/gcc.dg/assign-warn-4.c          |  21 ++
 .../gcc.dg/builtin-arith-overflow-4.c         |   2 +-
 .../gcc.dg/builtin-arith-overflow-4a.c        |  43 ++++
 gcc/testsuite/gcc.dg/c23-qual-4.c             |   6 +-
 gcc/testsuite/gcc.dg/dfp/composite-type-2.c   |  58 ++++++
 gcc/testsuite/gcc.dg/dfp/composite-type.c     |   2 +-
 gcc/testsuite/gcc.dg/diag-aka-1.c             |   2 +-
 gcc/testsuite/gcc.dg/diag-aka-1a.c            |  29 +++
 .../gcc.dg/diagnostic-range-bad-return-2.c    |  52 +++++
 .../gcc.dg/diagnostic-range-bad-return.c      |   2 +-
 gcc/testsuite/gcc.dg/diagnostic-types-1.c     |   2 +-
 gcc/testsuite/gcc.dg/diagnostic-types-2.c     |  24 +++
 gcc/testsuite/gcc.dg/enum-compat-1.c          |   2 +-
 gcc/testsuite/gcc.dg/enum-compat-2.c          |  32 +++
 gcc/testsuite/gcc.dg/func-ptr-conv-1.c        |   2 +-
 gcc/testsuite/gcc.dg/func-ptr-conv-2.c        |  56 ++++++
 gcc/testsuite/gcc.dg/gnu23-attr-syntax-2.c    |   2 +-
 gcc/testsuite/gcc.dg/gnu23-attr-syntax-3.c    |  17 ++
 gcc/testsuite/gcc.dg/gomp/pr35738-2.c         |  18 ++
 gcc/testsuite/gcc.dg/gomp/pr35738.c           |   2 +-
 gcc/testsuite/gcc.dg/init-bad-7.c             |   2 +-
 gcc/testsuite/gcc.dg/init-bad-7a.c            |  12 ++
 gcc/testsuite/gcc.dg/init-excess-3.c          |   4 +-
 gcc/testsuite/gcc.dg/missing-header-fixit-1.c |   2 +-
 .../gcc.dg/missing-header-fixit-1a.c          |  37 ++++
 gcc/testsuite/gcc.dg/missing-header-fixit-2.c |   2 +-
 .../gcc.dg/missing-header-fixit-2a.c          |  31 +++
 gcc/testsuite/gcc.dg/missing-header-fixit-4.c |   2 +-
 .../gcc.dg/missing-header-fixit-4a.c          |  27 +++
 gcc/testsuite/gcc.dg/missing-header-fixit-5.c |   2 +-
 .../gcc.dg/missing-header-fixit-5a.c          |  42 ++++
 .../gcc.dg/noncompile/incomplete-3.c          |   2 +-
 gcc/testsuite/gcc.dg/noncompile/pr79758-2.c   |   6 +
 gcc/testsuite/gcc.dg/noncompile/pr79758.c     |   1 +
 gcc/testsuite/gcc.dg/overflow-warn-1.c        |   4 +-
 gcc/testsuite/gcc.dg/overflow-warn-3.c        |   4 +-
 gcc/testsuite/gcc.dg/param-type-mismatch-2.c  | 187 ++++++++++++++++++
 gcc/testsuite/gcc.dg/param-type-mismatch.c    |   2 +-
 gcc/testsuite/gcc.dg/permerror-default.c      |  85 ++++++++
 .../gcc.dg/permerror-fpermissive-nowarning.c  |   6 +
 gcc/testsuite/gcc.dg/permerror-fpermissive.c  |  85 ++++++++
 .../gcc.dg/permerror-gnu89-nopermissive.c     |  85 ++++++++
 .../gcc.dg/permerror-gnu89-pedantic.c         |  85 ++++++++
 gcc/testsuite/gcc.dg/permerror-gnu89.c        |  85 ++++++++
 gcc/testsuite/gcc.dg/permerror-noerror.c      |  85 ++++++++
 gcc/testsuite/gcc.dg/permerror-nowarning.c    |   5 +
 gcc/testsuite/gcc.dg/permerror-pedantic.c     |  85 ++++++++
 gcc/testsuite/gcc.dg/permerror-system.c       |  45 +++++
 gcc/testsuite/gcc.dg/pointer-array-atomic-2.c |  60 ++++++
 gcc/testsuite/gcc.dg/pointer-array-atomic.c   |   2 +-
 gcc/testsuite/gcc.dg/pointer-array-quals-1.c  |   6 +-
 gcc/testsuite/gcc.dg/pr105635-2.c             |  11 ++
 gcc/testsuite/gcc.dg/pr105635.c               |   2 +-
 gcc/testsuite/gcc.dg/pr23075-2.c              |  14 ++
 gcc/testsuite/gcc.dg/pr23075.c                |   2 +-
 gcc/testsuite/gcc.dg/pr29521-a.c              |  15 ++
 gcc/testsuite/gcc.dg/pr29521.c                |   2 +-
 gcc/testsuite/gcc.dg/pr61162-2.c              |   2 +-
 gcc/testsuite/gcc.dg/pr61162-3.c              |  13 ++
 gcc/testsuite/gcc.dg/pr61852.c                |   4 +-
 gcc/testsuite/gcc.dg/pr67730-a.c              |  11 ++
 gcc/testsuite/gcc.dg/pr67730.c                |   2 +-
 gcc/testsuite/gcc.dg/spec-barrier-3.c         |   2 +-
 gcc/testsuite/gcc.dg/spec-barrier-3a.c        |  13 ++
 .../gcc.dg/spellcheck-identifiers-1a.c        | 136 +++++++++++++
 .../gcc.dg/spellcheck-identifiers-2.c         |   2 +-
 .../gcc.dg/spellcheck-identifiers-2a.c        |  33 ++++
 .../gcc.dg/spellcheck-identifiers-3.c         |   2 +-
 .../gcc.dg/spellcheck-identifiers-3a.c        |  45 +++++
 .../gcc.dg/spellcheck-identifiers-4.c         |   2 +-
 .../gcc.dg/spellcheck-identifiers-4a.c        |  10 +
 gcc/testsuite/gcc.dg/spellcheck-identifiers.c |   2 +-
 gcc/testsuite/gcc.dg/transparent-union-1.c    |   2 +-
 gcc/testsuite/gcc.dg/transparent-union-1a.c   |  85 ++++++++
 .../gcc.target/aarch64/aapcs64/ice_1.c        |   2 +-
 .../gcc.target/aarch64/acle/memtag_2.c        |   4 +-
 .../gcc.target/aarch64/acle/memtag_2a.c       |  71 +++++++
 .../sve/acle/general-c/ld1sh_gather_1.c       |   2 +-
 .../aarch64/sve/acle/general-c/load_2.c       |   4 +-
 .../aarch64/sve/acle/general-c/load_3.c       |   2 +-
 .../acle/general-c/load_ext_gather_index_1.c  |   2 +-
 .../load_ext_gather_index_restricted_1.c      |   2 +-
 .../acle/general-c/load_ext_gather_offset_1.c |   4 +-
 .../acle/general-c/load_ext_gather_offset_2.c |   4 +-
 .../acle/general-c/load_ext_gather_offset_3.c |   4 +-
 .../acle/general-c/load_ext_gather_offset_4.c |   4 +-
 .../acle/general-c/load_ext_gather_offset_5.c |   4 +-
 .../load_ext_gather_offset_restricted_1.c     |   4 +-
 .../load_ext_gather_offset_restricted_2.c     |   4 +-
 .../load_ext_gather_offset_restricted_3.c     |   4 +-
 .../load_ext_gather_offset_restricted_4.c     |   4 +-
 .../aarch64/sve/acle/general-c/sizeless-1.c   |   8 +-
 .../aarch64/sve/acle/general-c/sizeless-2.c   |   8 +-
 .../aarch64/sve/acle/general-c/store_1.c      |   8 +-
 .../aarch64/sve/acle/general-c/store_2.c      |  10 +-
 .../acle/general-c/store_scatter_index_1.c    |   8 +-
 .../store_scatter_index_restricted_1.c        |   8 +-
 .../acle/general-c/store_scatter_offset_2.c   |   8 +-
 .../store_scatter_offset_restricted_1.c       |   8 +-
 .../aarch64/sve/acle/general/attributes_7.c   |  28 +--
 .../i386/sse2-bfloat16-scalar-typecheck.c     |   4 +-
 .../i386/vect-bfloat16-typecheck_1.c          |   4 +-
 .../i386/vect-bfloat16-typecheck_2.c          |   4 +-
 .../gcc.target/powerpc/conditional-return.c   |   2 +-
 .../gm2/link/externalscaffold/pass/scaffold.c |   1 +
 libgcc/config/aarch64/linux-unwind.h          |   5 +-
 136 files changed, 2543 insertions(+), 259 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/20030906-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/20030906-2a.c
 create mode 100644 gcc/testsuite/gcc.dg/Wimplicit-function-declaration-c99-2.c
 create mode 100644 gcc/testsuite/gcc.dg/Wimplicit-int-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/Wimplicit-int-4a.c
 create mode 100644 gcc/testsuite/gcc.dg/Wincompatible-pointer-types-5.c
 create mode 100644 gcc/testsuite/gcc.dg/Wint-conversion-4.c
 create mode 100644 gcc/testsuite/gcc.dg/Wreturn-mismatch-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/Wreturn-mismatch-2a.c
 create mode 100644 gcc/testsuite/gcc.dg/anon-struct-11a.c
 create mode 100644 gcc/testsuite/gcc.dg/anon-struct-13a.c
 create mode 100644 gcc/testsuite/gcc.dg/assign-warn-4.c
 create mode 100644 gcc/testsuite/gcc.dg/builtin-arith-overflow-4a.c
 create mode 100644 gcc/testsuite/gcc.dg/dfp/composite-type-2.c
 create mode 100644 gcc/testsuite/gcc.dg/diag-aka-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/diagnostic-range-bad-return-2.c
 create mode 100644 gcc/testsuite/gcc.dg/diagnostic-types-2.c
 create mode 100644 gcc/testsuite/gcc.dg/enum-compat-2.c
 create mode 100644 gcc/testsuite/gcc.dg/func-ptr-conv-2.c
 create mode 100644 gcc/testsuite/gcc.dg/gnu23-attr-syntax-3.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/pr35738-2.c
 create mode 100644 gcc/testsuite/gcc.dg/init-bad-7a.c
 create mode 100644 gcc/testsuite/gcc.dg/missing-header-fixit-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/missing-header-fixit-2a.c
 create mode 100644 gcc/testsuite/gcc.dg/missing-header-fixit-4a.c
 create mode 100644 gcc/testsuite/gcc.dg/missing-header-fixit-5a.c
 create mode 100644 gcc/testsuite/gcc.dg/noncompile/pr79758-2.c
 create mode 100644 gcc/testsuite/gcc.dg/param-type-mismatch-2.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-default.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-fpermissive-nowarning.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-fpermissive.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-gnu89-nopermissive.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-gnu89.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-noerror.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-nowarning.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-pedantic.c
 create mode 100644 gcc/testsuite/gcc.dg/permerror-system.c
 create mode 100644 gcc/testsuite/gcc.dg/pointer-array-atomic-2.c
 create mode 100644 gcc/testsuite/gcc.dg/pr105635-2.c
 create mode 100644 gcc/testsuite/gcc.dg/pr23075-2.c
 create mode 100644 gcc/testsuite/gcc.dg/pr29521-a.c
 create mode 100644 gcc/testsuite/gcc.dg/pr61162-3.c
 create mode 100644 gcc/testsuite/gcc.dg/pr67730-a.c
 create mode 100644 gcc/testsuite/gcc.dg/spec-barrier-3a.c
 create mode 100644 gcc/testsuite/gcc.dg/spellcheck-identifiers-1a.c
 create mode 100644 gcc/testsuite/gcc.dg/spellcheck-identifiers-2a.c
 create mode 100644 gcc/testsuite/gcc.dg/spellcheck-identifiers-3a.c
 create mode 100644 gcc/testsuite/gcc.dg/spellcheck-identifiers-4a.c
 create mode 100644 gcc/testsuite/gcc.dg/transparent-union-1a.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/memtag_2a.c


base-commit: 9419b408823d32e4b018699623c72cf85b1c1fdf

Comments

Jeff Law Nov. 23, 2023, 12:54 a.m. UTC | #1
On 11/20/23 02:55, Florian Weimer wrote:
> This revision addresses Marek's comment about handing
> -Wdeclaration-missing-parameter-type properly in conjunction with
> -fpermissive.  A new test (permerror-fpermissive-nowarning.c)
> demonstrates the expected behavior.  I added a test for -std=gnu89
> -fno-permissive, too.
> 
> I'm including the precursor cleanup patches in this posting.  Hopefully
> this will make the aarch64 tester happy.
> 
> Thanks,
> Florian
> 
> Florian Weimer (11):
>    aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder
>    aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c
>    gm2: Add missing declaration of m2pim_M2RTS_Terminate to test
>    Add tests for validating future C permerrors
>    c: Turn int-conversion warnings into permerrors
>    c: Turn -Wimplicit-function-declaration into a permerror
>    c: Turn -Wimplicit-int into a permerror
>    c: Do not ignore some forms of -Wimplicit-int in system headers
>    c: Turn -Wreturn-mismatch into a permerror
>    c: Turn -Wincompatible-pointer-types into a permerror
>    c: Add new -Wdeclaration-missing-parameter-type permerror
The series is fine by me.  But give Marek additional time to chime in, 
particularly given the holidays this week in the US.  Say through this 
time next week?

jeff
Florian Weimer Nov. 23, 2023, 1:04 a.m. UTC | #2
* Jeff Law:

> On 11/20/23 02:55, Florian Weimer wrote:
>> This revision addresses Marek's comment about handing
>> -Wdeclaration-missing-parameter-type properly in conjunction with
>> -fpermissive.  A new test (permerror-fpermissive-nowarning.c)
>> demonstrates the expected behavior.  I added a test for -std=gnu89
>> -fno-permissive, too.
>> I'm including the precursor cleanup patches in this posting.
>> Hopefully
>> this will make the aarch64 tester happy.
>> Thanks,
>> Florian
>> Florian Weimer (11):
>>    aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder
>>    aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c
>>    gm2: Add missing declaration of m2pim_M2RTS_Terminate to test
>>    Add tests for validating future C permerrors
>>    c: Turn int-conversion warnings into permerrors
>>    c: Turn -Wimplicit-function-declaration into a permerror
>>    c: Turn -Wimplicit-int into a permerror
>>    c: Do not ignore some forms of -Wimplicit-int in system headers
>>    c: Turn -Wreturn-mismatch into a permerror
>>    c: Turn -Wincompatible-pointer-types into a permerror
>>    c: Add new -Wdeclaration-missing-parameter-type permerror

> The series is fine by me.

Thanks.

> But give Marek additional time to chime in, particularly given the
> holidays this week in the US.  Say through this time next week?

Yes, Marek and I spoke about it today.  I'll wait a bit longer for
feedback.

I'm also gathering some numbers regarding autoconf impact and potential
silent miscompilation.

Thanks,
Florian
Sam James Nov. 27, 2023, 8:23 p.m. UTC | #3
Florian Weimer <fweimer@redhat.com> writes:

> * Jeff Law:
>
>> On 11/20/23 02:55, Florian Weimer wrote:
>>> This revision addresses Marek's comment about handing
>>> -Wdeclaration-missing-parameter-type properly in conjunction with
>>> -fpermissive.  A new test (permerror-fpermissive-nowarning.c)
>>> demonstrates the expected behavior.  I added a test for -std=gnu89
>>> -fno-permissive, too.
>>> I'm including the precursor cleanup patches in this posting.
>>> Hopefully
>>> this will make the aarch64 tester happy.
>>> Thanks,
>>> Florian
>>> Florian Weimer (11):
>>>    aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder
>>>    aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c
>>>    gm2: Add missing declaration of m2pim_M2RTS_Terminate to test
>>>    Add tests for validating future C permerrors
>>>    c: Turn int-conversion warnings into permerrors
>>>    c: Turn -Wimplicit-function-declaration into a permerror
>>>    c: Turn -Wimplicit-int into a permerror
>>>    c: Do not ignore some forms of -Wimplicit-int in system headers
>>>    c: Turn -Wreturn-mismatch into a permerror
>>>    c: Turn -Wincompatible-pointer-types into a permerror
>>>    c: Add new -Wdeclaration-missing-parameter-type permerror
>
>> The series is fine by me.
>
> Thanks.
>
>> But give Marek additional time to chime in, particularly given the
>> holidays this week in the US.  Say through this time next week?
>
> [...]
>
> I'm also gathering some numbers regarding autoconf impact and potential
> silent miscompilation.

I'd actually forgot about another element here: FreeBSD 14 which was
just released now ships with Clang 16 so we seem to be getting some
activity from them which is a help.

I've resumed our testing for configure diffs and am going to
focus on that for now. It's just laborious because of how many errors
are actually fine.
Florian Weimer Nov. 30, 2023, 9:35 p.m. UTC | #4
* Sam James:

>>> But give Marek additional time to chime in, particularly given the
>>> holidays this week in the US.  Say through this time next week?
>>
>> [...]
>>
>> I'm also gathering some numbers regarding autoconf impact and potential
>> silent miscompilation.
>
> I'd actually forgot about another element here: FreeBSD 14 which was
> just released now ships with Clang 16 so we seem to be getting some
> activity from them which is a help.
>
> I've resumed our testing for configure diffs and am going to
> focus on that for now. It's just laborious because of how many errors
> are actually fine.

Marek has kindly posted his reviews, and I'm incorporating his
suggestions.

Meanwhile, I've posted some numbers to the gcc list:

  Update on GCC 14 C type safety changes/warnings as errors
  <https://inbox.sourceware.org/gcc/87ttp3tek1.fsf@oldenburg.str.redhat.com/>

Thanks,
Florian