From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain 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 List-Id: 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 } */ -- 2.42.0