From 2ecaa3207c26917a60bb2f065e66963fd8f3de7d Mon Sep 17 00:00:00 2001 From: David Declerck Date: Fri, 12 Jul 2024 16:19:12 +0200 Subject: [PATCH] Merge SVN 4722 --- cobc/ChangeLog | 2 ++ cobc/pplex.l | 4 ++++ tests/testsuite.src/syn_definition.at | 29 ++++++++++++++++++++++++++- tests/testsuite.src/syn_misc.at | 24 +++++++++++++--------- 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/cobc/ChangeLog b/cobc/ChangeLog index 6accb5b10..c32ed1846 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -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 diff --git a/cobc/pplex.l b/cobc/pplex.l index ce5662f66..70caa5ec8 100644 --- a/cobc/pplex.l +++ b/cobc/pplex.l @@ -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 diff --git a/tests/testsuite.src/syn_definition.at b/tests/testsuite.src/syn_definition.at index 49d8baadb..71030f923 100644 --- a/tests/testsuite.src/syn_definition.at +++ b/tests/testsuite.src/syn_definition.at @@ -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. @@ -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]) diff --git a/tests/testsuite.src/syn_misc.at b/tests/testsuite.src/syn_misc.at index c5cd4a186..c2c08d35c 100644 --- a/tests/testsuite.src/syn_misc.at +++ b/tests/testsuite.src/syn_misc.at @@ -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 @@ -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], [], []) @@ -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], [], @@ -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