public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Martin Sebor" <msebor@gmail.com>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Make a warning for -Werror=wrong-language (PR driver/91172).
Date: Sun, 21 Jul 2019 20:41:00 -0000	[thread overview]
Message-ID: <1224a3ea-efe7-6e51-32cc-29d09e9e80b6@redhat.com> (raw)
In-Reply-To: <38f7785b-c334-73f8-9618-dbaa2ee3449a@suse.cz>

On 7/17/19 1:40 AM, Martin Liška wrote:
> On 7/16/19 6:40 PM, Martin Sebor wrote:
>> On 7/16/19 5:16 AM, Martin Liška wrote:
>>> Hi.
>>>
>>> I noticed in the PR that -Werror=argument argument is not verified
>>> that the option is supported by a language we compile for.
>>> That's changed in the patch. However, it's not ideal as I need to mark
>>> the -Werror as the problematic option and one can't print a proper
>>> list of valid languages for which the rejected option can be used.
>>>
>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>
>>> Ready to be installed?
>>> Thanks,
>>> Martin
>>>
>>> gcc/ChangeLog:
>>>
>>> 2019-07-16  Martin Liska  <mliska@suse.cz>
>>>
>>>     PR driver/91172
>>>     * opts-common.c (decode_cmdline_option): Decode
>>>     argument of -Werror and check it for a wrong language.
>>>     * opts-global.c (complain_wrong_lang): Remove such case.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> 2019-07-16  Martin Liska  <mliska@suse.cz>
>>>
>>>     PR driver/91172
>>>     * gcc.dg/pr91172.c: New test.
>>> ---
>>>   gcc/opts-common.c              | 20 +++++++++++++++++++-
>>>   gcc/opts-global.c              |  6 +++++-
>>>   gcc/testsuite/gcc.dg/pr91172.c |  3 +++
>>>   3 files changed, 27 insertions(+), 2 deletions(-)
>>>   create mode 100644 gcc/testsuite/gcc.dg/pr91172.c
>> Nice catch!
> Yep, I came to the quite accidentally.
> 
>> @@ -745,6 +746,23 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
>>    /* Check if this is a switch for a different front end.  */
>>    if (!option_ok_for_language (option, lang_mask))
>>      errors |= CL_ERR_WRONG_LANG;
>> +  else if (strcmp (option->opt_text, "-Werror=") == 0
>> +       && strchr (opt_value, ',') == NULL)
>> +    {
>> +      /* Verify that -Werror argument is a valid warning
>> +     for a languages.  */
>>
>> Typo: "for a language" (singular).
> Fixed.
> 
>> +  else
>> +    /* Happens for -Werror=warning_name.  */
>> +    warning (0, "command-line error argument %qs is not valid for %s",
>> +         text, bad_lang);
>>
>> It might be better phrased as something like
>>
>>   "%<-Werror=%> argument %qs is not valid for %s"
>>
>> The argument is not one of a "command-line error."  It's one
>> to the -Werror option (which can be specified in other places
>> besides the command line).
> I like language corrections from native speakers.
> 
> I'm sending updated version of the patch.
> Thanks,
> Martin
> 
>> Martin
> 
> 
> 0001-Make-a-warning-for-Werror-wrong-language-PR-driver-9.patch
> 
> From 03baf640c12ea6dfda2215ae07d288b292179217 Mon Sep 17 00:00:00 2001
> From: Martin Liska <mliska@suse.cz>
> Date: Tue, 16 Jul 2019 11:11:00 +0200
> Subject: [PATCH] Make a warning for -Werror=wrong-language (PR driver/91172).
> 
> gcc/ChangeLog:
> 
> 2019-07-16  Martin Liska  <mliska@suse.cz>
> 
> 	PR driver/91172
> 	* opts-common.c (decode_cmdline_option): Decode
> 	argument of -Werror and check it for a wrong language.
> 	* opts-global.c (complain_wrong_lang): Remove such case.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-07-16  Martin Liska  <mliska@suse.cz>
> 
> 	PR driver/91172
> 	* gcc.dg/pr91172.c: New test.
OK
jeff

      reply	other threads:[~2019-07-21 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 11:18 Martin Liška
2019-07-16 16:40 ` Martin Sebor
2019-07-17  7:55   ` Martin Liška
2019-07-21 20:41     ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1224a3ea-efe7-6e51-32cc-29d09e9e80b6@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=msebor@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).