Skip to content

Fix fakesdl headers when SDL directory included#26279

Open
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
sbc100:fakesdl
Open

Fix fakesdl headers when SDL directory included#26279
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
sbc100:fakesdl

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 16, 2026

We introduced the fakesdl headers back in #18443 so that anyone trying to use SDL without using -sUSE_SDL (or similar) would see an error.

However we only covered the SDL_xx.h include case not the SDL/SDL_xx.h use case.

This means that some users were not seeing the errors they should, including a few of our test cases.

Split out from #26275

@sbc100 sbc100 requested a review from kripken February 16, 2026 18:36
@sbc100 sbc100 requested a review from dschuff February 16, 2026 18:37
@sbc100 sbc100 enabled auto-merge (squash) February 16, 2026 18:37
@sbc100 sbc100 force-pushed the fakesdl branch 6 times, most recently from 68118fa to 78d0c59 Compare February 16, 2026 22:31
@sbc100 sbc100 force-pushed the fakesdl branch 3 times, most recently from f2c7b97 to b3077d6 Compare February 26, 2026 21:08
@sbc100 sbc100 requested a review from kripken February 26, 2026 21:10
@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 26, 2026

I added a ChangeLog entry to be extra clear what is changing here.

We introduced the `fakesdl` headers back in emscripten-core#18443 so that anyone trying
to use SDL without using `-sUSE_SDL` (or similar) would see an error.

However we only covered the `SDL_xx.h` include case not the
`SDL/SDL_xx.h` use case.

This means that some users were not seeing the errors they should,
including a few of our test cases.

Split out from emscripten-core#26275
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

lgtm % typo

//
// - 0, the default, means no SDL headers or libraries will be used.
// - 1 is a port of SDL 1.3, implemented in JS.
// - 2 and 3 are upstream ports build from the official SDL codebase.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// - 2 and 3 are upstream ports build from the official SDL codebase.
// - 2 and 3 are upstream ports built from the official SDL codebase.
self.skipTest('This test requires being run in non-strict mode (EMCC_STRICT env. variable unset)')
# TODO: This test is verifying behavior that will be deprecated at some point in the future, remove this test once
# system JS libraries are no longer automatically linked to anymore.
self.reftest('hello_world_sdl.c', 'htmltest.png')
Copy link
Member

Choose a reason for hiding this comment

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

Why is this test removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the exact behavior that I'm removing. i.e. that ability to use SDL headers without -sUSE_SDL.

I'm fixing the TODO here really, and this test should really have been removed in #18443.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm.. now that I go back and read #18443 it seems like it was deliberately only targeting the unversioned includes.

Copy link
Member

Choose a reason for hiding this comment

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

Either way, this lgtm. To use SDL, the flag should be needed, like all other ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants