-
Notifications
You must be signed in to change notification settings - Fork 264
All cppwinrt vcxproj should build with /W4 and /WX (warnings turned up, treated as error). Fix existing violations. #1487
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the cppwinrt project files to enable /W4 and /WX for stricter warning enforcement and fixes the resulting issues. The changes primarily adjust attribute detection checks in header files to ensure compatibility on Clang and resolve a typo in a project file.
- Updated preprocessor conditions in header files to check for __has_attribute before using it.
- Ensured consistency in attribute detection across files.
Reviewed Changes
Copilot reviewed 29 out of 47 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| strings/base_macros.h | Revised attribute check logic with nested __has_attribute validation. |
| strings/base_fast_forward.h | Similar update to attribute detection with added guard for __has_attribute. |
Files not reviewed (18)
- Directory.Build.Props: Language not supported
- cppwinrt/cppwinrt.vcxproj: Language not supported
- natvis/cppwinrtvisualizer.vcxproj: Language not supported
- prebuild/prebuild.vcxproj: Language not supported
- scratch/scratch.vcxproj: Language not supported
- test/nuget/ConsoleApplication1/ConsoleApplication1.vcxproj: Language not supported
- test/nuget/TestApp/TestApp.vcxproj: Language not supported
- test/nuget/TestProxyStub/TestProxyStub.vcxproj: Language not supported
- test/nuget/TestRuntimeComponent1/TestRuntimeComponent1.vcxproj: Language not supported
- test/nuget/TestRuntimeComponent2/TestRuntimeComponent2.vcxproj: Language not supported
- test/nuget/TestRuntimeComponent3/TestRuntimeComponent3.vcxproj: Language not supported
- test/nuget/TestRuntimeComponentCX/TestRuntimeComponentCX.vcxproj: Language not supported
- test/nuget/TestRuntimeComponentCXReferencingWinRTStaticLibrary/TestRuntimeComponentCXReferencingWinRTStaticLibrary.vcxproj: Language not supported
- test/nuget/TestRuntimeComponentEmpty/TestRuntimeComponentEmpty.vcxproj: Language not supported
- test/nuget/TestRuntimeComponentNamespaceUnderscore/TestRuntimeComponentNamespaceUnderscore.vcxproj: Language not supported
- test/nuget/TestStaticLibrary1/TestStaticLibrary1.vcxproj: Language not supported
- test/nuget/TestStaticLibrary2/TestStaticLibrary2.vcxproj: Language not supported
- test/nuget/TestStaticLibrary3/TestStaticLibrary3.vcxproj: Language not supported
|
I guess I need to figure out how to build with clang-cl.exe. Last time I tried I wasn't able to get it working locally. |
Probably because the function is defined in an anonymous namespace. Could just try moving it to the global namespace |
|
I was able to figure out how to get enough of clang-cl to build to reproduce the break: I'm not sure if all 3 builds are necessary but that was enough to get the test\test directory to produce the same break as the CI build. |
|
For some reason the Clang warnings wouldn't all print out at once. I had to keep fixing warnings and rebuilding until it was green. There were a bunch of clang-only warnings that were previously unknown (mostly minor, all in test code). There was also an x86-only signed/unsigned mismatch in the |
…aller project to try and avoid memory exhaustion during link
Fixes: #1486
Why is this change being made?
The most recent PR introduced a warning for non-Clang consumers. Many projects build with warnings-as-errors so this is a build break for those projects. Because cppwinrt is widely used by many such projects it should itself build with warnings as errors enabled so that this doesn't happen again in the future. Plus it is general goodness to build with warnings cranked up and blocking.
Briefly summarize what changed
I added /WX to every single vcxproj in this repo (which required a whole lot of redundant edits). Many of them didn't have /W4 so I added it wherever it was missing. The project files definitely need some refactoring to reduce duplication. But for this change I decided to modify them as-is without also including a refactoring.
I also fixed the newly-blocking warnings. Fortunately the project was basically clean and only the recent issue needed fixing.
I also removed a typo'd (warning is singular, not plural) that was trying to disable warnings in one specific project. It has no warnings so we might as well baseline them as blocking.
How was this change tested?
It builds locally (x64 Debug+Release, only tested MSVC).