Message ID | cover.1699879818.git.fweimer@redhat.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1189355vqg; Mon, 13 Nov 2023 05:10:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3/KiiWAGmoeEy+3cE8bbn7oKHkDHibBLmBXwnVP9pz5vfc3ZRoFz7df3BrcZRjLxcGmE4 X-Received: by 2002:a05:6102:1504:b0:45f:3b30:9ca9 with SMTP id f4-20020a056102150400b0045f3b309ca9mr7649691vsv.15.1699881023910; Mon, 13 Nov 2023 05:10:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699881023; cv=pass; d=google.com; s=arc-20160816; b=nBxrPJRZftPDS4qsgrIM/b0x+qdWh8loDnVHJsrcxo47yVxFLkxsqSsq4xPTHiikQG LdwMj8zpBuzSdBMWMW4mvZicgUXp9z7tbWDrITXktTXTQiqAz3F1iZH2CSQiC0ddiZ+Z WAo9+NsO4npiVPe5L0jSH/dcRNkIIOAD1+ypjgaPv6z37SQcVhmb3o4BPv00swScJx6b Txyu3+dO66ofnyRE8Q9qaMkQERnjdwd1jdgWvZirHb2n1fDbkDNhcFepBMlNtQd36607 VIX+jYqPSLdUraIgmzf7PtSSoYxQaQuJDQDhAOuq6KCVZbpbBeOaJeFz4ophEaufW9n+ w7Cw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=g0daQYtKtzeM7JloXDFA0zwIp3P63Li6GJEwJqHoVQ8=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=uWQel9jWJVj4lt+9ZEtcHZ4rqfoIMy/aimvqWAVNnMqCabvwmjSnR0iroA1/iUxezb ag6BXErJrDib5Diq+G+bBp9Gv9UUyouCfJs67mfiIXhTTYAgQa2R/PxwrPj2AuP/EUNt 23E7m1E2L/cUxdiHHff+6ZpXSFQQk1pLGRpPYSH+O9rsDoQEWAp5teNyEZetepPHaj3m WOBj3TLHqocACEfeEyjt9G4wCi8RD8kNugBA4AmRMtZyPAvDEk2UJ4O9vq4I+Usvxuhh zuSJRacHy/B0Qm9UokY1xR4abq+qUH+ZscZ/nXhnsYPkB6wrBFONJiqPj/FC2WBrgVMt Uhnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KlLkYQ/r"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w7-20020a67b107000000b00460f47829eesi497388vsl.510.2023.11.13.05.10.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 05:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KlLkYQ/r"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C29C33858031 for <ouuuleilei@gmail.com>; Mon, 13 Nov 2023 13:10:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 200233858C52 for <gcc-patches@gcc.gnu.org>; Mon, 13 Nov 2023 13:09:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 200233858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 200233858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699880989; cv=none; b=KtcGo6avdjDAKHjQ5j9sBs+RhKvnGimRLNcd5ftwg+aanetbj044LZbbTExt9XbUhCowGw9Yc0onx5yPEa/FHyQvzWlaz8zeSVYq/GUZXOtZqfWZ3l4HpshlomX/h9HeWA89nFjL8q9DKEUlvqVdAo3l5AW/hBIghz9lqDDF+E0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699880989; c=relaxed/simple; bh=yEYjQslqDmQ5efKDlTnqyqXk6G1XY2qQZEEQRTgG8v0=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=fVppqWNOUP9O/6gu+3khW7S8ZealfWFM74Dkk7Bv+Mbxq75tqI+Fxt4omk/zInoiiMULP+JbrnIRcCqd3EdCiNEPrcKWdc+69ViX1eIOpK4wkenvZUrMqE+EScibrBp8ziR1IKSWOnJJoxvNmEhn/zMmtc4D5Xls7GXXYPCYnZw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699880986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g0daQYtKtzeM7JloXDFA0zwIp3P63Li6GJEwJqHoVQ8=; b=KlLkYQ/rxTisMDlpKL/HmZZc9zMWL22LOXKqQoB1HGW4OerQOhBwKfOBsSRBY1Vg6G8iDL DLMXQkijaeCETZFsHIH/Kux368Zz7UymkvGXDgP2vmu4hSDD2zDGlRXrGy6SHolB3Vew/j hyP3enEL63kwQbG4yW59etgp0DcmHIw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-1zvMF12NN9KK5tZQKY5_5w-1; Mon, 13 Nov 2023 08:09:45 -0500 X-MC-Unique: 1zvMF12NN9KK5tZQKY5_5w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E98751C05138 for <gcc-patches@gcc.gnu.org>; Mon, 13 Nov 2023 13:09:44 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 332302026D4C for <gcc-patches@gcc.gnu.org>; Mon, 13 Nov 2023 13:09:43 +0000 (UTC) From: Florian Weimer <fweimer@redhat.com> To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/6] Turn some C warnings into errors by default Message-ID: <cover.1699879818.git.fweimer@redhat.com> X-From-Line: 212c5e6a96543257d45471b92a8c4e994ff33151 Mon Sep 17 00:00:00 2001 Date: Mon, 13 Nov 2023 14:09:42 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782454444104186328 X-GMAIL-MSGID: 1782454444104186328 |
Series |
Turn some C warnings into errors by default
|
|
Message
Florian Weimer
Nov. 13, 2023, 1:09 p.m. UTC
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
Comments
Florian Weimer <fweimer@redhat.com> writes: > 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: I'll incrementally work on the other targets once stuff lands. > > [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/> > Also, please tag PR96284 for all of these. > 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