From c87999278039fa76e639d80763859e3937519c61 Mon Sep 17 00:00:00 2001 From: doesthisusername Date: Wed, 4 Aug 2021 17:31:41 +0200 Subject: [PATCH] Add fallback for the restrict keyword being unavailable to bind_gen --- capi/bind_gen/src/c.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/capi/bind_gen/src/c.rs b/capi/bind_gen/src/c.rs index 0a49a399..24802142 100644 --- a/capi/bind_gen/src/c.rs +++ b/capi/bind_gen/src/c.rs @@ -45,8 +45,16 @@ pub fn write(mut writer: W, classes: &BTreeMap) -> Resu r#"#ifndef LIVESPLIT_CORE_H #define LIVESPLIT_CORE_H -#ifdef __cplusplus +/** +Most C/C++ compilers support __restrict, and it's been standardized in C99 by +adding the restrict keyword. +If not compiled in C99 (or higher) modes, try to use __restrict instead. +*/ +#if __STDC_VERSION__ < 199901L #define restrict __restrict +#endif + +#ifdef __cplusplus namespace LiveSplit { extern "C" { #endif