public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* preprocessor: Fix profiled bootstrap warning [pr97858]
@ 2020-11-17 14:46 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-11-17 14:46 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]


As Jakub points	out, we	only ever pass a single	variadic parm (if at
all), so just an optional arg is fine.

         PR 97858
         libcpp/
         * mkdeps.c (munge): Drop varadic args, we only ever use one.

pushing to trunk

-- 
Nathan Sidwell

[-- Attachment #2: 97858.diff --]
[-- Type: text/x-patch, Size: 1597 bytes --]

diff --git i/libcpp/mkdeps.c w/libcpp/mkdeps.c
index ea5f060c380..a989ed355fa 100644
--- i/libcpp/mkdeps.c
+++ w/libcpp/mkdeps.c
@@ -105,23 +105,20 @@ public:
   unsigned short quote_lwm;
 };
 
-/* Apply Make quoting to STR, TRAIL etc.  Note that it's not possible
-   to quote all such characters - e.g. \n, %, *, ?, [, \ (in some
+/* Apply Make quoting to STR, TRAIL.  Note that it's not possible to
+   quote all such characters - e.g. \n, %, *, ?, [, \ (in some
    contexts), and ~ are not properly handled.  It isn't possible to
    get this right in any current version of Make.  (??? Still true?
    Old comment referred to 3.76.1.)  */
 
 static const char *
-munge (const char *str, const char *trail = NULL, ...)
+munge (const char *str, const char *trail = nullptr)
 {
   static unsigned alloc;
   static char *buf;
   unsigned dst = 0;
-  va_list args;
-  if (trail)
-    va_start (args, trail);
 
-  for (bool first = true; str; first = false)
+  for (; str; str = trail, trail = nullptr)
     {
       unsigned slashes = 0;
       char c;
@@ -169,14 +166,7 @@ munge (const char *str, const char *trail = NULL, ...)
 
 	  buf[dst++] = c;
 	}
-
-      if (first)
-	str = trail;
-      else
-	str = va_arg (args, const char *);
     }
-  if (trail)
-    va_end (args);
 
   buf[dst] = 0;
   return buf;
@@ -332,7 +322,7 @@ make_write_name (const char *name, FILE *fp, unsigned col, unsigned colmax,
 		 bool quote = true, const char *trail = NULL)
 {
   if (quote)
-    name = munge (name, trail, NULL);
+    name = munge (name, trail);
   unsigned size = strlen (name);
 
   if (col)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-17 14:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 14:46 preprocessor: Fix profiled bootstrap warning [pr97858] Nathan Sidwell

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).