From patchwork Mon Nov 20 09:56:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 167024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp2090563vqn; Mon, 20 Nov 2023 01:58:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGd9Jwi+iIvD4AuFHCn/PuIn3AAQQefkr+VQVkCwjP6Ep5y0sz2xX9TrsHWF4VHq8O0bUqu X-Received: by 2002:a05:620a:bc5:b0:77a:55b2:5dae with SMTP id s5-20020a05620a0bc500b0077a55b25daemr8671323qki.53.1700474333359; Mon, 20 Nov 2023 01:58:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700474333; cv=pass; d=google.com; s=arc-20160816; b=Kt80Mi0JQJIE/+uqVBlNb7TM4oGeV+xc4XfbhqfTJB8uLPSf8wWRM65hx972on/7mT Kr+/DV2SU29qmgV50AZHZ/psLeYaPNcmWUbLxPEsqVdiHDVrgrsO1tkNs7t41tCMsrOC Q5GBzmOWffHiJWNAmi+cYK20adPFk/Gam0fZTBFsCJ6BBN7bVNFmIAIwoamgTcKK3jLl vjS7ErPXf2J/WxCscDWZ+CsF3KbciD9ziptR6jGokZeQIQ0oV8m9lw9vRPoxa93wk1Km jHpvZSDKRGYtJKhA2dyiFhDtLA/rjaVKInarKqome0BMKM1kP9JbeE6LDDRCT0bJJ+RU TJpQ== 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:references:message-id:in-reply-to :subject:to:from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=B9Xtw36foXpldHnpj+O0uDIQCVuLID97f7xr/BLEFDI=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=tKMtArdddXgALBiW5/KBHL8D54hOwl5iMTi4eyAyThvZbxD16Y9M+hgouxI8z1IYTU 4y1qjHRegZ3pfX2i2aUZt2iU4bH5fH7JrVGZTHV7Zc3KtDmvevlGg96WcDUor5iaGtW9 CFD24cnN9y3nwre3xRk/Ml9FBTS37dfE2Wl6IPXudciwOs20xZhUJ7fusqJsBhXQ2jZM 2zhW0lzoYwXKhHq4j+c+4bIlEGqmbMYqEmEscppEGcMEeoanfzNhrcDlS+txxdIEH6Ge bMemGqfCrjfIR5SFmuTyMICasI8R8ItYQfYG08pYEmZFCCDAXG14SyydJ5j3Y+P+kue9 6DKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bd+VmldI; 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 z11-20020ae9e60b000000b0077be3adfac7si6688451qkf.217.2023.11.20.01.58.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:58:53 -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=bd+VmldI; 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 2B0233882166 for ; Mon, 20 Nov 2023 09:58:50 +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 57205388266C for ; Mon, 20 Nov 2023 09:56:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57205388266C 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 57205388266C 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=1700474209; cv=none; b=bcMavQkhbVOa2G2qF79SaFSEBS2IqhmfcMg2aDGb/HI7wigDYme4wBiZyZersQ90rWnw9qIR5JwBHWyWoclIsmmTrMjKh2wKJPTPhFtBj1ykLv56/uc7inG+zzwfb0PKqXspS1Sm/5/MhyIP/V7i29vofDQVK/fikGxaptGyF4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700474209; c=relaxed/simple; bh=RYzwj2kJggj9eYo9Aswm1wZ1ERqypomiq/EfiOB24xg=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=GNnFeFWIUtSMrp7SCMyJCql258Oor2F1vthj3KtNCodoJtIkj/Yeztahslie0xm4CziMvSO76so0yrwVdXv6y8PFfGvHB1qmOMrECTXMQDHfqpUTHTALFhpyEga69FyeA3ZUx0DNk4f/QoiU+WtdlKs2SdLjHbvgN8EYxa9XxxA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700474206; 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: in-reply-to:in-reply-to:references:references; bh=B9Xtw36foXpldHnpj+O0uDIQCVuLID97f7xr/BLEFDI=; b=bd+VmldIuwkH3lvbVpNZFkvL9M+a6eBmnvZY0GdHAdEBDrD8xkGHRGDtxkS2SsVRanDyPp HDzBrGgXzQs4g6lGSUEFzPLXSC2b/ybIDmC6Tiz1WOqX1wAeIT0VodBR35yAXJPRpX2KC4 /ToK61wWoIKW7tgvR1uvTz/eREDgtis= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-JSaDcjduMSSCDAGGnOqu0Q-1; Mon, 20 Nov 2023 04:56:45 -0500 X-MC-Unique: JSaDcjduMSSCDAGGnOqu0Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 10A15185A780 for ; Mon, 20 Nov 2023 09:56:45 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38ED9492BE0 for ; Mon, 20 Nov 2023 09:56:44 +0000 (UTC) From: Florian Weimer To: gcc-patches@gcc.gnu.org Subject: [PATCH v3 11/11] c: Add new -Wdeclaration-missing-parameter-type permerror In-Reply-To: Message-ID: <700d70e4a2874645ddb67a8a335131d83b242e69.1700473918.git.fweimer@redhat.com> References: X-From-Line: 700d70e4a2874645ddb67a8a335131d83b242e69 Mon Sep 17 00:00:00 2001 Date: Mon, 20 Nov 2023 10:56: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.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.6 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: 1783076574415887983 X-GMAIL-MSGID: 1783076574415887983 This used to be a warning, enabled by default, without its own option. A subsequent change could improve diagnostics and provide spelling hints for declarations like “void function (int32t);”. gcc/c-family/ * c.opt (Wdeclaration-missing-parameter-type): New. gcc/c/ChangeLog: PR other/44209 * c-decl.cc (grokparms): Issue permerror for OPT_Wdeclaration_missing_parameter_type instead of a pedwarn. gcc/ChangeLog: * doc/invoke.texi (Warning Options): Document -Wdeclaration-missing-parameter-type. gcc/testsuite/ChangeLog: * gcc.dg/permerror-default.c (missing_parameter_type): Expect error. * gcc.dg/permerror-fpermissive.c (missing_parameter_type): Expect -Wdeclaration-missing-parameter-type warning. * gcc.dg/permerror-gnu89-nopermissive.c (missing_parameter_type): Expect -Wdeclaration-missing-parameter-type error. * gcc.dg/permerror-gnu89-pedantic.c (missing_parameter_type): Likewise. * gcc.dg/permerror-gnu89.c (missing_parameter_type): Expect -Wdeclaration-missing-parameter-type warning. * gcc.dg/permerror-noerror.c: Add -Wno-error=declaration-missing-parameter-type to build flags. (missing_parameter_type): Expect -Wdeclaration-missing-parameter-type warning. * gcc.dg/permerror-nowarning.c: Build with -Wno-declaration-missing-parameter-type. Remove previously expected warning. * gcc.dg/permerror-fpermissive-nowarning.c: Likewise. * gcc.dg/permerror-pedantic.c (missing_parameter_type): Expect -Wdeclaration-missing-parameter-type error. * gcc.dg/permerror-system.c (missing_parameter_type): Likewise. --- gcc/c-family/c.opt | 4 ++++ gcc/c/c-decl.cc | 6 ++++-- gcc/doc/invoke.texi | 17 ++++++++++++++++- gcc/testsuite/gcc.dg/permerror-default.c | 2 +- .../gcc.dg/permerror-fpermissive-nowarning.c | 7 +------ gcc/testsuite/gcc.dg/permerror-fpermissive.c | 2 +- .../gcc.dg/permerror-gnu89-nopermissive.c | 2 +- gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c | 2 +- gcc/testsuite/gcc.dg/permerror-gnu89.c | 2 +- gcc/testsuite/gcc.dg/permerror-noerror.c | 4 ++-- gcc/testsuite/gcc.dg/permerror-nowarning.c | 7 +------ gcc/testsuite/gcc.dg/permerror-pedantic.c | 2 +- gcc/testsuite/gcc.dg/permerror-system.c | 2 ++ 13 files changed, 36 insertions(+), 23 deletions(-) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index b10c6057cd1..723e8c3e27b 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -591,6 +591,10 @@ Wdeclaration-after-statement C ObjC Var(warn_declaration_after_statement) Init(-1) Warning Warn when a declaration is found after a statement. +Wdeclaration-missing-parameter-type +C ObjC Var(warn_declaration_missing_parameter) Warning Init(1) +Warn for missing parameter types in function declarations. + Wdelete-incomplete C++ ObjC++ Var(warn_delete_incomplete) Init(1) Warning Warn when deleting a pointer to incomplete type. diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index d16958113a8..3d9bee54259 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -8337,8 +8337,10 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) { if (!funcdef_flag) { - pedwarn (input_location, 0, "parameter names (without types) in " - "function declaration"); + permerror_opt (input_location, + OPT_Wdeclaration_missing_parameter_type, + "parameter names (without types) in " + "function declaration"); arg_info->parms = NULL_TREE; } else diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index be33da71c44..7f5da45dcea 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -504,7 +504,8 @@ Objective-C and Objective-C++ Dialects}. @item C and Objective-C-only Warning Options @gccoptlist{-Wbad-function-cast -Wmissing-declarations --Wmissing-parameter-type -Wmissing-prototypes -Wmissing-variable-declarations +-Wmissing-parameter-type -Wdeclaration-missing-parameter-type +-Wmissing-prototypes -Wmissing-variable-declarations -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes -Wtraditional -Wtraditional-conversion -Wdeclaration-after-statement -Wpointer-sign} @@ -9734,6 +9735,20 @@ void foo(bar) @{ @} This warning is also enabled by @option{-Wextra}. +@opindex Wno-declaration-missing-parameter-type +@opindex Wdeclaration-missing-parameter-type +@item -Wno-declaration-missing-parameter-type @r{(C and Objective-C only)} +Do not warn if a function declaration contains a parameter name without +a type. Such function declarations do not provide a function prototype +and prevent most type checking in function calls. + +This warning is enabled by default. In C99 and later dialects of C, it +is treated as an error. The error can be downgraded to a warning using +@option{-fpermissive} (along with certain other errors), or for this +error alone, with @option{-Wno-error=declaration-missing-parameter-type}. + +This warning is upgraded to an error by @option{-pedantic-errors}. + @opindex Wmissing-prototypes @opindex Wno-missing-prototypes @item -Wmissing-prototypes @r{(C and Objective-C only)} diff --git a/gcc/testsuite/gcc.dg/permerror-default.c b/gcc/testsuite/gcc.dg/permerror-default.c index 45b58b0131d..c674d689081 100644 --- a/gcc/testsuite/gcc.dg/permerror-default.c +++ b/gcc/testsuite/gcc.dg/permerror-default.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-error "return type defaults to 'int' \\\[-Wimplicit-i (const) 0; /* { dg-error "type defaults to 'int' in type name \\\[-Wimplicit-int\\\]" } */ } -extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-fpermissive-nowarning.c b/gcc/testsuite/gcc.dg/permerror-fpermissive-nowarning.c index f15b21ef43d..d07c8636677 100644 --- a/gcc/testsuite/gcc.dg/permerror-fpermissive-nowarning.c +++ b/gcc/testsuite/gcc.dg/permerror-fpermissive-nowarning.c @@ -1,11 +1,6 @@ -/* { dg-options "-fpermissive -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-return-mismatch" } */ +/* { dg-options "-fpermissive -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-return-mismatch -Wno-declaration-missing-parameter-type" } */ /* This test checks that permerrors can be disabled using -Wno-* options even if -fpermissive is used. */ #include "permerror-default.c" - -/* Ideally, we do not want to see any warnings here, but this warning is not - yet controlled by its own option. */ - -/* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" "" { target *-*-* } 22 } */ diff --git a/gcc/testsuite/gcc.dg/permerror-fpermissive.c b/gcc/testsuite/gcc.dg/permerror-fpermissive.c index 139f35ad1c0..fd3020d75ee 100644 --- a/gcc/testsuite/gcc.dg/permerror-fpermissive.c +++ b/gcc/testsuite/gcc.dg/permerror-fpermissive.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-warning "return type defaults to 'int' \\\[-Wimplicit (const) 0; /* { dg-warning "type defaults to 'int' in type name \\\[-Wimplicit-int\\\]" } */ } -extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-gnu89-nopermissive.c b/gcc/testsuite/gcc.dg/permerror-gnu89-nopermissive.c index 93504b94139..aba4b2498f7 100644 --- a/gcc/testsuite/gcc.dg/permerror-gnu89-nopermissive.c +++ b/gcc/testsuite/gcc.dg/permerror-gnu89-nopermissive.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-bogus "-Wimplicit-int" } */ (const) 0; /* { dg-bogus "-Wimplicit-int" } */ } -extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c b/gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c index 465a16f5f9a..ef4dbfc86c5 100644 --- a/gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c +++ b/gcc/testsuite/gcc.dg/permerror-gnu89-pedantic.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-bogus "-Wimplicit-int" } */ (const) 0; /* { dg-bogus "-Wimplicit-int" } */ } -extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-gnu89.c b/gcc/testsuite/gcc.dg/permerror-gnu89.c index 66f7789269f..83792ecfaac 100644 --- a/gcc/testsuite/gcc.dg/permerror-gnu89.c +++ b/gcc/testsuite/gcc.dg/permerror-gnu89.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-bogus "-Wimplicit-int" } */ (const) 0; /* { dg-bogus "-Wimplicit-int" } */ } -extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-noerror.c b/gcc/testsuite/gcc.dg/permerror-noerror.c index cd1c2013cb5..fc68dfa8bb9 100644 --- a/gcc/testsuite/gcc.dg/permerror-noerror.c +++ b/gcc/testsuite/gcc.dg/permerror-noerror.c @@ -1,4 +1,4 @@ -/* { dg-options "-Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=int-conversion -Wno-error=incompatible-pointer-types -Wno-error=return-mismatch" } */ +/* { dg-options "-Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=int-conversion -Wno-error=incompatible-pointer-types -Wno-error=return-mismatch -Wno-error=declaration-missing-parameter-type" } */ /* This test should emulate the effect of -fpermissive by adding all the -Wno-error= options that are implied by -fpermissive. It needs to be @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-warning "return type defaults to 'int' \\\[-Wimplicit (const) 0; /* { dg-warning "type defaults to 'int' in type name \\\[-Wimplicit-int\\\]" } */ } -extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-warning "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-nowarning.c b/gcc/testsuite/gcc.dg/permerror-nowarning.c index da6bd08245d..b1cf7990127 100644 --- a/gcc/testsuite/gcc.dg/permerror-nowarning.c +++ b/gcc/testsuite/gcc.dg/permerror-nowarning.c @@ -1,10 +1,5 @@ -/* { dg-options "-Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-return-mismatch" } */ +/* { dg-options "-Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion -Wno-incompatible-pointer-types -Wno-return-mismatch -Wno-declaration-missing-parameter-type" } */ /* This test checks that permerrors can be disabled using -Wno-* options. */ #include "permerror-default.c" - -/* Ideally, we do not want to see any warnings here, but this warning is not - yet controlled by its own option. */ - -/* { dg-warning "parameter names \\\(without types\\\) in function declaration\n" "" { target *-*-* } 22 } */ diff --git a/gcc/testsuite/gcc.dg/permerror-pedantic.c b/gcc/testsuite/gcc.dg/permerror-pedantic.c index 95dda18acd4..2380bb2583c 100644 --- a/gcc/testsuite/gcc.dg/permerror-pedantic.c +++ b/gcc/testsuite/gcc.dg/permerror-pedantic.c @@ -19,7 +19,7 @@ implicit_int_4 (i) /* { dg-error "return type defaults to 'int' \\\[-Wimplicit-i (const) 0; /* { dg-error "type defaults to 'int' in type name \\\[-Wimplicit-int\\\]" } */ } -extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration\n" } */ +extern int missing_parameter_type (i); /* { dg-error "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" } */ int * diff --git a/gcc/testsuite/gcc.dg/permerror-system.c b/gcc/testsuite/gcc.dg/permerror-system.c index bd923138461..790e4f03d66 100644 --- a/gcc/testsuite/gcc.dg/permerror-system.c +++ b/gcc/testsuite/gcc.dg/permerror-system.c @@ -17,6 +17,8 @@ /* { 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 "parameter names \\\(without types\\\) in function declaration \\\[-Wdeclaration-missing-parameter-type\\\]" "" { target *-*-* } 22 } */ + /* { 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 } */ /* { dg-error "passing argument 1 of 'f2' makes pointer from integer without a cast \\\[-Wint-conversion\\\]" "" { target *-*-* } 31 } */