Skip to content

Commit 56cd1c4

Browse files
authored
Throw an error if COMP-1 and COMP-2 are used (#611)
1 parent a1c08e0 commit 56cd1c4

File tree

6 files changed

+1950
-1954
lines changed

6 files changed

+1950
-1954
lines changed

cobj/parser.c

Lines changed: 1914 additions & 1950 deletions
Large diffs are not rendered by default.

cobj/parser.y

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2889,8 +2889,16 @@ usage_clause:
28892889
usage:
28902890
BINARY { current_field->usage = CB_USAGE_BINARY; }
28912891
| COMP { current_field->usage = CB_USAGE_BINARY; }
2892-
| COMP_1 { current_field->usage = CB_USAGE_FLOAT; }
2893-
| COMP_2 { current_field->usage = CB_USAGE_DOUBLE; }
2892+
| COMP_1
2893+
{
2894+
current_field->usage = CB_USAGE_FLOAT;
2895+
cb_error (_("COMP-1 not implemented"));
2896+
}
2897+
| COMP_2
2898+
{
2899+
current_field->usage = CB_USAGE_DOUBLE;
2900+
cb_error (_("COMP-2 not implemented"));
2901+
}
28942902
| COMP_3 { current_field->usage = CB_USAGE_PACKED; }
28952903
| COMP_4 { current_field->usage = CB_USAGE_BINARY; }
28962904
| COMP_5 { current_field->usage = CB_USAGE_COMP_5; }

tests/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ misc_DEPENDENCIES = \
241241
misc.src/search-occurs-depending.at \
242242
misc.src/fix-subtract.at \
243243
misc.src/display-numeric-NUMERIC-class.at \
244-
misc.src/display-inspect-sign.at
244+
misc.src/display-inspect-sign.at \
245+
misc.src/comp1-comp2.at
245246

246247
EXTRA_DIST = $(srcdir)/package.m4 \
247248
$(TESTS) \

tests/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,8 @@ misc_DEPENDENCIES = \
780780
misc.src/search-occurs-depending.at \
781781
misc.src/fix-subtract.at \
782782
misc.src/display-numeric-NUMERIC-class.at \
783-
misc.src/display-inspect-sign.at
783+
misc.src/display-inspect-sign.at \
784+
misc.src/comp1-comp2.at
784785

785786
EXTRA_DIST = $(srcdir)/package.m4 \
786787
$(TESTS) \

tests/misc.at

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ m4_include([search-occurs-depending.at])
5555
m4_include([fix-subtract.at])
5656
m4_include([display-numeric-NUMERIC-class.at])
5757
m4_include([display-inspect-sign.at])
58+
m4_include([comp1-comp2.at])

tests/misc.src/comp1-comp2.at

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
AT_SETUP([COMP-1 COMP-2 error])
2+
3+
AT_DATA([prog.cbl], [
4+
identification division.
5+
******************************************************************
6+
program-id. prog.
7+
******************************************************************
8+
data division.
9+
WORKING-STORAGE SECTION.
10+
01 H COMP-1.
11+
01 I COMP-2.
12+
PROCEDURE DIVISION.
13+
STOP RUN.
14+
])
15+
16+
AT_CHECK([${COBJ} prog.cbl], [1], [],
17+
[prog.cbl:8: Error: COMP-1 not implemented
18+
prog.cbl:9: Error: COMP-2 not implemented
19+
])
20+
21+
AT_CLEANUP

0 commit comments

Comments
 (0)