On 4/23/19 4:06 AM, Martin Liška wrote:
> On 4/19/19 2:28 AM, Martin Sebor wrote:
>> On 4/18/19 5:09 AM, Martin Liška wrote:
>>> Hi.
>>>
>>> The patch distinguishes among target and target_clone attribute when
>>> reporting for an error. I've also reworded the affected error messages
>>> a bit.
>>>
>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>
>>> Ready to be installed after stage1 opens?
>>> Thanks,
>>> Martin
>>>
>>> ---
>>> gcc/cgraphclones.c | 2 +-
>>> gcc/config/i386/i386-c.c | 5 +-
>>> gcc/config/i386/i386-protos.h | 4 +-
>>> gcc/config/i386/i386.c | 54 +++++++++++++---------
>>> gcc/testsuite/gcc.target/i386/funcspec-4.c | 2 +-
>>> 5 files changed, 39 insertions(+), 28 deletions(-)
>> Just a suggestion to also consider making the phrasing in the messages
>> consistent by adding "is" below
>>
>> @@ -5316,7 +5322,7 @@ ix86_valid_target_attribute_inner_p (tree args, char
>> *p_strings[],
>>
>> else if (TREE_CODE (args) != STRING_CST)
>> {
>> - error ("attribute %<target%> argument not a string");
>> + error_at (loc, "attribute %qs argument not a string", attr_name);
>> return false;
>>
>> i.e., "is not a string" and changing the below
>>
>> @@ -5382,7 +5386,8 @@ ix86_valid_target_attribute_inner_p (tree args, char
>> *p_strings[],
>> /* Process the option. */
>> if (opt == N_OPTS)
>> {
>> - error ("attribute(target(\"%s\")) is unknown", orig_p);
>> + error_at (loc, "attribute value %qs is unknown in %qs attribute",
>> + orig_p, attr_name);
>>
>> to
>>
>> error_at (loc, "attribute %qs argument %qs is unknown",
>> attr_name, orig_p);
>>
>> Martin
> Thank you Martin. I'm sending updated patch.
>
> Martin
>
>
> 0001-Enhance-target-and-target_clone-error-messages.patch
>
> From 2778f9ab4f1cd091780694e8cc1335d6125d95ec Mon Sep 17 00:00:00 2001
> From: marxin <mli...@suse.cz>
> Date: Wed, 17 Apr 2019 13:59:14 +0200
> Subject: [PATCH] Enhance target and target_clone error messages.
>
> gcc/ChangeLog:
>
> 2019-04-18 Martin Liska <mli...@suse.cz>
>
> * cgraphclones.c: Call valid_attribute_p with 1 for
> target_clone.
> * config/i386/i386-c.c (ix86_pragma_target_parse): Use 0 as
> it's for target attribute.
> * config/i386/i386-protos.h (ix86_valid_target_attribute_tree):
> Add new boolean argument.
> * config/i386/i386.c (ix86_valid_target_attribute_inner_p):
> Likewise.
> (ix86_valid_target_attribute_tree): Pass target_clone_attr
> to ix86_valid_target_attribute_inner_p.
> (ix86_valid_target_attribute_p): Pass flags argument to
> ix86_valid_target_attribute_inner_p.
> (get_builtin_code_for_version): Use 0 as it's target attribute.
>
> gcc/testsuite/ChangeLog:
>
> 2019-04-18 Martin Liska <mli...@suse.cz>
>
> * gcc.target/i386/funcspec-4.c: Update scanned pattern.
> * g++.target/i386/pr57362.C: Likewise.
OK
Jeff