From patchwork Mon Nov 20 09:56:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 167020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2090093vqn; Mon, 20 Nov 2023 01:57:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKmW4JL3fPQzmG1R5S8pywzpCXSawh7dYs0aDGAK8RKD3qCPCdlxqFRFr0rySa867Ra77w X-Received: by 2002:a05:620a:268e:b0:779:e75d:e80e with SMTP id c14-20020a05620a268e00b00779e75de80emr8538771qkp.15.1700474245462; Mon, 20 Nov 2023 01:57:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700474245; cv=pass; d=google.com; s=arc-20160816; b=NYrEdC27hrnqeb1eITOPqJgfpw1yf+gRnVOsyi0pvYQaeND1vF6Swz3xPenQRHwmB0 WlmccJmcUpAMUrVJP7DAkq0R5gDRu8etcSfyXwEjwfBx0cSlWNY25bnheBGbcLbzoUVx 6Znn2mO7qbl86v7VNsxDSjV12IMqmiNZELHPwV+b9GA2th615He3QdGYfK2exbqPea8h GjtXrr71ozuKd5ReNthQTNHlEJA9XAfOoYjAS1HoLpnJ8o4yBdGbV5y1ZkzGnZNowwKy 68kOpGTvTETL/KPq106NcrGgkKMdcSC9+aD6TdXFMn0vA/iZ41b2nFKCMVo5cnKBZETc EaQA== 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:mime-version:user-agent:date :references:message-id:in-reply-to:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=xMFbmhput7M4sFBH/m2oLpNzIgFM+j9VI0FaEmP5Plw=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=chqIF/EyhijFtdgoMNQmEHL98ff/BRiTDMOKM3kyHZY3FR0ywCDI8j1jQcNsVRQwkn NwO2X0EJTnd2YgqaK12u6lRjN/6nYyV8YQxg8D1MdqGh8OdhepBD9GopQM3W9piDhHKc M9fl7lUJq6yIDVFPIDr9y/0fIEqFMS8h47qLD5Xl7CoiEQymyH/d2Gkf5Czxb/4h2Afa IYFkl9PGDXNJfw8+HqRmQYYrtsUCZNPcvrmjz3Om28w5A8x1GACaqG21CbHtKp7sVuHP qG1mWxA5yA0RqnjVfFFvw17eeBzaerAebBjHGGDLgMEekDCA5kCOc+4PnmajJJw/Jyhx h8cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NAhIOJRX; 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 ea25-20020a05620a489900b007757fdc191dsi7288046qkb.451.2023.11.20.01.57.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:57:25 -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=NAhIOJRX; 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 86372388455F for ; Mon, 20 Nov 2023 09:57:11 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 299EC3882671 for ; Mon, 20 Nov 2023 09:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 299EC3882671 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 299EC3882671 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700474201; cv=none; b=ps1jNiDTe1pNIcPUyDgbgtDgql3npzvyER2ycw42fiNlQuLFLyRrZtAbiv6+PGGI7Qr1d81/EKz0N60Z0gjAX0hDOF0ystFyV1rXAVV1D3gDNqcILXT9uyQZuB2CsnpmPh8DYLlAD28uyR57TaGyU3x/ejsdKBpyq+Yby3B4+pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700474201; c=relaxed/simple; bh=w0s4+nukiFMGifQwVnEBkvsSy2pycDjiob0WfjwFTzE=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=VRqu54Uss5tdVfovoxU/vvl56dOzQTb+k2bOeXdxWjgvbfDuGTaprbtusKhdJ592nkBN8CtBS4twroBSuTx8ts+CJRGcibwlM8qZb8CA1WtAwKTK50UcbUHIT2Sqc63+xezUEF3K3WP8SWVmAg1RO+eIa7QBPJAdUIoXYl5Yvio= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700474190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xMFbmhput7M4sFBH/m2oLpNzIgFM+j9VI0FaEmP5Plw=; b=NAhIOJRX7e+yYpbmwrTl+nBOPOI6iOGQbOzpcSscouKv1H9XhsW6iKzfZUG3hXxPlkUaxS ASQ2ziSgRbzb2lAVciKfZ1dDxO/CQyno64bD56HK4MgNwRYA4Zf919KYIktTAKnCbjxniX NetaRH4ZeU28xzMQbn8vDVOXSTFRU/s= 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-629-1BPIhBGBPi-n4cYe2xR10A-1; Mon, 20 Nov 2023 04:56:28 -0500 X-MC-Unique: 1BPIhBGBPi-n4cYe2xR10A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 8EBE01C06E31 for ; Mon, 20 Nov 2023 09:56:28 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED48E492BFA for ; Mon, 20 Nov 2023 09:56:27 +0000 (UTC) From: Florian Weimer To: gcc-patches@gcc.gnu.org Subject: [PATCH v3 08/11] c: Do not ignore some forms of -Wimplicit-int in system headers In-Reply-To: Message-ID: <7b09c1315253d91868e0f4e95debb75c41a62873.1700473918.git.fweimer@redhat.com> References: X-From-Line: 7b09c1315253d91868e0f4e95debb75c41a62873 Mon Sep 17 00:00:00 2001 Date: Mon, 20 Nov 2023 10:56:26 +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.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783076482439588433 X-GMAIL-MSGID: 1783076482439588433 Most -Wimplicit-int warnings were unconditionally disabled for system headers. Only missing types for parameters in old-style function definitions resulted in warnings. This is inconsistent with the treatment of other permerrors, which are active in system headers. gcc/c/ * c-decl.cc (grokdeclarator): Do not skip -Wimplicit-int warnings or errors in system headers. gcc/testsuite/ * gcc.dg/permerror-system.c: Expect all -Wimplicit-int permerrors. --- gcc/c/c-decl.cc | 2 +- gcc/testsuite/gcc.dg/permerror-system.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 893e24f7dc6..d16958113a8 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -6845,7 +6845,7 @@ grokdeclarator (const struct c_declarator *declarator, /* Diagnose defaulting to "int". */ - if (declspecs->default_int_p && !in_system_header_at (input_location)) + if (declspecs->default_int_p) { /* Issue a warning if this is an ISO C 99 program or if -Wreturn-type and this is a function, or if -Wimplicit; diff --git a/gcc/testsuite/gcc.dg/permerror-system.c b/gcc/testsuite/gcc.dg/permerror-system.c index 60c65ffc1d4..cad48c93f90 100644 --- a/gcc/testsuite/gcc.dg/permerror-system.c +++ b/gcc/testsuite/gcc.dg/permerror-system.c @@ -10,7 +10,12 @@ /* { dg-error "'f1' \\\[-Wimplicit-function-declaration\\\]" "" { target *-*-* } 10 } */ +/* { dg-error "'implicit_int_1' \\\[-Wimplicit-int\\\]" "" { target *-*-* } 13 } */ +/* { dg-error "'implicit_int_2' \\\[-Wimplicit-int\\\]" "" { target *-*-* } 14 } */ +/* { dg-error "'implicit_int_3' \\\[-Wimplicit-int\\]" "" { target *-*-* } 15 } */ +/* { dg-error "return type defaults to 'int' \\\[-Wimplicit-int\\\]" "" { target *-*-* } 16 } */ /* { dg-error "type of 'i' defaults to 'int' \\\[-Wimplicit-int\\\]" "" { target *-*-*} 16 } */ +/* { dg-error "type defaults to 'int' in type name \\\[-Wimplicit-int\\\]" "" { target *-*-* } 19 } */ /* { dg-error "pointer/integer type mismatch in conditional expression \\\[-Wint-conversion\\\]" "" { target *-*-* } 29 } */ /* { dg-error "pointer/integer type mismatch in conditional expression \\\[-Wint-conversion\\\]" "" { target *-*-* } 30 } */