Hi,

this fixes the s390 bootstrap errors caused by -Werror=format-diag.  It
simply splits the problematic format strings.

Bootstrapped and regtested with -march=z15.

Is it OK?

Regards
 Robin

--

gcc/ChangeLog:

        * config/s390/s390.cc (s390_valid_target_attribute_inner_p): Split
        format strings.
commit 41270791b1d1235d580b6d81c315c74ad07c1807
Author: Robin Dapp <rd...@linux.ibm.com>
Date:   Tue Feb 1 10:13:52 2022 +0100

    s390: Fix bootstrap by splitting format string.
    
    Recently -Werror=format-diag was turned on for bootstrap which broke
    s390 bootstrap.
    
    This patch splits the problematic format strings and changes quoting
    from explicit \" to %qs.
    
    Bootstrapped and regtested on s390x.

diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 58064bfb525..d2faa1371eb 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -15879,6 +15879,9 @@ s390_valid_target_attribute_inner_p (tree args,
   /* Handle multiple arguments separated by commas.  */
   next_optstr = ASTRDUP (TREE_STRING_POINTER (args));
 
+  const char err_prefix[] = "attribute(target(";
+  const char err_suffix[] = "))";
+
   while (next_optstr && *next_optstr != '\0')
     {
       char *p = next_optstr;
@@ -15938,7 +15941,7 @@ s390_valid_target_attribute_inner_p (tree args,
       /* Process the option.  */
       if (!found)
 	{
-	  error ("attribute(target(\"%s\")) is unknown", orig_p);
+	  error ("%s%qs%s is unknown", err_prefix, orig_p, err_suffix);
 	  return false;
 	}
       else if (attrs[i].only_as_pragma && !force_pragma)
@@ -15988,7 +15991,7 @@ s390_valid_target_attribute_inner_p (tree args,
 	    }
 	  else
 	    {
-	      error ("attribute(target(\"%s\")) is unknown", orig_p);
+	      error ("%s%qs%s is unknown", err_prefix, orig_p, err_suffix);
 	      ret = false;
 	    }
 	}
@@ -16005,7 +16008,7 @@ s390_valid_target_attribute_inner_p (tree args,
 			global_dc);
 	  else
 	    {
-	      error ("attribute(target(\"%s\")) is unknown", orig_p);
+	      error ("%s%qs%s is unknown", err_prefix, orig_p, err_suffix);
 	      ret = false;
 	    }
 	}

Reply via email to