Skip to content

Commit

Permalink
Merge SVN 4722
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 12, 2024
1 parent 0f469c6 commit 02d92bc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
2 changes: 2 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@

* typeck.c (cb_build_identifier): fix codegen for odo-check
on level 01 OCCURS items, bug introduced with 2022-07-12
* pplex.l: dropped check for "spurious '$'", fixing bug #839
and acucomment not handling $ correct

2022-09-29 Simon Sobisch <[email protected]>

Expand Down
4 changes: 4 additions & 0 deletions cobc/pplex.l
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,16 @@ MAYBE_AREA_A [ ]?#?
cb_plex_warning (COBC_WARN_FILLER, newline_count - 1,
_("ignoring unknown directive: '%s'"), s);
skip_to_eol ();
/*
}
This test was deemed to produce more issues than it is useful,
see bug #839 and others
^{MAYBE_AREA_A}[ ]*"$" {
cb_plex_warning (COBC_WARN_FILLER, newline_count,
_("spurious '$' detected - ignored"));
skip_to_eol ();
*/
}

%{/* Strip any Area A marker leading to COPY, INCLUDE, and REPLACE right now as
Expand Down
29 changes: 28 additions & 1 deletion tests/testsuite.src/syn_definition.at
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Copyright (C) 2003-2012, 2016-2021 Free Software Foundation, Inc.
## Copyright (C) 2003-2012, 2016-2022 Free Software Foundation, Inc.
## Written by Keisuke Nishida, Roger While, Edward Hart, Simon Sobisch
##
## This file is part of GnuCOBOL.
Expand Down Expand Up @@ -1763,6 +1763,33 @@ prog.cob:8: error: PICTURE clause not compatible with USAGE COMP-3
AT_CLEANUP


AT_SETUP([Edited monetary PICTURE strings])
AT_KEYWORDS([definition])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 DOLLARS.
05 REPORT-LINE.
10 REPORT-ITEMS PIC ZZ,ZZZ,ZZZ,ZZ9-.
10 REPORT-FICA-WAGES PIC
$$$,$$$,$$$,$$$,$$$.99-.
10 REPORT-FICA-TIPS PIC
$$$,$$$,$$$,$$$,$$$.99-.
10 REPORT-TOTAL-COMP PIC
$$$,$$$,$$$,$$$,$$$.99-.
10 REPORT-MEDICARE PIC
$$$,$$$,$$$,$$$,$$$.99-.
05 ACCT-REPORT-TOTAL-LINE PIC XXX.
])

AT_CHECK([$COMPILE_ONLY prog.cob], [0], [], [])
AT_CLEANUP


AT_SETUP([ALPHABET definition])
AT_KEYWORDS([definition])

Expand Down
24 changes: 14 additions & 10 deletions tests/testsuite.src/syn_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
* DISPLAY 'NOCOMMENT' END-DISPLAY
/ DISPLAY 'NOCOMMENTSLASH' END-DISPLAY
$ DISPLAY 'NOCOMMENTDOLLAR' END-DISPLAY
$ DISPLAY 'ACUCOMMENTDOLLAR' END-DISPLAY
* DISPLAY 'NOMFCOMMENTASTERISK' END-DISPLAY
/ DISPLAY 'NOMFCOMMENTSLASH' END-DISPLAY
| DISPLAY 'ACUFLOATING' END-DISPLAY
Expand All @@ -2798,8 +2798,8 @@ prog2.cob:17: error: invalid symbol '|' - skipping word
])

# note: for checking the result we actually either need to run the program
# or change it to string concatenation and raise a constant compile time warning
# we do (historically) the first (for now)
# or change it to string concatenation and raise a constant compile
# time warning we do (historically) the first (for now)
#
AT_CHECK([$COMPILE -fmfcomment prog.cob], [0], [],
[])
Expand Down Expand Up @@ -2840,31 +2840,36 @@ NOFLOATING


AT_CHECK([$COMPILE_ONLY -free prog3.cob], [1], [],
[prog3.cob:11: warning: spurious '$' detected - ignored
prog3.cob:9: error: syntax error, unexpected *
[prog3.cob:9: error: syntax error, unexpected *
prog3.cob:10: error: syntax error, unexpected /
prog3.cob:11: error: invalid symbol '$' - skipping word
prog3.cob:12: error: syntax error, unexpected *
prog3.cob:13: error: syntax error, unexpected /
prog3.cob:14: error: invalid symbol '|' - skipping word
prog3.cob:16: error: syntax error, unexpected Identifier
])
AT_CHECK([$COMPILE_ONLY -free -fmfcomment prog3.cob], [1], [],
[prog3.cob:11: warning: spurious '$' detected - ignored
prog3.cob:9: error: syntax error, unexpected *
[prog3.cob:9: error: syntax error, unexpected *
prog3.cob:10: error: syntax error, unexpected /
prog3.cob:11: error: invalid symbol '$' - skipping word
prog3.cob:12: error: syntax error, unexpected *
prog3.cob:13: error: syntax error, unexpected /
prog3.cob:14: error: invalid symbol '|' - skipping word
prog3.cob:16: error: syntax error, unexpected Identifier
])
AT_CHECK([$COMPILE_ONLY -free -facucomment prog3.cob], [1], [],
[prog3.cob:11: warning: spurious '$' detected - ignored
prog3.cob:9: error: syntax error, unexpected *
[prog3.cob:9: error: syntax error, unexpected *
prog3.cob:10: error: syntax error, unexpected /
prog3.cob:11: error: invalid symbol '$' - skipping word
prog3.cob:12: error: syntax error, unexpected *
prog3.cob:13: error: syntax error, unexpected /
prog3.cob:16: error: syntax error, unexpected Identifier
])
AT_CHECK([$COMPILE_ONLY -fformat=terminal -facucomment prog3.cob], [1], [],
[prog3.cob:9: error: syntax error, unexpected *
prog3.cob:10: error: syntax error, unexpected /
prog3.cob:16: error: syntax error, unexpected Identifier
])
# Check that invalid indicator and doesn't abort preprocessing
# and that errors in preprocessing doesn't abort compilation
AT_CHECK([$COMPILE_ONLY prog3.cob], [1], [],
Expand All @@ -2874,7 +2879,6 @@ prog3.cob:4: error: invalid indicator 'N' at column 7
prog3.cob:5: error: invalid indicator 'U' at column 7
prog3.cob:7: error: invalid indicator 'G' at column 7
prog3.cob:8: error: invalid indicator 'U' at column 7
prog3.cob:11: error: invalid indicator '$' at column 7
prog3.cob:16: error: invalid indicator 'x' at column 7
prog3.cob:6: error: PROGRAM-ID header missing
prog3.cob:6: error: PROCEDURE DIVISION header missing
Expand Down

0 comments on commit 02d92bc

Please sign in to comment.