From patchwork Fri Feb 14 12:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1238003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519543-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=CGqIFJEq; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48JsSr34Wfz9s29 for ; Fri, 14 Feb 2020 23:02:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=eCb+C4Z8x6WjktM8LDfun4qexp6yckMNWlTBCOVQRR49v9B7Zg Cx3JL/zshzuGEnelrv6jUmiksFmCFan/VBGCTCQwLfxz1624WFUTlyRGw/hqyEvp yk0abYiaYkZPNZpMmqqnK3KmJusPHNwJ5/nKdmKetk8ZMOJ7bci7iSXsQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Bqrjr/r9pL2Isoa1idLnt5zVVoo=; b=CGqIFJEqfU+n64P6uxRK ahH3IZMqBJSHgaIhh8vQyKN055j3kY5dqPmKSPoJN9gGIkbkE1ONNSisSdMjy7Rg h1y6x7m6vREXJuwUd+GoZXC7weSs855U2EQ/BicCuWtDQ2EE0pQt9yNVxOgBgP5K UEfcGawOXitZQF/ACg7Bh9A= Received: (qmail 15162 invoked by alias); 14 Feb 2020 12:02:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15154 invoked by uid 89); 14 Feb 2020 12:02:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2020 12:02:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1516DB280; Fri, 14 Feb 2020 12:02:24 +0000 (UTC) Date: Fri, 14 Feb 2020 13:02:23 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: "Joseph S. Myers" Subject: [PATCH] c/86134 avoid errors for unrecognized -Wno- options Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 This makes sure to not promote diagnostics about unrecognized -Wno- options to errors and make the intent of the diagnostic clearer. Bootstrapped and tested on x86_64-unknown-linux-gnu, OK for trunk? Thanks, Richard. 2020-02-14 Richard Biener PR c/86134 * opts-global.c (print_ignored_options): Use inform and amend message. * gcc.dg/pr86134.c: New testcase. * gcc.dg/pr28322-2.c: Adjust. diff --git a/gcc/opts-global.c b/gcc/opts-global.c index d5e308bf800..52ea083a6d5 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -139,8 +139,10 @@ print_ignored_options (void) const char *opt; opt = ignored_options.pop (); - warning_at (UNKNOWN_LOCATION, 0, - "unrecognized command-line option %qs", opt); + /* Use inform, not warning_at, to avoid promoting these to errors. */ + inform (UNKNOWN_LOCATION, + "unrecognized command-line option %qs may have silenced " + "earlier diagnostics", opt); } } diff --git a/gcc/testsuite/gcc.dg/pr28322-2.c b/gcc/testsuite/gcc.dg/pr28322-2.c index c9e5e228a7b..20adf5e92b8 100644 --- a/gcc/testsuite/gcc.dg/pr28322-2.c +++ b/gcc/testsuite/gcc.dg/pr28322-2.c @@ -8,5 +8,5 @@ int foo (void) return i; } -/* { dg-warning "unrecognized command-line option .-Wno-foobar." "" { target *-*-* } 0 } */ +/* { dg-message "unrecognized command-line option .-Wno-foobar." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pr86134.c b/gcc/testsuite/gcc.dg/pr86134.c new file mode 100644 index 00000000000..3fd21a32306 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86134.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -Werror -Wno-error=main -Wno-foobar" } */ + +void main() {} /* { dg-warning "return type" } */ + +/* { dg-message "unrecognized command-line option" "" { target *-*-* } 0 } */