From patchwork Tue Nov 14 17:50:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 165038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2095206rwb; Tue, 14 Nov 2023 09:52:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuwxokgS8lShL+ODDoidi1MQLfPDtP+vVUOr6ocRmv4lj7kXGBNMUP/JKVpGt+KVzAJN6N X-Received: by 2002:a05:620a:444c:b0:76f:44c:5cd0 with SMTP id w12-20020a05620a444c00b0076f044c5cd0mr3461450qkp.48.1699984355813; Tue, 14 Nov 2023 09:52:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699984355; cv=pass; d=google.com; s=arc-20160816; b=AaPhOv3seRzZi6XOLXXJL5iHpE8w5+Nqy1PrXmsYX1Zoxv/wAYcmyRC92px2k+v3J2 hPZ/HfuhonDeYX+k9pzyC5W6z+2mzxqNW5iBoow8djoiUteF0hTXTIB5zWtWdIzRmNGB e608JnwgR1G3LzKJDo4szxis7mWap0SrQRugaMhhuCc2diduzHdd0uWNSnYGBfzYSMHI QJXRoxb+WBpp7RSVTQXi3SGHcIKmldEa72cQIw7ac5SUi5IZ1oJs40TcP3dMW1d9cVHP q9LAgPy/bArVhkewfHjGpDuCSNsqkk8ucRfOk0VvMk3TD28HXNfbyt6lOpKMaxvjs+BD m3Hw== 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:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=pkY3g/NPqMoCrcYXAyDWpOYz85e39eswNe0GV8CA2TQ=; fh=brrc/l6yGUGxGhv8SjiSoDgfQmQ4atC/Em9G49NRuIw=; b=C0xAZ8gQnlktM5+3Nr+Hbjno2ZBSM6mkxohy2VAk7G9KhJYwYCPf+T0x+DNu+C8Ude 2dbh4CBn0DPoXYA9VhfMGwuf+MYNBJVzk763OHcWdA5VdjCeMUErnksYllaUJ8VdrN/e avnjr80qnT+OQjMdzH2OFxrwVnT233IGJPR3AQsot1QCvDmDTmJGEesV9WJTfGMoLPqM AIu4rGa1NeyQAmHwsVnMqF1DEqPA2X8aG3WeV38/mhgNLR1QRFlAsKqNDfWgUelY/c7G TWXFpdrT72np2QUlR/Op26aI4+3q1gUKdWRe0LThDmccoYX6yqmMAUHPdO7nF8+7n1vP S7xA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i3mrwezK; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l2-20020a05620a28c200b007758e273104si7546038qkp.334.2023.11.14.09.52.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 09:52:35 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i3mrwezK; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 25BF4385C411 for ; Tue, 14 Nov 2023 17:52:19 +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 2A2CF3858420 for ; Tue, 14 Nov 2023 17:50:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A2CF3858420 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 2A2CF3858420 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=1699984253; cv=none; b=gA2NNChGuvP49GHML59CVOPNEBwV64LHQjJXQv0LNMf3g5cNO9cGbdFuEycg9vd5X/8sRC2ZOOWCOBEMlNREnQAcsWBmDm0Wpb6PNhU2hkdFDvaNvHwU48eQDvd40gA4HP3mVRx6Q1Dkr2CJck+wlfS4vt53pjsBfjm8yK8+na8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699984253; c=relaxed/simple; bh=E+yeU3/9HcEhtyc4QZp5TSl5oh9nVlPeKylIGVPTewQ=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=VoJEXLeGKwak17aT2ymRwrp37yrC6AbRanD/SC2AJplT0R76Yzs4SqZVXBvbPAwPvPmZ1tBnxc89gRFJfR3S+qW1lUI0sZUwb2XoQBK4FAh+MyIGcxflUmylS7V+iIwQ14TkhLYVFwGwmMTzAsIpK9/dFLtwBlqDj7l1f8QlqAA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699984251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pkY3g/NPqMoCrcYXAyDWpOYz85e39eswNe0GV8CA2TQ=; b=i3mrwezKUxeBXzcd3bukMVgMoMQNL7ER+L3FoQPMbd2xSniCcPZ0Uzz6txajnZDbKBjrbB KDeSNphnTqKMFJ0vIqwmTdyvKaLGgQ7A4BvBsBMFkxccTpxO0M/MN3iPL3Sbki9b4jfxU1 CZkUUO0B8OquZ1SDzMXERZ57uBHSl7k= 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-611-TH8Qgj3tP8WN1lRQdg0Ryg-1; Tue, 14 Nov 2023 12:50:47 -0500 X-MC-Unique: TH8Qgj3tP8WN1lRQdg0Ryg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 00F0E3810B16; Tue, 14 Nov 2023 17:50:47 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D32A143; Tue, 14 Nov 2023 17:50:46 +0000 (UTC) From: Florian Weimer To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, jeffreyalaw@gmail.com, joseph@codesourcery.com, sam@gentoo.org Subject: [PATCH v2 5/8] c: Do not ignore some forms of -Wimplicit-int in system headers In-Reply-To: Message-ID: <78cec351fe80ff14ef5881e726aa53d1ec69c750.1699983736.git.fweimer@redhat.com> References: X-From-Line: 78cec351fe80ff14ef5881e726aa53d1ec69c750 Mon Sep 17 00:00:00 2001 Date: Tue, 14 Nov 2023 18:50:44 +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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 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: 1782562795619304184 X-GMAIL-MSGID: 1782562795619304184 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 } */