public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/107960] New: opt-gather.awk seems to ignore lines lines that start with whitespace
Date: Sun, 04 Dec 2022 01:02:41 +0000	[thread overview]
Message-ID: <bug-107960-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107960

            Bug ID: 107960
           Summary: opt-gather.awk seems to ignore lines lines that start
                    with whitespace
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: documentation
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

echo -e "aaa\n a\n  a\na" | awk -f opt-gather.awk > t.txt

and then look at the result of t.txt and notice that only aaa^\a is in the
file.

No error message happens either.

The code in the old opts.sh (which is still the awk script) was broken too.


The problem is here:
/^[ \t]*(;|$)/  { flag = 0; next }
/^[^ \t]/       { if (flag == 0) {

Notice how that the pattern is matching all lines that don't start with white
space.

Also notice how a comment is considered a record seperator too. 

Neither of this is documented either.

The documentation for comments is:
Comments may appear on their own line anywhere within the file and are preceded
by semicolons. 

Which to mean it in the middle of a record but the code does not allow that.
Have the ability of the "white space" in the front being a comment inside the
record is a nice feature but I do think it should be documented though.

             reply	other threads:[~2022-12-04  1:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04  1:02 pinskia at gcc dot gnu.org [this message]
2022-12-05 14:26 ` [Bug bootstrap/107960] " marxin at gcc dot gnu.org

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=bug-107960-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).