From: Florian Weimer <fweimer@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 0/6] Turn some C warnings into errors by default
Date: Mon, 13 Nov 2023 14:09:42 +0100 [thread overview]
Message-ID: <cover.1699879818.git.fweimer@redhat.com> (raw)
This patch series converts the following warnings into errors by
default:
-Wint-conversion
-Wimplicit-function-declaration
-Wimplicit-int
-Wreturn-mismatch
-Wincompatible-pointer-types
As explained in the first commit, I decided not to use permerror_opt
because it does not exhibit the existing behavior for -pedantic-errors.
The impact on existing sources of the last commit is not really known to
me at this point. I plan to start a Fedora build later this week with
an instrumented compiler, to see how much of a compatible impact it will
be. The first conversion pass through Fedora only covered
-Wimplicit-function-declaration, -Wimplicit-int. I started looking at
-Wint-conversion, and it did not seem to be too bad, so I think
including it should be fine. I'm more worried about
-Wincompatible-pointer-types.
I have not yet added a new overview test for -fpermissive. Such a test
should trigger all the dozen or so places where I introduced
pedpermerror, and see what happens under multiple dialects, each with
-fpermissive and without, and maybe also with and withoyt for
-pedantic-errors in -std=gnu89 and default modes. I plan to do this
once I get some initial feedback on the direction of these series
because this test would likely be obsolete fairly quickly if changes to
the diagnostics are required. I did copy some existing tests to test
both the error and warning (-fpermissive) diagnostics, and adjusted
others to expect errors, so there is already quite a bit coverage
without that overview test.
Right now, this series breaks the build on aarch64-linux-gnu due to an
incompatible pointer assignment in libgcc:
[PATCH] aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder
<https://inbox.sourceware.org/gcc-patches/874jht5tsq.fsf@oldenburg.str.redhat.com/>
Other targets had the same issue previously, but I've already fixed most
of them (I hope). There could of course be similar issues lurking in
target-specific code, or even in system headers.
With the recent testsuite fixes, the testsuite should be fairly clean
despite these changes. I verified that on i686-linux-gnu,
powerpc64-linux-gnu, and x86_64-linux-gnu. There is one
aarch64-linux-gnu testsuite change I'd like the AArch64 maintainers to
review:
[PATCH] aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c
<https://inbox.sourceware.org/gcc-patches/87r0kx6eez.fsf@oldenburg.str.redhat.com/>
Recently, I also found a problem in the gm2 testsuite:
[PATCH] gm2: Add missing declaration of m2pim_M2RTS_Terminate to test
<https://inbox.sourceware.org/gcc-patches/874jhp3nwf.fsf@oldenburg.str.redhat.com/>
Thanks,
Florian
Florian Weimer (6):
c-family: Introduce pedpermerror
c: Turn int-conversion warnings into permerrors
c: Turn -Wimplicit-function-declaration into a pedpermerror
c: Turn -Wimplicit-int into a pedpermerror
c: Turn -Wreturn-mismatch into a pedpermerror
c: Turn -Wincompatible-pointer-types into a pedpermerror
gcc/c-family/c-common.h | 4 +
gcc/c-family/c-warn.cc | 34 ++++
gcc/c/c-decl.cc | 40 ++--
gcc/c/c-typeck.cc | 164 +++++++++------
gcc/diagnostic-core.h | 3 +
gcc/diagnostic.cc | 7 +
gcc/doc/invoke.texi | 33 +++-
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-4.c | 2 +-
.../gcc.dg/Wincompatible-pointer-types-5.c | 10 +
.../gcc.dg/Wincompatible-pointer-types-6.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/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/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 +-
128 files changed, 1920 insertions(+), 231 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/Wincompatible-pointer-types-6.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/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: b51bfee1beed03872ea0289cb47dd2336d9f528c
prerequisite-patch-id: f46d6a56470ab459865ba2e45372d60e131b9ee2
prerequisite-patch-id: 7e0b407ec2bbd5e3b9c7ed1342b08d3677a65283
prerequisite-patch-id: 02e95117add6ada9d5cdb489399fb2e562db76e2
--
2.41.0
next reply other threads:[~2023-11-13 13:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 13:09 Florian Weimer [this message]
2023-11-13 13:09 ` [PATCH 1/6] c-family: Introduce pedpermerror Florian Weimer
2023-11-13 19:22 ` Jeff Law
2023-11-14 7:39 ` Florian Weimer
2023-11-13 13:10 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors Florian Weimer
2023-11-13 19:24 ` Jeff Law
2023-11-13 19:44 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors [PR106416] Sam James
2023-12-01 11:29 ` [PATCH 2/6] c: Turn int-conversion warnings into permerrors Thomas Schwinge
2023-12-01 11:36 ` Florian Weimer
2023-11-13 13:10 ` [PATCH 3/6] c: Turn -Wimplicit-function-declaration into a pedpermerror Florian Weimer
2023-11-13 19:25 ` Jeff Law
2023-11-13 19:42 ` [PATCH 3/6] c: Turn -Wimplicit-function-declaration into a pedpermerror [PR91092] Sam James
2023-11-13 13:11 ` [PATCH 4/6] c: Turn -Wimplicit-int into a pedpermerror Florian Weimer
2023-11-13 19:26 ` Jeff Law
2023-11-13 19:45 ` [PATCH 4/6] c: Turn -Wimplicit-int into a pedpermerror [PR91093] Sam James
2023-11-13 13:11 ` [PATCH 5/6] c: Turn -Wreturn-mismatch into a pedpermerror Florian Weimer
2023-11-13 19:28 ` Jeff Law
2023-11-13 13:11 ` [PATCH 6/6] c: Turn -Wincompatible-pointer-types " Florian Weimer
2023-11-13 19:30 ` Jeff Law
2023-11-13 19:44 ` [PATCH 0/6] Turn some C warnings into errors by default Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1699879818.git.fweimer@redhat.com \
--to=fweimer@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).