Repository navigation
Runtime: MSVC fallback for always_inline and flatten - #446
Open
Fructose0517 wants to merge 1 commit into
Open
Fructose0517 wants to merge 1 commit into
Fructose0517 wants to merge 1 commit into
Conversation
gs_cpu_backend.cpp and ps2_gs_memory.cpp used __attribute__((always_inline)) and __attribute__((flatten)) directly, which MSVC does not know, so the runtime no longer compiled with MSVC (the windows-msvc CI job fails at Build). Two macros in types.h, PS2_FORCE_INLINE and PS2_FLATTEN, keep the attributes on GCC and Clang and use __forceinline (and nothing for flatten, a hint) on MSVC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Since #359,
gs_cpu_backend.cppandps2_gs_memory.cppuse__attribute__((always_inline))(8 functions) and__attribute__((flatten))(2 functions) directly. MSVC has no__attribute__, sops2_runtimeno longer compiles with it: thewindows-msvc-x86_64job fails at Build onmain(ccc1655) with C4430/C2065'always_inline': undeclared identifierings_cpu_backend.cppand C2988unrecognizable template declarationinps2_gs_memory.cpp.This change adds two macros to
ps2xRuntime/include/types.h, which both files already include (throughps2_gs_memory.h), in the same style asPS2_FLOAT_NOINLINEinps2_runtime_macros.h:and uses them in place of the attributes. GCC and Clang (clang-cl included) get exactly the attributes they had; MSVC gets
__forceinline, and nothing forflatten, which is only a hint and has no MSVC equivalent.Tests
No new test: the build is the test.
cmake -B build,cmake --build build --config Release, no extra flags):ps2_runtime,ps2EntryRunner,ps2_recomp,ps2_analyzer,ps2x_testsand thegs_cachetest programs build, andps2x_testspasses 523 of 523. Without the changeps2_runtimestops at the errors above (the CI run onccc1655).ps2xStudio(GUI.cpp:'Display','IsOk','GetFilePathName','Close'are not members ofIGFD::FileDialog).ps2xStudio/CMakeLists.txtfetches ImGuiFileDialog atmaster, whose API no longer has these (fetched today atbadc2be). So the CI job will still report a failed Build until that dependency is pinned, which has its own small PR; with both, the whole CI-style build succeeds andps2x_testspasses 523 of 523.-O2 -msse4.1(I could not build the whole runtime on this machine: no FFmpeg development packages).The Linux CI jobs fail on
mainfor a separate reason (a missing<cstring>inps2xTest/src/code_generator_tests.cpp); that has its own small PR.Checked on a game
Found while porting a game, which builds the runtime with MSVC and has so far force-included a header that defines
__attribute__(x)away. This change makes that header unnecessary for upstream's sources.🤖 Generated with Claude Code