Skip to content

Commit 691c4c4

Browse files
Fix five test cases in tests/run.src/extensions.at (#269)
1 parent 86905d1 commit 691c4c4

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

cobj/codegen.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,6 +2946,8 @@ static void joutput_call(struct cb_call *p) {
29462946
if (CB_LITERAL_P(p->name)) {
29472947
callp = cb_encode_program_id((char *)(CB_LITERAL(p->name)->data));
29482948
lookup_call(callp);
2949+
joutput_line("if (call_%s == null) {", callp);
2950+
joutput_indent_level += 2;
29492951
if (cb_java_package_name) {
29502952
joutput_line("call_%s = CobolResolve.resolve(\"%s\", \"%s\", call_%s);",
29512953
callp, cb_java_package_name,
@@ -2954,6 +2956,8 @@ static void joutput_call(struct cb_call *p) {
29542956
joutput_line("call_%s = CobolResolve.resolve(null, \"%s\", call_%s);",
29552957
callp, (char *)(CB_LITERAL(p->name)->data), callp);
29562958
}
2959+
joutput_indent_level -= 2;
2960+
joutput_line("}");
29572961
} else {
29582962
callp = NULL;
29592963
joutput_prefix();
@@ -3150,9 +3154,7 @@ static void joutput_call(struct cb_call *p) {
31503154
if (!system_call) {
31513155
if (cb_sticky_linkage || cb_flag_null_param) {
31523156
for (n = 0; n < 4; n++) {
3153-
if (n != 0 || parmnum != 0) {
3154-
joutput(", ");
3155-
}
3157+
joutput(", ");
31563158
joutput("null");
31573159
}
31583160
}
@@ -4741,7 +4743,7 @@ static void joutput_internal_function(struct cb_program *prog,
47414743
/* Entry dispatch */
47424744
joutput_line("/* Entry dispatch */");
47434745
if (cb_list_length(prog->entry_list) > 1) {
4744-
joutput_line("multiple entry dispatch is not implemented");
4746+
joutput_line("//multiple entry dispatch is not implemented");
47454747
joutput_newline();
47464748
joutput_line("switch (entry)");
47474749
joutput_line(" {");

cobj/typeck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ cb_tree cb_build_identifier(cb_tree x) {
714714
if (p->flag_item_based ||
715715
(f->storage == CB_STORAGE_LINKAGE && !p->flag_is_pdiv_parm)) {
716716
current_statement->null_check = cb_build_funcall_2(
717-
"cob_check_based",
717+
"CobolUtil.cobCheckBased",
718718
cb_build_address(cb_build_field_reference(p, NULL)),
719719
cb_build_string0((ucharptr)name));
720720
}

libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ public static void cobCheckRefMod(int offset, long length, int size, String name
156156
}
157157
}
158158

159+
public static void cobCheckBased(CobolDataStorage x, byte[] name) throws CobolStopRunException {
160+
if (x == null) {
161+
CobolUtil.runtimeError(String.format("BASED/LINKAGE item '%s' has NULL address", name));
162+
CobolStopRunException.stopRunAndThrow(1);
163+
}
164+
}
165+
159166
/** libcob/common.cのcob_initの実装 TODO 未完成 */
160167
public static void cob_init(String[] argv, boolean cobInitialized) {
161168
if (!cobInitialized) {

tests/run.src/extensions.at

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,6 @@ AT_CHECK([java prog CHECKPAR], [0],
11511151
AT_CLEANUP
11521152

11531153
AT_SETUP([DECIMAL-POINT is COMMA (1)])
1154-
AT_CHECK([${SKIP_TEST}])
11551154

11561155
AT_DATA([prog.cob], [
11571156
IDENTIFICATION DIVISION.
@@ -1178,7 +1177,6 @@ AT_CHECK([java prog], [0],
11781177
AT_CLEANUP
11791178

11801179
AT_SETUP([DECIMAL-POINT is COMMA (2)])
1181-
AT_CHECK([${SKIP_TEST}])
11821180

11831181
AT_DATA([prog.cob], [
11841182
IDENTIFICATION DIVISION.
@@ -1205,7 +1203,6 @@ AT_CHECK([java prog], [0],
12051203
AT_CLEANUP
12061204

12071205
AT_SETUP([DECIMAL-POINT is COMMA (3)])
1208-
AT_CHECK([${SKIP_TEST}])
12091206

12101207
AT_DATA([prog.cob], [
12111208
IDENTIFICATION DIVISION.
@@ -1232,7 +1229,6 @@ AT_CHECK([java prog], [0],
12321229
AT_CLEANUP
12331230

12341231
AT_SETUP([DECIMAL-POINT is COMMA (4)])
1235-
AT_CHECK([${SKIP_TEST}])
12361232

12371233
AT_DATA([prog.cob], [
12381234
IDENTIFICATION DIVISION.
@@ -1259,7 +1255,6 @@ AT_CHECK([java prog], [0],
12591255
AT_CLEANUP
12601256

12611257
AT_SETUP([DECIMAL-POINT is COMMA (5)])
1262-
AT_CHECK([${SKIP_TEST}])
12631258

12641259
AT_DATA([prog.cob], [
12651260
IDENTIFICATION DIVISION.

0 commit comments

Comments
 (0)