-
-
Notifications
You must be signed in to change notification settings - Fork 618
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
Added /Wall to possible warning levels for Visual Studio #1447
Conversation
The 'warnings' keyword now accepts a value of 'High' to generate the /W4 MSVC compiler flag as well as 'Extra' to generate the /Wall flag.
Tests fail on CI, but that's to be expected as the XML output changed. Locally, when running |
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.
If you look at the CI test results you'll see that there are some additional unit tests that need to be patched up to reflect your change. Is that something you can take a look at?
Appreciate the detailed PR!
Oops, I see where the additional tests are now.... Will update them to reflect the new changes. |
Test suite now properly checks the new "High" and "Extra" warning options
I'm not entirely sold on this PR. You're saying that
My projects use I appreciate that people want to turn warnings "Extra"
filter { "action:vs*" }
warnings "High"
filter {} just to achieve the same functionality that they have now with |
I agree with the OP that Having poked around a bit, I think we should leave @ethan-wallace What say you? Would you be willing to rework this PR to just map |
Would it make sense to have an All entry instead after Extra that maps to -Weverything? In case you really want to turn the entire world of warnings on? |
I'm good with that. Maybe we should call it "Everything"? |
That sounds reasonable to me. If no-one has any further revisions I'll see what I can do about adding an "Everything" entry on top of "Extra". In this scenario, the new table would be as follows:
I primarily use Visual Studio and MSVC, but looking at the code there doesn't seem to be a CFLAG emitted on GCC/clang for a default warning level. Let me know if I'm off about that. I also don't have much experience with the C# compilers - if needed I will go ahead with just MSVC and GCC, get your feedback, and then take a stab at dotnet just so everything is consistent across the toolsets. |
The flags for GCC fall under the As for what needs to be updated, anything that uses
Where you don't know what the value should be, use the value for premake-core/src/tools/clang.lua Line 63 in b47a949
|
This is by design: |
Both Clang and GCC do support this flag (a quick godbolt experiment confirms it), what documentation did you check? |
I always forget that exists when it comes to flags, oops!
Just the Clang docs, the flag doesn't seem to be listed, I might have missed it but searching the page for |
Any thoughts or progress on this? I'm going to be pushing back a little harder on "stale" PRs so we don't end up with a collection of incomplete work that no one intends to finish (again). If this isn't be actively worked, let's create an issue to note it and then close the PR. |
Most of the work has been done, have been obscenely busy the last few weeks with work. I'll see if I can get an update over the weekend. Sorry for the delay! |
No worries! I certainly know how that is. Just checking in… |
Added new warning level "Everything" which turns on all available compiler warnings. Updated "High" and "Extra" to reflect actual differences in emitted compiler flags.
Finally had some time to get this squared away. I've added distinct "High", "Extra", and "Everything" flags as discussed, and where possible added tests for all of them (e.g., What I haven't added is the extra flags for the SNC compiler; I have no experience with it and couldn't find any documentation. I see there is a single flag in there right now for "Extra" but I didn't want to add any flags I wasn't 100% sure would actually be valid. If anyone has documentation/knows what flags are valid please let me know and I'll add them in. As well, I couldn't find documentation for what Barring that, if everything looks good I'll squash the commits for merging |
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.
Looks good, thanks! Waiting the CI checks to pass…
Travis-CI seems incredibly flaky when it comes to connecting the PR to the build job. I've manually kicked it off, but one of our unit tests is failing due to httpbin.org having a broken redirect test. @starkos I'm going to merge this since our master build is already failing for the same reason. |
Please update the document https://premake.github.io/docs/warnings/ to reflect this change |
This small PR follows an old discussion and closes #709
It applies only to VS2010 and above.
What does this PR do?
The current behaviour of the
warnings
keyword when using Premake for a Visual Studio project is as follows:/W0
/W3
/W4
As per the referenced issue, this PR changes the behaviour to the following (bringing it in-line with how these flags are generated when using GCC: and clang):
/W0
/W3
/W4
/Wall
In
src/tools/msc.lua
the list of warning compiler flags contains both"High"
and"Extra"
with a value of"/W4"
, however inmodules/vstudio/vs2010_vcxproj.lua
the map to generate the XML Visual Studio expects only containsOff
andExtra
, so even if a user specifiedwarnings "High"
they would still get/W3
(the default when the passed value isn't in the map) instead of/W4
(which they probably expected). I downloaded a fresh Premake binary from the website and confirmed that this was indeed the case.I have also altered the unit test in
test_msc.lua
, specificallysuite.cflags_OnExtraWarnings
, to ensure that the proper flag is generated. Running the Premake test suite I get no errors.Testing was done on Windows 10 Pro (64-bit) version 1909.
How does this PR change Premake's behavior?
When running Premake with
warnings "Extra"
and generating a Visual Studio solution (VS2010 or above), the resultant.vcxproj
will generate with<WarningLevel>EnableAllWarnings</WarningLevel>
instead of<WarningLevel>Level4</WarningLevel>
Running Premake with
warnings "High"
and generating a Visual Studio solution (VS2010 or above), the resultant.vcxproj
will generate with<WarningLevel>Level4</WarningLevel>
instead of<WarningLevel>Level3</WarningLevel>
Anything else we should know?
The
/Wall
keyword includes all of the warnings in/W4
plus some extra ones off by default. These extra warnings can be turned on piecemeal via theenablewarnings
keyword, but it would be nice to be able to just have to set the single flag.In the referenced issue, a few commenters brought up the importance of allowing
/W4
to remain available as an option, which this PR does (/W4
is still available throughwarnings "High"
).Overall, I believe that this PR brings MSVC in line with how Premake deals with GCC;
warnings "High"
leads to the generation of the flag-Wall
whilewarnings "Extra"
leads to the generation of-Wall -Wextra
.