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 via email to