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

Conversation

doesthisusername
Copy link
Contributor

Pretty much every compiler already supports restrict when compiling C, but for the ones that don't, this should improve compatibility. Additionally, using the generated livesplit_core.h in a CMake project with a minimal target feature requirement setting (c_restrict) causes IDE syntax highlighting errors when Visual Studio is used as the generator, because it lacks a c99 option. This ends up fixed too.

I didn't add a generic fallback (#define restrict ) as I doubt there's a standard way to query compiler extensions like that, especially not at gen-time, and a lot of things support __restrict. I can make it overridable for odd toolchains, if you'd like:

#if !defined(restrict) && __STDC_VERSION__ < 199901L

There theoretically could be issues with other language bindings if they're generated from livesplit_core.h, though I imagine that's unlikely, as cargo run in bind_gen seems to generate all of the languages, and I encounted no errors during that. This PR should also have identical semantics for most compilers (everything but C in a mode earlier than C99 should be the same).

P.S. I haven't made many PRs so I hope this is up to standard!

@CryZe CryZe added c api The issue or pull request is about the C API. enhancement An improvement for livesplit-core. labels Aug 18, 2021
@CryZe CryZe merged commit 85c6b4d into LiveSplit:master Aug 18, 2021
@doesthisusername doesthisusername deleted the restrict-fix branch August 19, 2021 13:53
@CryZe CryZe added this to the v0.12 milestone Oct 3, 2021
@CryZe CryZe added bindings This is about the bindings / binding generator. and removed c api The issue or pull request is about the C API. labels Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings This is about the bindings / binding generator. enhancement An improvement for livesplit-core.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants