From patchwork Wed Mar 20 04:08:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 1058834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-498161-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GiiRC0UQ"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ibpLWJ/k"; 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 44PGcm6D8mz9sDQ for ; Wed, 20 Mar 2019 15:08:40 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=J+yiK42DPjkaJNer 0nMnz2/73IXZngq1amqDR7COEPbbg1CVd/faWn0nHNUdzv/IkPNtvAbPteJOnNre 43sq+4Av7/oB5l66pNN2bsQHsM/l8nMQAb5g5Qc3uTDvbSyCyINMmppBeGWcGurk 3iFPllGMJEPbi0iEg91QAtcNTUU= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=VeXABWQ/ZuWngHVnajCOWN SB+Sg=; b=GiiRC0UQfiPygMDO2/Z50dJ6ePehuYNLiN86fCvPn2UhMad37Il5Fx FZilJE9fdu4xUofHUfaKphowR+2cJ/grRGcSVzKVhXzcrnztmJWOGVHrvpVPTKPn OoNw1N1JJXmn9azVP8uRhNtX0B5vLO99fp7r9GscZo+L10BTtNebI= Received: (qmail 99641 invoked by alias); 20 Mar 2019 04:08:33 -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 99618 invoked by uid 89); 20 Mar 2019 04:08:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-it1-f195.google.com Received: from mail-it1-f195.google.com (HELO mail-it1-f195.google.com) (209.85.166.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Mar 2019 04:08:31 +0000 Received: by mail-it1-f195.google.com with SMTP id 139so5704347ita.4; Tue, 19 Mar 2019 21:08:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=xCujRxTVpPI+w2B/15BQrbeaHx1xTLZ6UEl31R6CwZ8=; b=ibpLWJ/k2Q3KWPCdmNzUKjFDl+Fe81IenEWr39Zyp44DBuyejzxWLzSDEK+y8nZT9R jlrl2FfaU+c52fR69RD11qdU9fjnj56/qga6jgVGryIu/tEQnQXu2EPzwoYu7jofV7ef Zy1T7AVFkrMAKn25Areez2/5U4qbyLADLluMY2xQpRNz57mno6rQbzlFRHk2WWzrKN6A XkBi/8XMOvP8xCzkFZ+1DgcTZ+LtT/8E2x2WD5YZrnyky27M0BUeahskUKic+7H24JN6 H7rszgdUhQMTkRbICn208639NHl0O4GbvzOvmHkzNZhoR4Tui21zeg72aX4WIDJOtTae GhJg== Received: from xavier.hsd1.ut.comcast.net ([2601:681:4100:375e:f2d5:bfff:fecd:8741]) by smtp.gmail.com with ESMTPSA id c1sm585313itd.23.2019.03.19.21.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 21:08:28 -0700 (PDT) From: Alex Henrie To: gcc-patches@gcc.gnu.org, manu@gcc.gnu.org, mliska@suse.cz, joseph@codesourcery.com Subject: [PATCH v2 1/2] PR c/65403 - Ignore -Wno-error= Date: Tue, 19 Mar 2019 22:08:23 -0600 Message-Id: <20190320040824.27088-1-alexhenrie24@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes From: Manuel López-Ibáñez * opts.c: Ignore -Wno-error= except if there are other diagnostics. --- gcc/opts-common.c | 2 ++ gcc/opts-global.c | 10 +++++++--- gcc/opts.c | 5 ++++- gcc/opts.h | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gcc/opts-common.c b/gcc/opts-common.c index edbb3ac9b6d..36e06e2372a 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -26,6 +26,8 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic.h" #include "spellcheck.h" +vec ignored_wnoerror_options; + static void prune_options (struct cl_decoded_option **, unsigned int *); /* An option that is undocumented, that takes a joined argument, and diff --git a/gcc/opts-global.c b/gcc/opts-global.c index a5e9ef0237a..bef020a4c46 100644 --- a/gcc/opts-global.c +++ b/gcc/opts-global.c @@ -132,12 +132,16 @@ print_ignored_options (void) { while (!ignored_options.is_empty ()) { - const char *opt; - - opt = ignored_options.pop (); + const char * opt = ignored_options.pop (); warning_at (UNKNOWN_LOCATION, 0, "unrecognized command line option %qs", opt); } + while (!ignored_wnoerror_options.is_empty ()) + { + const char * opt = ignored_wnoerror_options.pop (); + warning_at (UNKNOWN_LOCATION, 0, + "%<-Werror=%s%>: no option -W%s", opt, opt); + } } /* Handle an unknown option DECODED, returning true if an error should diff --git a/gcc/opts.c b/gcc/opts.c index 02f6b4656e1..492a50ba326 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -3087,7 +3087,10 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, strcpy (new_option + 1, arg); option_index = find_opt (new_option, lang_mask); if (option_index == OPT_SPECIAL_unknown) - error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option); + if (value) + error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option); + else + ignored_wnoerror_options.safe_push (arg); else if (!(cl_options[option_index].flags & CL_WARNING)) error_at (loc, "%<-Werror=%s%>: -%s is not an option that controls " "warnings", arg, new_option); diff --git a/gcc/opts.h b/gcc/opts.h index f14d9bcb896..b18504e0bc3 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -456,4 +456,6 @@ extern bool parse_and_check_align_values (const char *flag, bool report_error, location_t loc); +extern vec ignored_wnoerror_options; + #endif