public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Thomas Schwinge <tschwinge@baylibre.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCHv2 2/2] libiberty/buildargv: handle input consisting of only white space
Date: Mon, 29 Jul 2024 13:51:13 +0100	[thread overview]
Message-ID: <871q3cfjjy.fsf@redhat.com> (raw)
In-Reply-To: <87h6c8qxsh.fsf@euler.schwinge.ddns.net>

Thomas Schwinge <tschwinge@baylibre.com> writes:

> Hi!
>
> On 2024-02-10T17:26:01+0000, Andrew Burgess <aburgess@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 <aburgess@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  <aburgess@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})



  reply	other threads:[~2024-07-29 12:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 16:50 [PATCH] libiberty/buildargv: POSIX behaviour for backslash handling Andrew Burgess
2024-01-02 11:22 ` Ping: " Andrew Burgess
2024-02-10 17:25 ` [PATCHv2 0/2] Changes to libiberty buildargv Andrew Burgess
2024-02-10 17:26   ` [PATCHv2 1/2] libiberty/buildargv: POSIX behaviour for backslash handling Andrew Burgess
2024-05-26 15:03     ` Jeff Law
2024-02-10 17:26   ` [PATCHv2 2/2] libiberty/buildargv: handle input consisting of only white space Andrew Burgess
2024-05-26 15:08     ` Jeff Law
2024-06-11 10:39       ` Andrew Burgess
2024-06-28 14:57         ` Andrew Burgess
2024-07-08 21:39         ` Jeff Law
2024-07-16 12:53           ` Andrew Burgess
2024-06-11 10:41       ` Andrew Burgess
2024-07-29 10:48     ` Thomas Schwinge
2024-07-29 12:51       ` Andrew Burgess [this message]
2024-07-30 20:23         ` Jeff Law
2024-08-05 11:36           ` Andrew Burgess
2024-04-27  9:48   ` [PATCHv2 0/2] Changes to libiberty buildargv Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q3cfjjy.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tschwinge@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).