Fix Windows/MSVC build: replace __restrict__ with portable RESTRICT macro - #1
Open
primuszp wants to merge 1 commit into
Open
Fix Windows/MSVC build: replace __restrict__ with portable RESTRICT macro#1primuszp wants to merge 1 commit into
primuszp wants to merge 1 commit into
Conversation
…acro GCC and Clang support the GNU extension __restrict__, but MSVC only recognizes __restrict (no trailing underscores). On Windows with MSVC, the double-underscore form caused pointer declarations in math_fun.h to fail, resulting in 200+ undeclared identifier errors. This is not an issue on macOS (Clang) or Linux (GCC). Added an MSVC-aware RESTRICT macro (matching the one already present in processing_function.h) and replaced all __restrict__ usages in math_fun.h.
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.
Problem
On Windows with MSVC,
pip install .fails with 200+ compiler errors:math_fun.huses__restrict__(GNU extension, double underscores), which MSVC does not recognize — it only supports__restrict. MSVC fails to parse the pointer declarations, leavingM,vb,Coe,Y,Zundeclared. This is not an issue on macOS (Clang) or Linux (GCC).Fix
Added an MSVC-aware
RESTRICTmacro tomath_fun.h(identical to the one already inprocessing_function.h) and replaced all five__restrict__usages.Tested
pip install .now succeeds on Windows 11 with MSVC.