Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cobc/config.def
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,7 @@ CB_CONFIG_SUPPORT (cb_record_contains_depending_clause, "record-contains-dependi

CB_CONFIG_SUPPORT (cb_picture_l, "picture-l",
_("PICTURE string with 'L' character"))

CB_CONFIG_SUPPORT (cb_odo_redefines, "odo-in-redefines",
_("allow ODO in REDEFINES fields"))

14 changes: 11 additions & 3 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,14 +1417,22 @@ validate_redefines (const struct cb_field * const f)
}

/* Check variable occurrence */
if (f->depending
|| (!f->flag_picture_l && cb_field_variable_size (f))) {
cb_error_x (x, _("'%s' cannot be variable length"), f->name);
if (cb_field_variable_size(f->redefines) || f->depending
&& cb_verify(cb_odo_redefines,
_("OCCURS DEPENDING ON in source or destination of REDEFINES group"))) {
return;
}

if (!f->redefines->flag_picture_l && cb_field_variable_size (f->redefines)) {
cb_error_x (x, _("the original definition '%s' cannot be variable length"),
f->redefines->name);
}

if (f->depending
|| (!f->flag_picture_l && cb_field_variable_size (f))) {
cb_error_x (x, _("'%s' cannot be variable length"), f->name);
}

}

/* Perform group-specific validation of f. */
Expand Down
1 change: 1 addition & 0 deletions config/acu-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: " "
picture-l: unconformable
odo-in-redefines: warning
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the warning is only raised when compiled with "cautions enabled" - so it should be "ok" here (and a possible cobc_acu wrapper will take the necessary -a parameter and translate it which will include -fodo-in-redefines=warning)

... but for larger-redefines it should actually be warning - please adjust that when changing this file


# use fixed word list, synonyms and exceptions specified there
reserved-words: ACU
1 change: 1 addition & 0 deletions config/bs2000-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: 0 # not verified yet, but likely to be as IBM
picture-l: unconformable
odo-in-redefines: unconformable # to be checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked, unconformable


# use fixed word list, synonyms and exceptions specified there
reserved-words: BS2000
1 change: 1 addition & 0 deletions config/cobol2002.conf
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: none # initial storage is undefined
picture-l: unconformable
odo-in-redefines: unconformable

# archaic in COBOL2002 and currently not available as dialect features:
# 1: MOVE of alphanumeric figurative constants to numeric items
Expand Down
1 change: 1 addition & 0 deletions config/cobol2014.conf
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: none # initial storage is undefined
picture-l: unconformable
odo-in-redefines: unconformable

# use fixed word list, synonyms and exceptions specified there
reserved-words: COBOL2014
1 change: 1 addition & 0 deletions config/cobol85.conf
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: none # initial storage is undefined
picture-l: unconformable
odo-in-redefines: unconformable

# 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 config/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ record-contains-depending-clause: unconformable
defaultbyte: init # GC inits as INITIALIZE ALL TO VALUE THEN TO DEFAULT,
# with INDEXED BY variables initialized to 1
picture-l: ok
odo-in-redefines: warning

# 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 @@ -280,6 +280,7 @@ self-call-recursive: skip
record-contains-depending-clause: obsolete
defaultbyte: 0
picture-l: ok
odo-in-redefines: unconformable # to be checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked: unconformable


# use fixed word list, synonyms and exceptions specified there
reserved-words: GCOS
1 change: 1 addition & 0 deletions config/ibm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: 0
picture-l: unconformable
odo-in-redefines: unconformable

# use fixed word list, synonyms and exceptions specified there
reserved-words: IBM
2 changes: 1 addition & 1 deletion config/lax.conf-inc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ assign-ext-dyn: ok
assign-disk-from: ok
vsam-status: +ignore
picture-l: +warning

odo-in-redefines: +warning

# use complete word list
# (vendor specific, currently not supported words are
Expand Down
1 change: 1 addition & 0 deletions config/mf-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: " "
picture-l: unconformable
odo-in-redefines: ok

# use fixed word list, synonyms and exceptions specified there
reserved-words: MF
1 change: 1 addition & 0 deletions config/mvs-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: 0 # not verified yet, but likely to be as IBM
picture-l: unconformable
odo-in-redefines: unconformable

# use fixed word list, synonyms and exceptions specified there
reserved-words: MVS
1 change: 1 addition & 0 deletions config/realia-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: 0 # not verified, but likely like IBM
picture-l: unconformable
odo-in-redefines: unconformable # to be checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't found anything about it in its COBOL Reference Guide [that's in windows HLP format...] it has some rules on OCCURS but doesn't specify anything between that and REDEFINES.

In any case that would be # not verified, but likely like IBM


# use fixed word list, synonyms and exceptions specified there
reserved-words: realia
1 change: 1 addition & 0 deletions config/rm-strict.conf
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ self-call-recursive: skip
record-contains-depending-clause: unconformable
defaultbyte: " " # not verified, but possibly like ACU/MF
picture-l: unconformable
odo-in-redefines: unconformable

# 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 config/xopen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ self-call-recursive: skip
record-contains-depending-clause: obsolete
defaultbyte: none # "not specifically defined in Standard COBOL"
picture-l: unconformable
odo-in-redefines: unconformable # to be checked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xopen is only stricter than cobol85+amendment, so that's unconformable


# 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 'self-call-recursive'
no definition of 'record-contains-depending-clause'
no definition of 'picture-l'
no definition of 'odo-in-redefines'
])

AT_CLEANUP
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite.src/syn_redefines.at
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,8 @@ AT_DATA([prog.cob], [
])

AT_CHECK([$COMPILE_ONLY prog.cob], [1], [],
[prog.cob:8: error: 'Y' cannot be variable length
[prog.cob:18: warning: OCCURS DEPENDING ON in source or destination of REDEFINES group used
prog.cob:11: error: 'Y' cannot be variable length
prog.cob:16: error: the original definition 'X' cannot be variable length
])

AT_CLEANUP
Expand Down