Skip to content

Commit

Permalink
ci: add CI build for Digital Mars C/C++ Compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
nemequ committed Sep 13, 2024
1 parent 2e9c453 commit 844b8ec
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 44 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,33 @@ jobs:
- name: Check for changes
run: git diff --exit-code

dmc:
runs-on: windows-latest
strategy:
matrix:
version:
- "8.26"
- "8.30"
- "8.40"
- "8.50"
- "8.57"
steps:
- uses: actions/checkout@v4
- name: Install Digital Mars C/C++ Compiler
run: |
$version = "${{ matrix.version }}".Replace(".", "")
$url = "http://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm${version}c.zip"
Invoke-WebRequest -Uri "${url}" -OutFile "dmc.zip"
Expand-Archive -LiteralPath "dmc.zip" -DestinationPath dmc-tmp
Move-Item -Path dmc-tmp\* -Destination dmc
working-directory: test
- name: Compile
env:
CC: dmc\bin\dmc.exe
CXX: dmc\bin\dmc.exe
run: make -f Makefile.dmc
working-directory: test

nvhpc:
runs-on: ubuntu-latest
strategy:
Expand Down
10 changes: 5 additions & 5 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ Makefile.iar: Makefile

Makefile.dmc: Makefile
@$(ECHO) -e "# Generated by Makefile. Do not edit.\r" > $@
@$(ECHO) -e "CC = \"dmc.exe\"\r" >> $@
@$(ECHO) -e "CXX = \x24(CC)\r" >> $@
@$(ECHO) -e "CC ?= \"dmc.exe\"\r" >> $@
@$(ECHO) -e "CXX ?= \x24(CC)\r" >> $@
@$(ECHO) -e "\r" >> $@

@$(ECHO) -e "CFLAGS = -w -w17 -w18 -wx\r" >> $@
@$(ECHO) -e "CXXFLAGS = -wc \x24(CFLAGS)\r" >> $@
@$(ECHO) -e "CFLAGS ?= -w -w17 -w18 -wx\r" >> $@
@$(ECHO) -e "CXXFLAGS ?= -wc \x24(CFLAGS)\r" >> $@
@$(ECHO) -e "\r" >> $@

@$(ECHO) -e "TESTS = \x5c\r" >> $@
Expand All @@ -208,7 +208,7 @@ Makefile.dmc: Makefile
@$(ECHO) -e "all: \x24(TESTS)\r\n\r" >> $@
@$(ECHO) -e "clean:\r\n\tdel /Q \x24(CLEANFILES)\r\n\r" >> $@

@$(foreach file,$(TESTS),$(ECHO) -e "$(file:=.exe): $(file:=.c)\r\n\t\x24(CC) \x24(CFLAGS) -o \x24(@) \x24(?)\r\n$(file:=.cpp): $(file:=.c)\r\n\tcopy /Y \x24(?) \x24(@) >NUL\r\n$(file:=-cpp.exe): $(file:=.cpp)\r\n\t\x24(CXX) \x24(CXXFLAGS) -o \x24(@) \x24(?)\r\n\r" >> $@;)
@$(foreach file,$(TESTS),$(ECHO) -e "$(file:=.exe): $(file:=.c)\r\n\t\x24(CC) \x24(CFLAGS) -o \x24(@) \x24(?)\r\n$(file:=.cpp): $(file:=.c)\r\n\tcp -f \x24(?) \x24(@)\r\n$(file:=-cpp.exe): $(file:=.cpp)\r\n\t\x24(CXX) \x24(CXXFLAGS) -o \x24(@) \x24(?)\r\n\r" >> $@;)

Makefile.msvc: Makefile
@$(ECHO) -e "# Generated by Makefile. Do not edit.\r" > $@
Expand Down
78 changes: 39 additions & 39 deletions test/Makefile.dmc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Generated by Makefile. Do not edit.
CC = "dmc.exe"
CXX = $(CC)
CC ?= "dmc.exe"
CXX ?= $(CC)

CFLAGS = -w -w17 -w18 -wx
CXXFLAGS = -wc $(CFLAGS)
CFLAGS ?= -w -w17 -w18 -wx
CXXFLAGS ?= -wc $(CFLAGS)

TESTS = \
array-param.exe array-param-cpp.exe \
Expand Down Expand Up @@ -89,245 +89,245 @@ clean:
array-param.exe: array-param.c
$(CC) $(CFLAGS) -o $(@) $(?)
array-param.cpp: array-param.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
array-param-cpp.exe: array-param.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

assume.exe: assume.c
$(CC) $(CFLAGS) -o $(@) $(?)
assume.cpp: assume.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
assume-cpp.exe: assume.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

cast.exe: cast.c
$(CC) $(CFLAGS) -o $(@) $(?)
cast.cpp: cast.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
cast-cpp.exe: cast.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

concat.exe: concat.c
$(CC) $(CFLAGS) -o $(@) $(?)
concat.cpp: concat.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
concat-cpp.exe: concat.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

const.exe: const.c
$(CC) $(CFLAGS) -o $(@) $(?)
const.cpp: const.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
const-cpp.exe: const.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

constant.exe: constant.c
$(CC) $(CFLAGS) -o $(@) $(?)
constant.cpp: constant.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
constant-cpp.exe: constant.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

deprecated.exe: deprecated.c
$(CC) $(CFLAGS) -o $(@) $(?)
deprecated.cpp: deprecated.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
deprecated-cpp.exe: deprecated.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

empty-bases.exe: empty-bases.c
$(CC) $(CFLAGS) -o $(@) $(?)
empty-bases.cpp: empty-bases.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
empty-bases-cpp.exe: empty-bases.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

