Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback for the restrict keyword being unavailable to bind_gen #441

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion capi/bind_gen/src/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ pub fn write<W: Write>(mut writer: W, classes: &BTreeMap<String, Class>) -> 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
Expand Down