Skip to content

Commit

Permalink
improving cobc handling with MSVC assembler
Browse files Browse the repository at this point in the history
  • Loading branch information
sf-mensch authored and engboris committed Jun 13, 2024
1 parent 4a9c1d5 commit e86ca86
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8193,6 +8193,9 @@ process_compile (struct filename *fn)
name = file_basename (fn->source, NULL);
#ifndef _MSC_VER
strcat (name, ".s");
#else
/* earlier versions of msbuild don't recognize .s */
strcat (name, ".asm");
#endif
}
size = strlen (name);
Expand All @@ -8207,6 +8210,7 @@ process_compile (struct filename *fn)
cobc_chk_buff_size (bufflen);

#ifdef _MSC_VER
/* TODO: we likely need to call ml.exe / ml64.exe */
sprintf (cobc_buffer, cb_source_debugging ?
"%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" :
"%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"",
Expand Down
27 changes: 18 additions & 9 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ AT_CLEANUP


AT_SETUP([save-temps in sub-directory])
AT_KEYWORDS([runmisc])
AT_KEYWORDS([runmisc cobc])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand All @@ -452,6 +452,7 @@ AT_CHECK([$COBCRUN_DIRECT ./prog.exe], [0], [OK])
AT_CHECK([test -f debug/prog.$COB_OBJECT_EXT])
AT_CHECK([test -f debug/prog.c])
AT_CHECK([test -f debug/prog.s], [1])
AT_CHECK([test -f debug/prog.asm], [1])
AT_CHECK([test -f debug/prog.i])
AT_CHECK([test -f debug/prog.c.h])
AT_CHECK([test -f debug/prog.c.l.h])
Expand All @@ -464,14 +465,6 @@ AT_CHECK([test -f prog.$COB_OBJECT_EXT])
AT_CHECK([$COMPILE -save-temps=debug -c -o program.$COB_OBJECT_EXT prog.cob])
AT_CHECK([test -f program.$COB_OBJECT_EXT])

# Check with -S

AT_CHECK([test -f prog.s], [1])
AT_CHECK([$COMPILE -save-temps=debug -S prog.cob])
AT_CHECK([test -f prog.s])
AT_CHECK([$COMPILE -save-temps=debug -S -o program.s prog.cob])
AT_CHECK([test -f program.s])

# Check with -C

AT_CHECK([test -f prog.c], [1])
Expand All @@ -492,6 +485,22 @@ AT_CHECK([test -f prog.i])
AT_CHECK([$COMPILE -save-temps=debug -E -o program.i prog.cob])
AT_CHECK([test -f program.i])

# Check with -S (last as we skip the testsuite entry for some compilers by returning 77)

AT_CHECK([test -f prog.s], [1])
AT_CHECK([test -f prog.asm], [1])
AT_CHECK([$COMPILE -save-temps=debug -S prog.cob])
AT_CHECK([test -f prog.s], [0], [], [],
# Previous test "failed" --> prog.s not available --> likely a VS build
[AT_CHECK([test -f prog.asm], [0], [], [])
AT_CHECK([$COMPILE -save-temps=debug -S -o program.asm prog.cob])
AT_CHECK([test -f program.asm])
],
# Previous test "passed" - .s is the extension to be used
[AT_CHECK([$COMPILE -save-temps=debug -S -o program.s prog.cob])
AT_CHECK([test -f program.s])
])

AT_CLEANUP


Expand Down

0 comments on commit e86ca86

Please sign in to comment.