[Bug cobol/126496] New: cobol1: non-documented non-standard directive $END-IF not handled (+ word split issue)

simonsobisch at gnu dot org via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126496

            Bug ID: 126496
           Summary: cobol1: non-documented non-standard directive $END-IF
                    not handled (+ word split issue)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simonsobisch at gnu dot org
  Target Milestone: ---

The supported Micro Focus extension for conditional compilation

$IF something
    continue
$ELSE
    continue
$END

works fine (last time I've checked the -E = preprocessing leaves the
conditional and all code parts in though, I really think it should be dropped
and only the "active" part left in - as it is done with "gcc -E" on any other
language --> if there isn't a bugzilla item for that please crate it)

There is an undocumented variant though, which raises a bad error message


$IF something
    continue
$ELSE
    continue
$END-IF

> error: syntax error, unexpected '-'

In this case the word-splitting (in conditional compilation in general?) is
bad, because the _understandable_ error message would have been

> error: syntax error, unexpected END-IF

or even better

> error: unknown directive "END-IF"
> error: $END missing


Apart from this I suggest to do the same as GnuCOBOL: support the undocumented
variant $END-IF as well (ideally _after_ adjusting the word-split / parsing)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.