diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-11-17 06:45:18 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-11-17 06:47:16 -0800 |
commit | d7ab349c44f30bed90b03b45865f6c7c5de1dfd8 (patch) | |
tree | ae35ce87d2fc38c62899a7fbb71c26ac111fe06f | |
parent | afa6adbd6c83eeef6d75655140f7c0c9a02a479e (diff) | |
download | gcc-d7ab349c44f30bed90b03b45865f6c7c5de1dfd8.zip gcc-d7ab349c44f30bed90b03b45865f6c7c5de1dfd8.tar.gz gcc-d7ab349c44f30bed90b03b45865f6c7c5de1dfd8.tar.bz2 |
preprocessor: Fix profiled bootstrap warning [pr97858]
As Jakub points out, we only ever pass a single variadic parm (if at
all), so just an optional arg is fine.
PR preprocessor/97858
libcpp/
* mkdeps.c (munge): Drop varadic args, we only ever use one.
-rw-r--r-- | libcpp/mkdeps.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libcpp/mkdeps.c b/libcpp/mkdeps.c index ea5f060..a989ed3 100644 --- a/libcpp/mkdeps.c +++ b/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) |