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

make: fix PhysFS defines to match expected assignment of [0,1] #270

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

jstine35
Copy link
Collaborator

When a codebase uses #if HAVE_FOOBAR it is necessary to use HAVE_FOOBAR=1 to ensure the compiler actually enables the codeblock in the expected way. When the code uses #ifdef HAVE_FOOBAR then a define without any assignment is sufficient to enable the feature.

The #if is recommended over the #ifdef form for reasons of explicitness, along with a few other minor benefits related to inheriting or overriding the set value later on in the build system or at the source code level. PhysFs uses/expects this form, but lutro generally does not (yet).

When a codebase uses `#if HAVE_FOOBAR` it is necessary to use `HAVE_FOOBAR=1` to ensure the compiler actually enables the codeblock in the expected way. When the code uses `#ifdef HAVE_FOOBAR` then a define without any assignment is sufficient to enable the feature.

In general the `#if` form should be preferred over the `#ifdef` form for reasons of explicitness, along with a few other minor benefits related to inheriting or overriding the set value later on in the build system or at the source code level. PhysFs uses/expects this form, but lutro generally does not (yet).
@jstine35 jstine35 requested review from kivutar and RobLoach January 26, 2025 05:07
Copy link
Member

@RobLoach RobLoach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how extensive the PhysFS usage in Lutro is, but I have pushed up libretro support for PhysFS that makes PhysFS use the libretro virtual file system.

@jstine35 jstine35 merged commit 426a4a2 into libretro:master Jan 26, 2025
10 checks passed
@jstine35 jstine35 deleted the make_define branch January 26, 2025 05:36
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.

2 participants