Thomas Schwinge <tschwi...@baylibre.com> writes: > Hi! > > On 2024-02-10T17:26:01+0000, Andrew Burgess <aburg...@redhat.com> wrote: >> --- a/libiberty/argv.c >> +++ b/libiberty/argv.c > >> @@ -439,17 +442,8 @@ expandargv (int *argcp, char ***argvp) >> } >> /* Add a NUL terminator. */ >> buffer[len] = '\0'; >> - /* If the file is empty or contains only whitespace, buildargv would >> - return a single empty argument. In this context we want no arguments, >> - instead. */ >> - if (only_whitespace (buffer)) >> - { >> - file_argv = (char **) xmalloc (sizeof (char *)); >> - file_argv[0] = NULL; >> - } >> - else >> - /* Parse the string. */ >> - file_argv = buildargv (buffer); >> + /* Parse the string. */ >> + file_argv = buildargv (buffer); >> /* If *ARGVP is not already dynamically allocated, copy it. */ >> if (*argvp == original_argv) >> *argvp = dupargv (*argvp); > > With that (single) use of 'only_whitespace' now gone: > > [...]/source-gcc/libiberty/argv.c:128:1: warning: ‘only_whitespace’ > defined but not used [-Wunused-function] > 128 | only_whitespace (const char* input) > | ^~~~~~~~~~~~~~~ >
Sorry about that. The patch below is the obvious fix. OK to apply? Thanks, Andrew --- commit c4533957b8424a3780180b47834350897674c776 Author: Andrew Burgess <aburg...@redhat.com> Date: Mon Jul 29 13:47:32 2024 +0100 libiberty/argv.c: remove only_whitespace After the commit: commit 5e1d530da87a6d2aa7e719744cb278e7e54a6623 (gcc-buildargv) Date: Sat Feb 10 11:22:13 2024 +0000 libiberty/buildargv: handle input consisting of only white space The function only_whitespace (in argv.c) was no longer being called. Lets delete it. There should be no user visible changes after this commit. 2024-07-29 Andrew Burgess <aburg...@redhat.com> libiberty/ * argv.c (only_whitespace): Delete. diff --git a/libiberty/argv.c b/libiberty/argv.c index 675336273f3..f889432a868 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -124,15 +124,6 @@ consume_whitespace (const char **input) } } -static int -only_whitespace (const char* input) -{ - while (*input != EOS && ISSPACE (*input)) - input++; - - return (*input == EOS); -} - /* @deftypefn Extension char** buildargv (char *@var{sp})