diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-09-13 21:46:21 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-09-13 22:50:30 +0100 |
commit | 792463cb133f65645feb48743bbc03ef8eb96bdd (patch) | |
tree | 3879cd6895fe5c8f597f445af2410a41bcf00f73 /compile.bat | |
parent | 378892d089b6742a95b8d573af58535597f19d25 (diff) |
Move towards C23, improve events and vcall macros
Another big one. Here's a list of things:
- Since the upcoming C23 standardises typeof(), use it as an extension
for the time being in order to allow passing arbitrary types as
macro/codegen parameters. It wouldn't have been a big leap to do this
even without standardisation since it's apparently an easy extension
to implement - and also, to be honest, this project is essentially glued
to Clang anyway so who cares.
- Likewise, bool, true and false are becoming pre-defined, so
pre-pre-define them now in order to get the benefit of not having to
remember one header everywhere.
- Really ungodly/amazing vcall macro stuff now allows us to call C++
virtual functions like regular C functions. It's pretty cool!
- Events can now take arbitrary parameters and come in two types:
regular events and predicates.
All this makes the base code even uglier but makes the feature
implementation nicer. In other words, it places more of the cognitive
burden on myself and less on other people who might want to contribute.
This is a good tradeoff, because I'm a genius.
Diffstat (limited to 'compile.bat')
-rw-r--r-- | compile.bat | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/compile.bat b/compile.bat index 8005b24..f48453e 100644 --- a/compile.bat +++ b/compile.bat @@ -35,8 +35,13 @@ set dmodname= -DMODULE_NAME=%basename% if "%dmodname%"==" -DMODULE_NAME=con_" set dmodname= -DMODULE_NAME=con
if "%dmodname%"==" -DMODULE_NAME=sst" set dmodname=
set objs=%objs% .build/%basename%.o
+:: note: we use a couple of C23 things now because otherwise we'd have to wait a
+:: year to get anything done. typeof=__typeof prevents pedantic warnings caused
+:: by typeof still technically being an extension, and stdbool gives us
+:: predefined bool/true/false before compilers start doing that by default
%CC% -m32 -c -flto %cflags% %warnings% -I.build/include -D_CRT_SECURE_NO_WARNINGS -D_DLL ^
--DWIN32_LEAN_AND_MEAN -DNOMINMAX%dmodname% -o .build/%basename%.o %1 || exit /b
+-DWIN32_LEAN_AND_MEAN -DNOMINMAX%dmodname% -Dtypeof=__typeof -include stdbool.h ^
+-o .build/%basename%.o %1 || exit /b
goto :eof
:src
@@ -77,11 +82,11 @@ setlocal DisableDelayedExpansion if "%dbg%"=="1" set src=%src% src/dbg.c
if "%dbg%"=="1" set src=%src% src/udis86.c
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -ladvapi32 ^
+%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
-o .build/codegen.exe src/build/codegen.c src/build/cmeta.c || exit /b
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS ^
+%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h ^
-o .build/mkgamedata.exe src/build/mkgamedata.c src/kv.c || exit /b
-%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -ladvapi32 ^
+%HOSTCC% -municode -O2 %warnings% -D_CRT_SECURE_NO_WARNINGS -include stdbool.h -ladvapi32 ^
-o .build/mkentprops.exe src/build/mkentprops.c src/kv.c || exit /b
.build\codegen.exe%src% || exit /b
.build\mkgamedata.exe gamedata/engine.kv gamedata/gamelib.kv gamedata/inputsystem.kv || exit /b
|