Skip to content

Commit

Permalink
Merge SVN 4635
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 19, 2024
1 parent a0d480f commit cf13318
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@
* codegen.c: removed check for "has condition a reference" or disabled
this within [COB_TREE_DEBUG]

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

* config.def, parser.y: allow DEPENDING clause in RECORD CONTAINS

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

* codegen.c: if verb changes then emit trace/debug code, too
Expand Down
2 changes: 2 additions & 0 deletions cobc/config.def
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,5 @@ CB_CONFIG_SUPPORT (cb_vsam_status, "vsam-status",
CB_CONFIG_SUPPORT (cb_self_call_recursive, "self-call-recursive",
_("CALL to own PROGRAM-ID implies RECURSIVE attribute"))

CB_CONFIG_SUPPORT (cb_record_contains_depending_clause, "record-contains-depending-clause",
_("DEPENDING clause in RECORD CONTAINS"))
14 changes: 10 additions & 4 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -6232,29 +6232,35 @@ record_clause:
}
}
| RECORD _contains integer TO integer _characters
_record_depending /* GCOS extension */
{
check_repeated ("RECORD", SYN_CLAUSE_4, &check_duplicate);
if (current_file->organization == COB_ORG_LINE_SEQUENTIAL) {
cb_warning (cb_warn_additional, _("RECORD clause ignored for LINE SEQUENTIAL"));
} else {
set_record_size ($3, $5);
if ($7) {
cb_verify (cb_record_contains_depending_clause, "RECORD CONTAINS DEPENDING");
current_file->record_depending = $7;
current_file->flag_check_record_varying_limits =
current_file->record_min == 0 || current_file->record_max == 0;
}
}
}
| RECORD _is VARYING _in _size _from_integer _to_integer _characters
_record_depending
{
check_repeated ("RECORD", SYN_CLAUSE_4, &check_duplicate);
set_record_size ($6, $7);
current_file->record_depending = $9;
current_file->flag_check_record_varying_limits =
current_file->record_min == 0 || current_file->record_max == 0;
}
;

_record_depending:
| DEPENDING _on reference
{
current_file->record_depending = $3;
}
/* empty */ { $$ = NULL; }
| DEPENDING _on reference { $$ = $3; }
;

_from_integer:
Expand Down
5 changes: 5 additions & 0 deletions config/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
the support of the STOP ERROR statement


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

* general: add a record-contains-depending-clause option to allow
configuring the support of the DEPENDING clause in RECORD CONTAINS

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 @@ -276,6 +276,7 @@ assign-ext-dyn: ok
assign-disk-from: unconformable
vsam-status: ignore
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 4
align-opt: no
defaultbyte: 32
Expand Down
1 change: 1 addition & 0 deletions config/bs2000-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: ok
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 8
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/cobol2002.conf
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: unconformable
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 0
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/cobol2014.conf
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: unconformable
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 0
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/cobol85.conf
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: unconformable
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 0
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ self-call-recursive: skip
align-record: 0
align-opt: no
defaultbyte: ignore
record-contains-depending-clause: unconformable

# use complete word list; synonyms and exceptions are specified below
reserved-words: default
Expand Down
1 change: 1 addition & 0 deletions config/gcos-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: unconformable
self-call-recursive: skip
record-contains-depending-clause: obsolete
align-record: 0 # TODO: verify
align-opt: no # TODO: verify
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/ibm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: ok
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 8
align-opt: yes
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/mf-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ assign-ext-dyn: ok
assign-disk-from: ok
vsam-status: ok
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 8
align-opt: yes
defaultbyte: 32
Expand Down
1 change: 1 addition & 0 deletions config/mvs-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: ok
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 8
align-opt: yes
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/realia-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: ok
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 0
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/rm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ assign-ext-dyn: unconformable
assign-disk-from: unconformable
vsam-status: unconformable
self-call-recursive: skip
record-contains-depending-clause: unconformable
align-record: 4
align-opt: no
defaultbyte: ignore
Expand Down
1 change: 1 addition & 0 deletions config/xopen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ align-record: 0
align-opt: no
defaultbyte: ignore
self-call-recursive: skip
record-contains-depending-clause: obsolete

# obsolete in COBOL85 and currently not available as dialect features:
# 1: All literal with numeric or numeric edited item
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 @@ -538,6 +538,7 @@ test.conf: missing definitions:
no definition of 'assign-disk-from'
no definition of 'vsam-status'
no definition of 'self-call-recursive'
no definition of 'record-contains-depending-clause'
])

AT_CLEANUP
Expand Down
28 changes: 28 additions & 0 deletions tests/testsuite.src/syn_file.at
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,27 @@ AT_DATA([prog.cob], [
STOP RUN.
])

AT_DATA([prog2.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT TEST-FILE ASSIGN TO 'FILE-TEST'
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD TEST-FILE
RECORD CONTAINS 12 TO 125 CHARACTERS
DEPENDING ON RECORDSIZE.
01 TEST-REC.
05 FILLER PIC X(40).
PROCEDURE DIVISION.
OPEN INPUT TEST-FILE.
CLOSE TEST-FILE.
STOP RUN.
])

# FIXME: the check misses "prog.cob:40: error: RECORD DEPENDING item must be unsigned numeric"
AT_CHECK([$COMPILE_ONLY prog.cob], [1], [],
[prog.cob:20: error: 'RECORDSIZE' is not defined
Expand All @@ -875,6 +896,13 @@ prog.cob:26: error: RECORD DEPENDING must reference a data-item
prog.cob:34: warning: RECORD DEPENDING item 'RECORDSIZE3' should be defined in WORKING-STORAGE, LOCAL-STORAGE or LINKAGE SECTION
prog.cob:40: warning: RECORD DEPENDING item 'RECORDSIZE4' should be defined in WORKING-STORAGE, LOCAL-STORAGE or LINKAGE SECTION
])
AT_CHECK([$COMPILE_ONLY -frecord-contains-depending-clause=error prog2.cob], [1], [],
[prog2.cob:13: error: RECORD CONTAINS DEPENDING used
prog2.cob:13: error: 'RECORDSIZE' is not defined
])
AT_CHECK([$COMPILE_ONLY -frecord-contains-depending-clause=ok prog2.cob], [1], [],
[prog2.cob:13: error: 'RECORDSIZE' is not defined
])

AT_CLEANUP

Expand Down

0 comments on commit cf13318

Please sign in to comment.