diff --git a/cobc/ChangeLog b/cobc/ChangeLog index 1116f1d82..ec8b7fc54 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -1028,6 +1028,19 @@ 'memcpy' to speed up the process If size is not known until run time then emit call to cob_init_table +2020-11-20 Simon Sobisch + + * pplex.l (ppinput): fixed processing after "line not terminated" + +2020-11-19 Simon Sobisch + + FR #53 TURN directive and -fno-ec=NAME/-fec=NAME - finish + * cobc.c (turn_ec_for_table): correct handling for EC-ALL + * cobc.c (cobc_turn_ec): handling EC-USER as PENDING + * cobc.c (process_command_line), cobc.h: handle -debug before all the + flags and exception options it sets, allowing to remove its internal + explicit_set flag + 2020-11-18 Ron Norman * codegen.c,typeck.c: Generated code for INITIALIZE computes the actual @@ -1334,6 +1347,13 @@ * cobc.c (compare_prepare): fixed bug #569: stop copying into cmp_line when line length exceeds CB_LINE_LENGTH. +2020-06-30 Simon Sobisch + + FR #53 TURN directive - finished command line variant as -fno-ec/-fec + * cobc.c, flag.def, help.c: renamed -fdisable-ec/-fenable-ec + * cobc.c: removed the need to use EC- prefix in the name for -f[no-]ec + * flag.def, help.c: fixed some help output + 2020-06-30 Edward Hart * typeck.c (validate_move): refactored. @@ -1381,14 +1401,15 @@ 2020-06-23 Edward Hart FR #53 TURN directive - * cobc.c, cobc.h: completed initial implementation on disabling ECs. + * cobc.c, cobc.h: completed initial implementation on disabling ECs + on command line with -fdisable-ec=NAME -fenable-ec=NAME * cobc.c, cobc.h, parser.y, ppparse.y, scanner.l: completed initial - implementation of >>TURN. + implementation of >>TURN 2020-06-22 Simon Sobisch * cobc.c, cobc.h, flag.def, ppparse.y: draft work on >>TURN and - disabling exceptions (FR #53). + disabling exceptions (FR #53) 2020-06-22 Simon Sobisch diff --git a/cobc/cobc.c b/cobc/cobc.c index a57bc1170..9673c6a49 100644 --- a/cobc/cobc.c +++ b/cobc/cobc.c @@ -161,10 +161,6 @@ struct list_files *cb_current_file = NULL; struct cob_time current_compile_time = { 0 }; struct tm current_compile_tm = { 0 }; -#if 0 /* RXWRXW - source format */ -char *source_name = NULL; -#endif - enum cb_format cb_source_format = CB_FORMAT_FIXED; #if 0 /* ancient OSVS registers that need special runtime handling - low priority */ enum cb_current_date current_date = CB_DATE_MDY; @@ -1517,32 +1513,25 @@ turn_ec_for_table (struct cb_exception *table, const size_t table_len, { size_t i; - if (ec.code & 0x00FF) { - /* Set individual level-1 EC */ + if (ec.code == CB_EXCEPTION_CODE (COB_EC_ALL)) { + /* EC-ALL - level-1 EC to set all ECs */ for (i = 0; i < table_len; ++i) { - if (table[i].code == ec.code) { - table[i].enable = to_on_off; - table[i].explicit_enable_val = 1; - break; - } + table[i].enable = to_on_off; } - } else if (ec.code != 0) { - /* - Simon: ToDo: Group activation; check occurences of - EC-generation - */ + } else if ((ec.code & 0x00FF) == 0) { /* Set all ECs subordinate to level-2 EC */ for (i = 0; i < table_len; ++i) { if ((table[i].code & 0xFF00) == ec.code) { table[i].enable = to_on_off; - table[i].explicit_enable_val = 1; } } } else { - /* EC-ALL; set all ECs */ + /* Set individual level-3 EC */ for (i = 0; i < table_len; ++i) { - table[i].enable = to_on_off; - table[i].explicit_enable_val = 1; + if (table[i].code == ec.code) { + table[i].enable = to_on_off; + break; + } } } } @@ -1615,11 +1604,6 @@ ec_duped (struct cb_text_list *ec_list, struct cb_text_list *ec, return 0; } -/* - Simon: ToDo: Move save/restore of activated exceptions before - preparse; after C generation A dynamic save (only if changed) - and restore (only if set) would be nice -*/ unsigned int cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree loc) { @@ -1638,6 +1622,15 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l for (i = 0; i < len; ++i) { upme[i] = cb_toupper (upme[i]); } + + /* User specified exception (always nonfatal, compared by name) */ + if (!strncmp (ec->text, "EC-USER", 7)) { + /* TODO: EC-USER[NAME] not supported yet, maybe addd as table + of strings or hash into the generated program */ + CB_PENDING ("EC-USER"); + return 1; + } + /* extract exception code via text comparison */ ec_idx = 0; for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) { @@ -1648,7 +1641,6 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l } /* Error if not a known exception name */ - /* TO-DO: What about EC-USER? */ if (ec_idx == 0) { cb_error_x (loc, _("invalid exception-name: %s"), ec->text); @@ -1659,7 +1651,7 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l return 1; } - if (!strncmp(CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) { + if (!strncmp (CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) { if (turn_ec_io (cb_exception_table[ec_idx], to_on_off, loc, &ec)) { return 1; @@ -2874,7 +2866,8 @@ process_command_line (const int argc, char **argv) } #endif - /* First run of getopt: handle std/conf and all listing options + /* First run of getopt: handle std/conf and all listing options, along + with grouping options that should not override other entries (as --debug) We need to postpone single configuration flags as we need a full configuration to be loaded before */ cob_optind = 1; @@ -3106,6 +3099,13 @@ process_command_line (const int argc, char **argv) cobc_early_exit (EXIT_FAILURE); } + /* debug: Turn on all exception conditions */ + if (cobc_wants_debug) { + for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) { + CB_EXCEPTION_ENABLE (i) = 1; + } + } + /* dump implies extra information (may still be disabled later) */ if (cb_flag_dump != COB_DUMP_NONE) { cb_flag_source_location = 1; @@ -3837,6 +3837,13 @@ process_command_line (const int argc, char **argv) cobc_main_free (output_name_buff); } + /* debug: Turn on all exception conditions + -> drop note about this after hanling exit_option and general problems */ + if (cobc_wants_debug && verbose_output > 1) { + fputs (_ ("all runtime checks are enabled"), stderr); + fputc ('\n', stderr); + } + /* Set relaxed syntax configuration options if requested */ /* part 1: relaxed syntax compiler configuration option */ if (cb_relaxed_syntax_checks) { @@ -3941,19 +3948,6 @@ process_command_line (const int argc, char **argv) } #endif - /* debug: Turn on all exception conditions */ - if (cobc_wants_debug) { - for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) { - if (!CB_EXCEPTION_EXPLICIT (i)) { - CB_EXCEPTION_ENABLE (i) = 1; - } - } - if (verbose_output > 1) { - fputs (_("all runtime checks are enabled"), stderr); - fputc ('\n', stderr); - } - } - /* If C debug, do not strip output */ if (cb_source_debugging) { strip_output = 0; diff --git a/cobc/pplex.l b/cobc/pplex.l index c635dd779..c478b4ff5 100644 --- a/cobc/pplex.l +++ b/cobc/pplex.l @@ -1746,20 +1746,22 @@ start: if (cb_source_format == CB_FORMAT_FREE) { if (line_overflow == 0) { cb_plex_warning (cb_missing_newline, newline_count + 1, - _("line not terminated by a newline")); + _("line not terminated by a newline")); + n++; } else if (line_overflow == 2) { cb_plex_warning (COBC_WARN_FILLER, newline_count + 1, - _("source text exceeds %d bytes, will be truncated"), - PPLEX_BUFF_LEN); + _("source text exceeds %d bytes, will be truncated"), + PPLEX_BUFF_LEN); } } else { if (line_overflow == 0) { cb_plex_warning (cb_missing_newline, newline_count, - _("line not terminated by a newline")); + _("line not terminated by a newline")); + n++; } else if (line_overflow == 2) { cb_plex_warning (COBC_WARN_FILLER, newline_count, - _("source text exceeds %d bytes, will be truncated"), - PPLEX_BUFF_LEN); + _("source text exceeds %d bytes, will be truncated"), + PPLEX_BUFF_LEN); } } buff[n++] = '\n'; diff --git a/libcob/ChangeLog b/libcob/ChangeLog index 853741f5d..ba0e42a0a 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -1307,6 +1307,11 @@ * fextfh.c (copy_file_to_fcd): use cob_cache_malloc instead of cob_strdup * fsqlxfd.c: if count_components > 1 then its a composite key +2020-11-20 Simon Sobisch + + * common.c (cob_stack_trace_internal): early exit if no data available + * common.c (cob_check_version): test for minimal version 2.2 + 2020-11-18 Simon Sobisch * common.c (cob_init): skip initialization again if already done as diff --git a/libcob/common.c b/libcob/common.c index 62f11cb27..695839039 100644 --- a/libcob/common.c +++ b/libcob/common.c @@ -3520,9 +3520,7 @@ cob_check_version (const char *prog, app.point = 0; lib.major = 9; lib.minor = 9; - lib.point = 9; - - /* note: to be tested with direct C call */ + lib.point = 0; nparts = sscanf (PACKAGE_VERSION, "%d.%d.%d", &lib.major, &lib.minor, &lib.point); @@ -3536,8 +3534,12 @@ cob_check_version (const char *prog, if (app.version == lib.version && patchlev_prog <= PATCH_LEVEL) return; - if (app.version < lib.version) - return; + if (app.version < lib.version) { + struct ver_t minimal = { 4, 0 }; + if (app.version >= version_bitstring (minimal)) { + return; + } + } } /* TODO: when CALLed - raise exception so program can go ON EXCEPTION */ @@ -10015,6 +10017,14 @@ cob_stack_trace (void *target) static void flush_target (FILE *target) { + /* exit early in the case of no module loaded at all, + possible to happen for example when aborted from cob_check_version of first module */ + if (!COB_MODULE_PTR + || ( COB_MODULE_PTR->module_stmt == 0 + && COB_MODULE_PTR->next == NULL)) { + return; + } + if (target == stderr || target == stdout) { fflush (stdout); diff --git a/tests/ChangeLog b/tests/ChangeLog index 35225c826..feb35cba8 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -108,10 +108,9 @@ 2020-11-20 Simon Sobisch - * general: pass AWK, GREP, SED to the testsuite + * general: pass AWK, GREP, SED to the testsuite and use those * atlocal.in, atlocal_valgrind, atlocal_win: remove temporary file info.out after use - * listings-sed.sh: replace both 2 and 3-part version numbers 2020-11-12 Simon Sobisch diff --git a/tests/testsuite.src/configuration.at b/tests/testsuite.src/configuration.at index 4c7618a46..c6a67c697 100644 --- a/tests/testsuite.src/configuration.at +++ b/tests/testsuite.src/configuration.at @@ -551,9 +551,9 @@ AT_CHECK([$COBCRUN --runtime-conf], [0], ignore, []) # use tr to remove newlines and spaces as the path likely is split # into two lines AT_CHECK([$COBCRUN --runtime-conf | tr -d '\n ' | \ -grep "runtime_empty.cfg"], [0], ignore, []) +$GREP "runtime_empty.cfg"], [0], ignore, []) AT_CHECK([COB_RUNTIME_CONFIG="" $COBCRUN --runtime-conf | tr -d '\n ' \ -| grep "runtime.cfg"], +| $GREP "runtime.cfg"], [0], ignore, []) AT_CLEANUP @@ -577,23 +577,23 @@ setenv COB_PHYSICAL_CANCEL=true # verify that default for physical cancel is still "no" AT_CHECK([$COBCRUN --runtime-conf | \ -grep "COB_PHYSICAL_CANCEL" | grep "no" | grep "default"], [0], ignore, []) +$GREP "COB_PHYSICAL_CANCEL" | $GREP "no" | $GREP "default"], [0], ignore, []) # verify that override via -c works and if include works AT_CHECK([$COBCRUN -c test2.cfg --runtime-conf | \ -grep "physical_cancel" | grep "yes"], [0], ignore, []) +$GREP "physical_cancel" | $GREP "yes"], [0], ignore, []) AT_CHECK([$COBCRUN -c test.cfg --runtime-conf | \ -grep "physical_cancel" | grep "yes"], [0], ignore, []) +$GREP "physical_cancel" | $GREP "yes"], [0], ignore, []) AT_CHECK([$COBCRUN -c test3.cfg --runtime-conf | \ -grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, []) +$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, []) # verify that that long option works AT_CHECK([$COBCRUN --config=test3.cfg --runtime-conf | \ -grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, []) +$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, []) # verify that that environment setting works AT_CHECK([COB_RUNTIME_CONFIG=test3.cfg $COBCRUN --runtime-conf | \ -grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, []) +$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, []) # verify that configuration file loading with full path works AT_CHECK([$COBCRUN -c "$(_return_path "$(pwd)/test.cfg")" --runtime-conf], @@ -639,7 +639,7 @@ physical_cancel true ]) AT_CHECK([COB_PHYSICAL_CANCEL=false $COBCRUN -c test.cfg --runtime-conf | \ -grep "COB_PHYSICAL_CANCEL" | grep "no"], [0], ignore, []) +$GREP "COB_PHYSICAL_CANCEL" | $GREP "no"], [0], ignore, []) AT_CLEANUP @@ -774,9 +774,9 @@ AT_CHECK([unset greet name ; \ TESTME="this is a test" \ COB_EXIT_MSG='${greet:Bye} ${name:-user}, ${TESTME}' \ $COBCRUN --runtime-conf | \ -grep "COB_EXIT_MSG" | grep "Bye user, this is a test"], [0], ignore, []) +$GREP "COB_EXIT_MSG" | $GREP "Bye user, this is a test"], [0], ignore, []) AT_CHECK([$COBCRUN --runtime-conf | \ -grep "COB_EXIT_MSG" | grep "end of program, please press a key to exit"], [0], ignore, []) +$GREP "COB_EXIT_MSG" | $GREP "end of program, please press a key to exit"], [0], ignore, []) AT_CLEANUP diff --git a/tests/testsuite.src/run_file.at b/tests/testsuite.src/run_file.at index c961303f5..153ac32d3 100644 --- a/tests/testsuite.src/run_file.at +++ b/tests/testsuite.src/run_file.at @@ -14202,9 +14202,9 @@ Program-Id: prog # hack for not checking Status 02 as this isn't returned by all # ISAM implementations -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ reference > references], [0], [], []) -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ -e 's/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 05"'/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 00"'/g' \ trace.txt > traces.txt], [0], [], []) @@ -15790,10 +15790,10 @@ Program-Id: prog # hack for not checking Status 02 as this isn't returned by all # ISAM implementations -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ -e 's/_$//g' \ reference > references], [0], [], []) -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ -e 's/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 05"'/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 00"'/g' \ trace.txt > traces.txt], [0], [], []) @@ -16852,10 +16852,10 @@ AT_DATA([reference], # hack for not checking Status 02 as this isn't returned by all # ISAM implementations; meve trailing line helper along -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ -e 's/_$//g' \ reference > references], [0], [], []) -AT_CHECK([sed -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ +AT_CHECK([$SED -e 's/WRITE TSPFILE Status: 02/WRITE TSPFILE Status: 00/g' \ -e 's/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 05"'/'"OPEN OUTPUT TSPFILE -> 'testisam' Status: 00"'/g' \ trace.txt > traces.txt], [0], [], []) diff --git a/tests/testsuite.src/run_misc.at b/tests/testsuite.src/run_misc.at index 8910a5aa6..eb24118ea 100644 --- a/tests/testsuite.src/run_misc.at +++ b/tests/testsuite.src/run_misc.at @@ -12361,7 +12361,7 @@ AT_CHECK([diff reference prt.log], [0], [], [], # Previous test "failed" --> check if EOL of PIPE is the issue -AT_CHECK([sed -e 's/PIPE.\r/PIPE./g' prt.log > prt2.log], [0], [], []) +AT_CHECK([$SED -e 's/PIPE.\r/PIPE./g' prt.log > prt2.log], [0], [], []) AT_CHECK([diff reference prt2.log], [0], [], []) ) @@ -17364,7 +17364,9 @@ AT_DATA([prog3.cob], [ PROCEDURE DIVISION. IF MYTAB(VAR:VAR2) - = MYTAB(VAR2:VAR) + *> = MYTAB(VAR2:VAR) that _should_ work but on x86_64 + *> the second line is evaluated first + = MYTAB(VAR:VAR ) DISPLAY 'WRONG RESULT REFMOD'. GOBACK. @@ -17373,7 +17375,112 @@ AT_CHECK([$COBC -x prog3.cob], [0], [], []) AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) AT_CHECK([$COBC -x --debug -o prog3b prog3.cob], [0], [], []) AT_CHECK([$COBCRUN_DIRECT ./prog3b], [1], [], -[libcob: prog3.cob:20: error: offset of 'mytab' out of bounds: 99, maximum: 52 +[libcob: prog3.cob:20: error: length of 'mytab' out of bounds: 99, maximum: 52 ]) AT_CLEANUP + + +AT_SETUP([libcob version check]) +AT_KEYWORDS([runmisc]) + +# using a C program here, normally this would be called from old or newer modules +AT_DATA([prog.c], [[ +#include +#include + +#define COUNT_OF(x) (sizeof(x)/sizeof(x[0])) + +struct verify_t { + char *prog, *packver_prog; + int patchlev_prog; +} verify[] = { +#include "testdata.h" +}; + +int +main(int argc, char *argv[]) +{ + struct verify_t *p; + for( p=verify; p < verify + COUNT_OF(verify); p++ ) { + cob_check_version(p->prog, p->packver_prog, p->patchlev_prog); + } + return 0; +} +]]) + +# good cases +AT_DATA([testdata.h], [[ +#define TST_STRINGIFY(s) #s +#define TST_XSTRINGIFY(s) TST_STRINGIFY (s) + { "test40", "4.0", 0 }, +/* { "TestMatch1", + TST_XSTRINGIFY (__LIBCOB_VERSION) "." + TST_XSTRINGIFY (__LIBCOB_VERSION_MINOR) "." + TST_XSTRINGIFY (__LIBCOB_VERSION_PATCHLEVEL), + 0}, */ + { "TestMatch2", + TST_XSTRINGIFY (__LIBCOB_VERSION) "." + TST_XSTRINGIFY (__LIBCOB_VERSION_MINOR) "." + "0", + 0}, + { "TestMatch3", + TST_XSTRINGIFY (__LIBCOB_VERSION) "." + TST_XSTRINGIFY (__LIBCOB_VERSION_MINOR), + 0 } +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_DATA([testdata.h], [[ + { "TooSmall1", "1.1", 0 } +]]) +AT_CHECK([$COMPILE -o small1 prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./small1 2>small1.log], [1], [], []) +AT_CHECK([$GREP -v "libcob has" small1.log], [0], +[libcob: error: version mismatch +note: TooSmall1 has version 1.1.0 +], []) + +AT_DATA([testdata.h], [[ + { "TooSmall2", "2.0", 0 } +]]) +AT_CHECK([$COMPILE -o small2 prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./small2 2>small2.log], [1], [], []) +AT_CHECK([$GREP -v "libcob has" small2.log], [0], +[libcob: error: version mismatch +note: TooSmall2 has version 2.0.0 +], []) + +AT_DATA([testdata.h], [[ + { "TooSmall3", "3.2", 0 }, +]]) +AT_CHECK([$COMPILE -o small3 prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./small3 2>small3.log], [1], [], []) +AT_CHECK([$GREP -v "libcob has" small3.log], [0], +[libcob: error: version mismatch +note: TooSmall3 has version 3.2.0 +], []) + +AT_DATA([testdata.h], [[ + { "TooHigh2", "4.1", 0 } +]]) +AT_CHECK([$COMPILE -o high2 prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./high2 2>high2.log], [1], [], []) +AT_CHECK([$GREP -v "libcob has" high2.log], [0], +[libcob: error: version mismatch +note: TooHigh2 has version 4.1.0 +], []) + +AT_DATA([testdata.h], [[ + { "TooHigh3", "4.0.1", 2 } +]]) +AT_CHECK([$COMPILE -o high3 prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./high3 2>high3.log], [1], [], []) +AT_CHECK([$GREP -v "libcob has" high3.log], [0], +[libcob: error: version mismatch +note: TooHigh3 has version 4.0.1.2 +], []) + +AT_CLEANUP diff --git a/tests/testsuite.src/syn_misc.at b/tests/testsuite.src/syn_misc.at index 4ecd42ceb..c07ef640e 100644 --- a/tests/testsuite.src/syn_misc.at +++ b/tests/testsuite.src/syn_misc.at @@ -1768,14 +1768,14 @@ AT_CHECK([$COMPILE_ONLY -Wextra prog.cob], [0], [], AT_CLEANUP -AT_SETUP([line overflow in Fixed-form / Free-form]) +AT_SETUP([line overflow in fixed-form / free-form]) AT_KEYWORDS([misc]) # We're testing trailing tabs and whitespace (should not lead to warning) # along with comments after boundaries (col 72 / col 512) -# AT_DATA removes trailing spaces, workaround: add "_" and -# remove it later via sed +# remark: some editors remove trailing spaces, the workaround: add "_" and +# remove it later via sed; AT_DATA would not do that when using double [[ ]] AT_DATA([prog_tmpl.cob], [ IDENTIFICATION DIVISION. @@ -1793,23 +1793,23 @@ AT_DATA([prog_tmpl.cob], [ ]) # AT_DATA workaround via sed: -AT_CHECK([sed -e 's/_$//' prog_tmpl.cob > prog.cob], [0], [], []) +AT_CHECK([$SED -e 's/_$//' prog_tmpl.cob > prog.cob], [0], [], []) -AT_CHECK([$COMPILE_ONLY -fixed -Wextra prog.cob], [0], [], -[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated -prog.cob:8: warning: source text exceeds 512 bytes, will be truncated -prog.cob:11: warning: source text after program-text area (column 72) +AT_CHECK([$COBC -fsyntax-only -fixed -Wextra prog.cob], [0], [], +[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] +prog.cob:8: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] +prog.cob:11: warning: source text after program-text area (column 72) [[-Wdangling-text]] ]) -AT_CHECK([$COMPILE_ONLY -free -Wextra prog.cob], [1], [], -[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated -prog.cob:8: warning: source text exceeds 512 bytes, will be truncated +AT_CHECK([$COBC -fsyntax-only -free -Wextra prog.cob], [1], [], +[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] +prog.cob:8: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] prog.cob:8: error: unknown statement 'This' ]) -AT_CHECK([$COMPILE_ONLY -F -Wextra prog.cob], [1], [], -[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated -prog.cob:8: warning: source text exceeds 512 bytes, will be truncated +AT_CHECK([$COBC -fsyntax-only -F -Wextra prog.cob], [1], [], +[prog.cob:7: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] +prog.cob:8: warning: source text exceeds 512 bytes, will be truncated [[-Wothers]] prog.cob:8: error: unknown statement 'This' ]) @@ -1835,19 +1835,17 @@ AT_CHECK([$COMPILE_ONLY prog.cob], [1], [], # fixing the initial setup but now producing a missing newline: printf " CONTINUE." >> prog.cob -AT_CHECK([$COBC -fsyntax-only -Wextra -fixed prog.cob], [1], [], +AT_CHECK([$COBC -fsyntax-only -Wextra -fixed prog.cob], [0], [], [prog.cob:8: warning: line not terminated by a newline [[-Wmissing-newline]] -prog.cob:9: error: syntax error, unexpected end of file ]) -AT_CHECK([$COBC -fsyntax-only -Wextra -free prog.cob], [1], [], +AT_CHECK([$COBC -fsyntax-only -Wextra -free prog.cob], [0], [], [prog.cob:8: warning: line not terminated by a newline [[-Wmissing-newline]] -prog.cob:9: error: syntax error, unexpected end of file ]) -# not yet merged to trunk: + # should not happen if the data only consists of space characters -#printf "\n \t " >> prog.cob -# -#AT_CHECK([$COMPILE_ONLY -Wextra prog.cob], [0], [], []) +printf "\n \t " >> prog.cob + +AT_CHECK([$COMPILE_ONLY -Wextra prog.cob], [0], [], []) AT_CLEANUP diff --git a/tests/testsuite.src/syn_occurs.at b/tests/testsuite.src/syn_occurs.at index 6b1b81949..c27aebc52 100644 --- a/tests/testsuite.src/syn_occurs.at +++ b/tests/testsuite.src/syn_occurs.at @@ -463,7 +463,7 @@ AT_DATA([prog.cob], [ # all entries may raise this error but only the last error message is guaranteed. AT_CHECK([$COMPILE_ONLY prog.cob], [1], [], ignore) AT_CHECK([$COMPILE_ONLY prog.cob 2>&1 | \ -grep "prog.cob:11: error: numeric literal '9223372036854775808' exceeds limit"], +$GREP "prog.cob:11: error: numeric literal '9223372036854775808' exceeds limit"], [0], ignore, []) AT_CLEANUP