public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hu Jialun <hujialun@comp.nus.edu.sg>
To: gcc-patches@gcc.gnu.org
Subject: *PING* [PATCH] libiberty: allow comments in option file
Date: Sat, 25 Sep 2021 20:58:23 +0800	[thread overview]
Message-ID: <20210925125823.33378-1-hujialun@comp.nus.edu.sg> (raw)
In-Reply-To: <20210911064712.179872-1-hujialun@comp.nus.edu.sg>

Hello,

Sorry for bumping it again but I guess it was getting overlooked.

I am very junior with mailing list open source contributions so please feel
free to point out if I have inadvertantly done something in an incorrect way.

The archive of the original email can be found at
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579232.html
and is also appended below.

Best regards,
Hu Jialun

> Enables putting line comments into option files included using '@'.
> 
> Comments begin with a ';' followed by whitespace, and terminates at the
> end of the line.  Backward compability should be satisfactory since ';'
> is a character disallowed in DOS filenames and rarely used in filenames
> or options anywhere else as well.
> 
> Related discussion: https://gcc.gnu.org/legacy-ml/gcc/2011-02/msg00422.html
> ---
>  libiberty/argv.c                      |  5 +++++
>  libiberty/testsuite/test-expandargv.c | 12 ++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/libiberty/argv.c b/libiberty/argv.c
> index 48dcd102461..2bc7569b718 100644
> --- a/libiberty/argv.c
> +++ b/libiberty/argv.c
> @@ -194,6 +194,11 @@ char **buildargv (const char *input)
>  	{
>  	  /* Pick off argv[argc] */
>  	  consume_whitespace (&input);
> +	  if (*input == ';')
> +	    {
> +	      for (; *input != '\n' && *input != EOS; ++input);
> +	      continue;
> +	    }
>  
>  	  if ((maxargc == 0) || (argc >= (maxargc - 1)))
>  	    {
> diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c
> index 56c170f9ec6..5640b2b41cf 100644
> --- a/libiberty/testsuite/test-expandargv.c
> +++ b/libiberty/testsuite/test-expandargv.c
> @@ -142,6 +142,18 @@ const char *test_data[] = {
>    "b",
>    0,
>  
> +  /* Test 7 - Check for comments in option file.  */
> +  "abc\n;def\nxy \\;z \\ ;gh",    /* Test 7 data */
> +  ARGV0,
> +  "@test-expandargv-7.lst",
> +  0,
> +  ARGV0,
> +  "abc",
> +  "xy",
> +  ";z",
> +  " ;gh",
> +  0,
> +
>    0 /* Test done marker, don't remove. */
>  };
>  
> -- 
> 2.33.0

  reply	other threads:[~2021-09-25 12:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11  6:47 Hu Jialun
2021-09-25 12:58 ` Hu Jialun [this message]
2021-10-05 16:15   ` *PING* " Hans-Peter Nilsson
2021-10-07  0:01     ` Jeff Law

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=20210925125823.33378-1-hujialun@comp.nus.edu.sg \
    --to=hujialun@comp.nus.edu.sg \
    --cc=gcc-patches@gcc.gnu.org \
    /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).