Skip to content

Commit

Permalink
Merge SVN 4628
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 19, 2024
1 parent 3d1bee8 commit 867c805
Show file tree
Hide file tree
Showing 24 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@
* tree.c (cb_init_parse_constants), tree.h, cobc.c: renamed
from cb_init_constants

2022-03-11 Fabrice Le Fessant <[email protected]>

* config.def, parser.y: add support for the STOP ERROR statement

2022-03-10 Simon Sobisch <[email protected]>

* pplex.l (next_word_is_comment_paragraph_name): extracted from (ppinput)
Expand Down
3 changes: 3 additions & 0 deletions cobc/config.def
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ CB_CONFIG_SUPPORT (cb_stop_literal_statement, "stop-literal-statement",
CB_CONFIG_SUPPORT (cb_stop_identifier_statement, "stop-identifier-statement",
_("STOP-identifier statement"))

CB_CONFIG_SUPPORT (cb_stop_error_statement, "stop-error-statement",
_("STOP ERROR statement"))

CB_CONFIG_SUPPORT (cb_debugging_mode, "debugging-mode",
_("DEBUGGING MODE and debugging indicator"))

Expand Down
7 changes: 7 additions & 0 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -15812,6 +15812,13 @@ stop_statement:
check_unreached = 1;
cobc_cs_check = 0;
}
| STOP ERROR /* GCOS */
{
begin_statement (STMT_STOP_ERROR, 0);
cb_verify (cb_stop_error_statement, cb_statement_name[STMT_STOP_ERROR]);
cb_emit_stop_error ();
check_unreached = 1;
}
| STOP stop_argument
{
begin_statement (STMT_STOP, 0);
Expand Down
2 changes: 2 additions & 0 deletions cobc/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2430,6 +2430,8 @@ extern void cb_emit_start (cb_tree, cb_tree, cb_tree, cb_tree);

extern void cb_emit_stop_run (cb_tree);

extern void cb_emit_stop_error (void);

extern void cb_emit_stop_thread (cb_tree);

extern void cb_emit_string (cb_tree, cb_tree, cb_tree);
Expand Down
6 changes: 6 additions & 0 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -13791,6 +13791,12 @@ cb_emit_stop_run (cb_tree x)
cb_emit (CB_BUILD_FUNCALL_1 ("cob_stop_run", cb_build_cast_int (x)));
}

void
cb_emit_stop_error (void)
{
cb_emit (CB_BUILD_FUNCALL_0 ("cob_stop_error"));
}

void
cb_emit_stop_thread (cb_tree handle)
{
Expand Down
5 changes: 5 additions & 0 deletions config/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

* general: add 'defaultbyte'

2022-03-11 Fabrice Le Fessant <[email protected]>

* general: add a stop-error-statement option to allow configuring
the support of the STOP ERROR statement

2022-02-07 David Declerck <[email protected]>

* gcos-strict.conf, gcos.conf, gcos.words: added config files for
Expand Down
1 change: 1 addition & 0 deletions config/acu-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ padding-character-clause: obsolete # not verified yet
section-segments: ignore # not verified yet
stop-literal-statement: obsolete # not verified yet
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/bs2000-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ padding-character-clause: ignore
section-segments: obsolete
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable # TYPEDEF is reserved but unused
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/cobol2002.conf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ padding-character-clause: obsolete
section-segments: unconformable
stop-literal-statement: unconformable
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: ok
type-to-clause: ok
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/cobol2014.conf
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ padding-character-clause: unconformable
section-segments: unconformable
stop-literal-statement: unconformable
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: ok
type-to-clause: ok
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/cobol85.conf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ padding-character-clause: ok
section-segments: obsolete
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ occurs-max-length-without-subscript: no
section-segments: ignore
stop-literal-statement: obsolete
stop-identifier-statement: obsolete
stop-error-statement: unconformable
same-as-clause: ok
type-to-clause: ok
usage-type: ok
Expand Down
1 change: 1 addition & 0 deletions config/gcos-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ padding-character-clause: ok
section-segments: obsolete
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: ok
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/ibm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ padding-character-clause: obsolete
section-segments: ignore
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/mf-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ padding-character-clause: obsolete
section-segments: ignore
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable # only supports USAGE type-name
usage-type: ok
Expand Down
1 change: 1 addition & 0 deletions config/mvs-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ padding-character-clause: obsolete
section-segments: ignore
stop-literal-statement: obsolete
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/realia-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ padding-character-clause: ignore
section-segments: unconformable
stop-literal-statement: ok
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/rm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ padding-character-clause: ok
section-segments: obsolete
stop-literal-statement: obsolete
stop-identifier-statement: ok
stop-error-statement: unconformable
same-as-clause: ok
type-to-clause: unconformable
usage-type: unconformable
Expand Down
1 change: 1 addition & 0 deletions config/xopen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ section-segments: unconformable # complete module removed
# reportwriter and communication: complete modules removed
stop-literal-statement: warning # should not be used ...
stop-identifier-statement: unconformable
stop-error-statement: unconformable
same-as-clause: unconformable
type-to-clause: unconformable
usage-type: unconformable
Expand Down
4 changes: 4 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@
compiler into directory different that declared
when compiler was built

2022-03-11 Fabrice Le Fessant <[email protected]>

* common.c, common.h: add support for the STOP ERROR statement

2022-02-21 Ron Norman <[email protected]>

* move.c (cob_move_display_to_packed): If P used in PIC adjust data move
Expand Down
7 changes: 7 additions & 0 deletions libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3187,6 +3187,13 @@ handle_core_on_error ()
return core_on_error;
}

void
cob_stop_error (void)
{
cob_runtime_error ("STOP ERROR");
cob_hard_failure ();
}

void
cob_hard_failure ()
{
Expand Down
1 change: 1 addition & 0 deletions libcob/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,7 @@ COB_EXPIMP void cob_module_leave (cob_module *);
COB_EXPIMP void cob_module_free (cob_module **);

DECLNORET COB_EXPIMP void cob_stop_run (const int) COB_A_NORETURN;
DECLNORET COB_EXPIMP void cob_stop_error (void) COB_A_NORETURN;
DECLNORET COB_EXPIMP void cob_fatal_error (const enum cob_fatal_error) COB_A_NORETURN;
DECLNORET COB_EXPIMP void cob_hard_failure_internal (const char *) COB_A_NORETURN;
DECLNORET COB_EXPIMP void cob_hard_failure (void) COB_A_NORETURN;
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite.src/configuration.at
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ test.conf: missing definitions:
no definition of 'goto-statement-without-name'
no definition of 'stop-literal-statement'
no definition of 'stop-identifier-statement'
no definition of 'stop-error-statement'
no definition of 'debugging-mode'
no definition of 'use-for-debugging'
no definition of 'padding-character-clause'
Expand Down
25 changes: 25 additions & 0 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -5273,6 +5273,31 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [1])
AT_CLEANUP


AT_SETUP([STOP ERROR])
AT_KEYWORDS([runmisc])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
PROCEDURE DIVISION.
CALL "prog2".
DISPLAY "Whatever".
STOP RUN.
END PROGRAM prog.
IDENTIFICATION DIVISION.
PROGRAM-ID. prog2.
PROCEDURE DIVISION.
STOP ERROR.
])

AT_CHECK([$COMPILE prog.cob -fstop-error-statement=ok], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [1], [],
[libcob: prog.cob:12: error: STOP ERROR
])

AT_CLEANUP


AT_SETUP([SYMBOLIC clause])
AT_KEYWORDS([runmisc ALPHABET])

Expand Down

0 comments on commit 867c805

Please sign in to comment.