code generation broken ... at least for aarch64-clang
All tests fail, here's number 2
test.s:10411:1: error: unassigned file number: 1 for .file directives
^
test.s:10411:1: error: unassigned file number: 2 for .file directives
^
test.s:10411:1: error: unassigned file number: 4 for .file directives
^
test.s:10411:1: error: unassigned file number: 5 for .file directives
^
make: *** [Makefile:36: test] Error 1
And indeed, the generated file does look suspicious:
.file "test.cbl"
.file 3 "/data/data/com.termux/files"
.file 6 "/data/data/com.termux/files/home/cbl-gdb/tests/test002"
.globl main // -- Begin function main
.p2align 2
.type main,@function
main: // @main
.loc 6 127
.Lfunc_begin0:
.cfi_startproc
// %bb.0:
And the reason for this is possibly that the generated file entries that cobcd gets are quite strange:
.file "test.c"
.file 1 "/data/data/com.termux/files/home/cbl-gdb/tests/test002" "./test.c.l.h"
.file 2 "/data/data/com.termux/files" "usr/include/libcob/common.h"
.file 3 "/data/data/com.termux/files" "usr/lib/clang/15.0.6/include/stddef.h"
.file 4 "/data/data/com.termux/files/home/cbl-gdb/tests/test002" "test.c"
.file 5 "/data/data/com.termux/files/home/cbl-gdb/tests/test002" "./test.c.h"
---
.file 6 "/data/data/com.termux/files/home/cbl-gdb/tests/test002" "test.cbl"
So the issues are:
- strangely there may be a space between the folder and the "file" -> cobcd should copy the file entries until end of line
- some assemblers error on missing file numbers, if cobcd just "drops" the "bad" C ones, then it should renumber the entries instead (keeping the order)