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

Fixed Windows jsglue Builds with Define for Built-in offsetof #550

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

Redfire75369
Copy link
Contributor

@Redfire75369 Redfire75369 commented Jan 20, 2025

Adds -D_CRT_USE_BUILTIN_OFFSETOF for jsglue during the bindgen phase.
When building for aarch64-pc-windows-msvc with llvm 19, I had 12 errors as a result of offsetof not being constexpr compatible.

Examples of code which caused the errors:
https://searchfox.org/mozilla-central/source/js/public/Proxy.h#459
https://searchfox.org/mozilla-central/source/mfbt/HashFunctions.h#367

D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\mozilla/HashFunctions.h:367:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\mozilla/HashFunctions.h:371:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:444:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:449:19: error: static assertion expression is not an integral constant expression
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:461:41: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:727:20: error: constexpr variable 'numSlots' must be initialized by a constant expression
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/experimental/JitInfo.h:116:27: error: constexpr variable 'offsetOfArgv' must be initialized by a constant expression
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/experimental/JitInfo.h:117:27: error: constexpr variable 'offsetOfArgc' must be initialized by a constant expression
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\stddef.h:47:31: error: static assertion expression is not an integral constant expression
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:727:20: error: constexpr variable 'numSlots' must be initialized by a constant expression
D:\a\spiderfire\spiderfire\target\aarch64-pc-windows-msvc\release\build\mozjs_sys-cbcf24600a385d3e\out\build\dist/include\js/Proxy.h:732:17: error: static assertion expression is not an integral constant expression

@Redfire75369 Redfire75369 marked this pull request as draft January 20, 2025 13:23
@Redfire75369 Redfire75369 marked this pull request as ready for review January 21, 2025 02:38
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

You will need to run cargo fmt.

@jdm jdm added this pull request to the merge queue Jan 24, 2025
Merged via the queue into servo:main with commit faeeb8f Jan 24, 2025
27 checks passed
@Redfire75369 Redfire75369 deleted the build/win-offsetof branch January 28, 2025 12:40
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