fallthrough.exe: fallthrough.c
$(CC) $(CFLAGS) -o $(@) $(?)
fallthrough.cpp: fallthrough.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
fallthrough-cpp.exe: fallthrough.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

flags.exe: flags.c
$(CC) $(CFLAGS) -o $(@) $(?)
flags.cpp: flags.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
flags-cpp.exe: flags.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

inline.exe: inline.c
$(CC) $(CFLAGS) -o $(@) $(?)
inline.cpp: inline.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
inline-cpp.exe: inline.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

likely.exe: likely.c
$(CC) $(CFLAGS) -o $(@) $(?)
likely.cpp: likely.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
likely-cpp.exe: likely.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

malloc.exe: malloc.c
$(CC) $(CFLAGS) -o $(@) $(?)
malloc.cpp: malloc.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
malloc-cpp.exe: malloc.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

message.exe: message.c
$(CC) $(CFLAGS) -o $(@) $(?)
message.cpp: message.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
message-cpp.exe: message.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

noinline.exe: noinline.c
$(CC) $(CFLAGS) -o $(@) $(?)
noinline.cpp: noinline.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
noinline-cpp.exe: noinline.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

no-escape.exe: no-escape.c
$(CC) $(CFLAGS) -o $(@) $(?)
no-escape.cpp: no-escape.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
no-escape-cpp.exe: no-escape.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

no-return.exe: no-return.c
$(CC) $(CFLAGS) -o $(@) $(?)
no-return.cpp: no-return.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
no-return-cpp.exe: no-return.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

non-null.exe: non-null.c
$(CC) $(CFLAGS) -o $(@) $(?)
non-null.cpp: non-null.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
non-null-cpp.exe: non-null.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

predict.exe: predict.c
$(CC) $(CFLAGS) -o $(@) $(?)
predict.cpp: predict.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
predict-cpp.exe: predict.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

printf-format.exe: printf-format.c
$(CC) $(CFLAGS) -o $(@) $(?)
printf-format.cpp: printf-format.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
printf-format-cpp.exe: printf-format.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

pure.exe: pure.c
$(CC) $(CFLAGS) -o $(@) $(?)
pure.cpp: pure.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
pure-cpp.exe: pure.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

require.exe: require.c
$(CC) $(CFLAGS) -o $(@) $(?)
require.cpp: require.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
require-cpp.exe: require.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

restrict.exe: restrict.c
$(CC) $(CFLAGS) -o $(@) $(?)
restrict.cpp: restrict.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
restrict-cpp.exe: restrict.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

returns-non-null.exe: returns-non-null.c
$(CC) $(CFLAGS) -o $(@) $(?)
returns-non-null.cpp: returns-non-null.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
returns-non-null-cpp.exe: returns-non-null.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

sentinel.exe: sentinel.c
$(CC) $(CFLAGS) -o $(@) $(?)
sentinel.cpp: sentinel.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
sentinel-cpp.exe: sentinel.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

static-assert.exe: static-assert.c
$(CC) $(CFLAGS) -o $(@) $(?)
static-assert.cpp: static-assert.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
static-assert-cpp.exe: static-assert.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

stringify.exe: stringify.c
$(CC) $(CFLAGS) -o $(@) $(?)
stringify.cpp: stringify.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
stringify-cpp.exe: stringify.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

unknown-cpp-attributes.exe: unknown-cpp-attributes.c
$(CC) $(CFLAGS) -o $(@) $(?)
unknown-cpp-attributes.cpp: unknown-cpp-attributes.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
unknown-cpp-attributes-cpp.exe: unknown-cpp-attributes.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

unknown-pragmas.exe: unknown-pragmas.c
$(CC) $(CFLAGS) -o $(@) $(?)
unknown-pragmas.cpp: unknown-pragmas.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
unknown-pragmas-cpp.exe: unknown-pragmas.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

unavailable.exe: unavailable.c
$(CC) $(CFLAGS) -o $(@) $(?)
unavailable.cpp: unavailable.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
unavailable-cpp.exe: unavailable.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

unreachable.exe: unreachable.c
$(CC) $(CFLAGS) -o $(@) $(?)
unreachable.cpp: unreachable.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
unreachable-cpp.exe: unreachable.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

unused-function.exe: unused-function.c
$(CC) $(CFLAGS) -o $(@) $(?)
unused-function.cpp: unused-function.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
unused-function-cpp.exe: unused-function.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

visibility.exe: visibility.c
$(CC) $(CFLAGS) -o $(@) $(?)
visibility.cpp: visibility.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
visibility-cpp.exe: visibility.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

warn.exe: warn.c
$(CC) $(CFLAGS) -o $(@) $(?)
warn.cpp: warn.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
warn-cpp.exe: warn.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

warn-unused-result.exe: warn-unused-result.c
$(CC) $(CFLAGS) -o $(@) $(?)
warn-unused-result.cpp: warn-unused-result.c
copy /Y $(?) $(@) >NUL
cp -f $(?) $(@)
warn-unused-result-cpp.exe: warn-unused-result.cpp
$(CXX) $(CXXFLAGS) -o $(@) $(?)

5 changes: 5 additions & 0 deletions test/printf-format.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

HEDLEY_PRINTF_FORMAT(1,2)
static void print_msg(const char* msg, ...) {
#if defined(HEDLEY_DMC_VERSION) && !HEDLEY_DMC_VERSION_CHECK(8,39,0)
/* Old DMC versions didn't have a vsnprintf implementation until. */
(void) msg;
#else
char buf[128];
va_list ap;

Expand All @@ -29,6 +33,7 @@ static void print_msg(const char* msg, ...) {
vsnprintf(buf, sizeof(buf), msg, ap);

va_end(ap);
#endif
}

int main (void) {
Expand Down

0 comments on commit 844b8ec

Please sign in to comment.