[PATCH][stage1] Enhance target and target_clone error messages.

Martin Sebor msebor@gmail.com
Fri Apr 19 00:59:00 GMT 2019


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



More information about the Gcc-patches mailing list