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

CMake: Scope C99/C++98 flags to VVVVVV only #1184

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

InfoTeddy
Copy link
Collaborator

Due to a confluence of weird factors, it turns out that PhysFS is compiling with implicit function definitions due to function definitions that get hidden with -std=c99, but not with -std=gnu99 (or the default GCC value of -std=gnu17).

Also, due to a recent GCC update (GCC 14), implicit function declarations are actually prohibited with -std=c99 as the C99 standard proscribes.

This meant that people started getting build errors in PhysFS code on default settings, which wasn't ideal.

To fix this, we will make our -std= flags apply only to VVVVVV source files. In CMake 2.8.12, this can be done with set_source_files_properties. Additionally the flags to disable exceptions and RTTI are scoped down too.

Thanks to leo60228 for helping debug and solve this issue.

Fixes #1167.

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
    section of the credits for all of said releases, but will NOT be compensated
    for these changes unless there is a prior written agreement

Due to a confluence of weird factors, it turns out that PhysFS is
compiling with implicit function definitions due to function definitions
that get hidden with -std=c99, but not with -std=gnu99 (or the default
GCC value of -std=gnu17).

Also, due to a recent GCC update (GCC 14), implicit function
declarations are actually prohibited with -std=c99 as the C99 standard
proscribes.

This meant that people started getting build errors in PhysFS code on
default settings, which wasn't ideal.

To fix this, we will make our -std= flags apply only to VVVVVV source
files. In CMake 2.8.12, this can be done with
set_source_files_properties. Additionally the flags to disable
exceptions and RTTI are scoped down too.

Thanks to leo60228 for helping debug and solve this issue.

Fixes TerryCavanagh#1167.
GCC on CentOS will default to C90, it seems. This means it needs C99
explicitly specified for C-Hashmap and FAudio, or it will fail on them
using C99 features (variable declaration in a `for`-loop and the
`restrict` keyword, respectively).
desktop_version/CMakeLists.txt Show resolved Hide resolved
@InfoTeddy InfoTeddy merged commit b0d2a6a into TerryCavanagh:master Jul 13, 2024
4 checks passed
@InfoTeddy InfoTeddy deleted the general-bug-fixes-2 branch July 13, 2024 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails on physfs:
2 participants