[pushed] Darwin: Update quotes in driver warning messages.

Message ID 20211014122503.28258-1-iain@sandoe.co.uk
State Committed
Commit d67b22e7315ca7ecfcf5e5ec3d401285d7ea25b5
Headers
Series [pushed] Darwin: Update quotes in driver warning messages. |

Commit Message

Iain Sandoe Oct. 14, 2021, 12:25 p.m. UTC
  This adds some missing quotes around options and option argument
terms in warning messages.  Avoid contractions in warning
messages.

tested on x86_64 darwin, pushed to master, thanks
Iain

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin-driver.c (darwin_find_version_from_kernel):
	Quote internal identifiers and avoid contractions in
	warnings.
	(darwin_default_min_version): Likewise.
	(darwin_driver_init): Likewise.
---
 gcc/config/darwin-driver.c | 52 ++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 22 deletions(-)
  

Patch

diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 3d7768f055d..573abae4782 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -143,7 +143,7 @@  darwin_find_version_from_kernel (void)
   if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
 	      &osversion_len, NULL, 0) == -1)
     {
-      warning (0, "sysctl for kern.osversion failed: %m");
+      warning (0, "%<sysctl%> for %<kern.osversion%> failed: %m");
       return NULL;
     }
 
@@ -189,7 +189,7 @@  darwin_find_version_from_kernel (void)
   return new_flag;
 
  parse_failed:
-  warning (0, "couldn%'t understand kern.osversion %q.*s",
+  warning (0, "could not understand %<kern.osversion%> %q.*s",
 	   (int) osversion_len, osversion);
   return NULL;
 }
@@ -229,7 +229,7 @@  darwin_default_min_version (void)
       const char *checked = validate_macosx_version_min (new_flag);
       if (checked == NULL)
 	{
-	  warning (0, "could not understand version %s", new_flag);
+	  warning (0, "could not understand version %qs", new_flag);
 	  return NULL;
 	}
       new_flag = xstrndup (checked, strlen (checked));
@@ -305,7 +305,7 @@  darwin_driver_init (unsigned int *decoded_options_count,
 	  else if (!strcmp ((*decoded_options)[i].arg, "ppc64"))
 	    seenPPC64 = true;
 	  else
-	    error ("this compiler does not support %s",
+	    error ("this compiler does not support %qs",
 		   (*decoded_options)[i].arg);
 	  /* Now we've examined it, drop the -arch arg.  */
 	  if (*decoded_options_count > i) {
@@ -377,45 +377,53 @@  darwin_driver_init (unsigned int *decoded_options_count,
   /* Turn -arch xxxx into the appropriate -m32/-m64 flag.
      If the User tried to specify multiple arch flags (which is possible with
      some Darwin compilers) warn that this mode is not supported by this
-     compiler (and ignore the arch flags, which means that the default multi-
-     lib will be generated).  */
+     compiler.  We take arch specifiers that agree with the default multilib
+     as the first choice and reject others.  */
   /* TODO: determine if these warnings would better be errors.  */
 #if DARWIN_X86
   if (seenPPC || seenPPC64)
-    warning (0, "this compiler does not support PowerPC (arch flags ignored)");
+    warning (0, "this compiler does not support PowerPC"
+		" (%<-arch%> option ignored)");
   if (seenX86)
     {
       if (seenX86_64 || seenM64)
-	warning (0, "%s conflicts with i386 (arch flags ignored)",
-	        (seenX86_64? "x86_64": "m64"));
-      else if (! seenM32) /* Add -m32 if the User didn't. */
+	{
+	  const char *op = (seenX86_64? "-arch x86_64": "-m64");
+	  warning (0, "%qs conflicts with %<-arch i386%> (%qs ignored)",
+		   op, op);
+	}
+      if (! seenM32) /* Add -m32 if the User didn't. */
 	appendM32 = true;
     }
   else if (seenX86_64)
     {
-      if (seenX86 || seenM32)
-	warning (0, "%s conflicts with x86_64 (arch flags ignored)",
-		 (seenX86? "i386": "m32"));
-      else if (! seenM64) /* Add -m64 if the User didn't. */
+      if (seenM32)
+	warning (0, "%<-m32%> conflicts with %<-arch x86_64%>"
+		    " (%<-m32%> ignored)");
+      if (! seenM64) /* Add -m64 if the User didn't. */
 	appendM64 = true;
     }  
 #elif DARWIN_PPC
   if (seenX86 || seenX86_64)
-    warning (0, "this compiler does not support X86 (arch flags ignored)");
+    warning (0, "this compiler does not support x86"
+		" (%<-arch%> option ignored)");
   if (seenPPC)
     {
       if (seenPPC64 || seenM64)
-	warning (0, "%s conflicts with ppc (arch flags ignored)",
-		 (seenPPC64? "ppc64": "m64"));
-      else if (! seenM32) /* Add -m32 if the User didn't. */
+	{
+	  const char *op = (seenPPC64? "-arch ppc64": "-m64");
+	  warning (0, "%qs conflicts with %<-arch ppc%> (%qs ignored)",
+		   op, op);
+	}
+      if (! seenM32) /* Add -m32 if the User didn't. */
 	appendM32 = true;
     }
   else if (seenPPC64)
     {
-      if (seenPPC || seenM32)
-	warning (0, "%s conflicts with ppc64 (arch flags ignored)",
-		 (seenPPC? "ppc": "m32"));
-      else if (! seenM64) /* Add -m64 if the User didn't. */
+      if (seenM32)
+	warning (0, "%<-m32%> conflicts with %<-arch ppc64%>"
+		    " (%<-m32%> ignored)");
+      if (! seenM64) /* Add -m64 if the User didn't. */
 	appendM64 = true;
     }
 #endif