aboutsummaryrefslogtreecommitdiff
path: root/src/l4d1democompat.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-08-03 16:09:42 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-08-03 16:09:42 +0100
commit69f34b359c0ec0d4517050fe274883421c4c119b (patch)
tree44bf4ce549129ddf83371d3c6abbe8e2bf6a7869 /src/l4d1democompat.c
parentb11cf48853bc4eccde60bc82180025f0797fa823 (diff)
downloadsst-69f34b359c0ec0d4517050fe274883421c4c119b.tar.gz
sst-69f34b359c0ec0d4517050fe274883421c4c119b.zip
Tidy up some extensions and remove some ifdefs
Since this codebase is already extremely nonportable, I've decided to relax the obsessive ifdef-else-error usage around all the extensions. From now on, if there's no alternative to using an extension, we can just use that extension. If it's possible to do something in a relatively portable way, we can still try to do that in order to make the code somewhat reusable, in contexts where that makes sense. I also decided to use langext.h for naked functions and tail calls. If that's used in another codebase build with a different compiler, those just won't work, but that's fine. The benefit is really just that there's less ceremony in places where those are used, because it's likely there'll be a few more such places in the future, and it gets annoying reading all the double-underscore stuff all over the place. I still kind of want to do something about all the _WIN32 ifdefs too, but I've realised that doing so will lead to almost nothing actually being built on Linux. Then again, none of it currently runs on Linux so I guess that's a moot point. Will worry about it later, anyway.
Diffstat (limited to 'src/l4d1democompat.c')
-rw-r--r--src/l4d1democompat.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/l4d1democompat.c b/src/l4d1democompat.c
index 4b84dd3..eff6ad0 100644
--- a/src/l4d1democompat.c
+++ b/src/l4d1democompat.c
@@ -114,14 +114,7 @@ static void VCALLCONV hook_ReadDemoHeader(struct CDemoFile *this) {
orig_ReadDemoHeader(this);
}
-#if defined(__clang__)
-__attribute((naked))
-#elif defined(_MSC_VER)
-#error Inadequate inline assembly syntax, use Clang instead.
-#else
-#error No way to do naked functions! We only support Clang at the moment.
-#endif
-static int hook_midpoint() {
+static asm_only int hook_midpoint() {
__asm volatile (
"push eax\n"
"mov eax, %1\n"