-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
xmake silently hides compiler warnings #4473
Comments
It's not a bug but a design choice, see this page of the doc. You can either pass |
right, you can add |
It looks as if that policy needs to be in the root file, so I can't turn it on globally in the SDK's xmake.lua. It's a staggeringly dangerous default. I can't imagine any project actually wanting that behaviour. I need to tell every consumer of our SDK 'If you actually want the warnings that you've enabled to be visible, you need to opt into this non-default bahaviour'. What is the rationale for this? It's even worse than the 'silently throw away valid compiler flags because xmake doesn't know about them' behaviour. Warnings exist for a reason. If they're enabled, it's because the user wants to know when they do the thing that the warning warns for. You can disable any warnings that you don't want to see with compiler flags (if you remember |
Your sdk/xmake.lua is the project root file, and you should be able to turn it on in the global root scope. It's the same as this configuration. Only developers need to see the warnings in real time, while for users they simply want to compile your project and then use your framework and library binaries. They don't care about the warnings. A large number of warnings can lead to frequent output from the terminal, preventing users from viewing progress information. They don't care about the warnings. For developers, they have the ability to configure Also, |
I tried that and it does not work. The line that you link to also does not work and so I need
Most users do not build software. Two kinds of people build software:
Both of these want to see warnings. Packagers typically disable anything that hides output because they need it for their auditing.
That's an incentive to fix the warnings. It's also a reason to fix the output. Ninja does a much better job than xmake here:
I shouldn't have to do anything explicit to get a sensible default behaviour.
It needs to be in every single xmake.lua that consumes our SDK. It's another thing that we have to educate users of our SDK to do. Onboarding people to a new build system (xmake) is already hard enough. |
It should work, unless you're talking about other projects that use your sdk, rather than building the sdk itself. If it's just building the sdk, it's a global configuration and should be fully working. If it doesn't work, you can open a separate issues to report bugs. If you want other projects that consume your sdk to be on by default as well. you can set it in function firmware(name)
set_policy("build.warning", true)
end
so they can add
xmake also support it. you need only to switch to ninja theme. $ xmake g --theme=ninja
$ xmake -w
But not everyone will see this as a default behaviour. Even if I have it enabled by default. There will be other users configuring It is impossible for xmake to satisfy every user's preferences, but xmake already provides policy configuration to let users control the default behaviour of their projects. |
The SDK does not build itself, it is included in other projects.
Does that then apply to all targets or just to the firmware target?
Sane defaults are about ensuring that users don't have to explicitly do anything unless they have unusual requirements. Hiding warnings is never the right thing to do. If you don't want to see warnings, disable those warnings.
Oh, nice! It doesn't respect
Have you had feedback about that? Hiding warnings is not something I have ever wanted to do for anything other than a toy project. It's something that most secure coding guidelines and corporate policies have explicitly disabled. At the very least, a status line saying 'warnings are hidden by default, use xmake -w to show them' would reduce the surprise. |
for all
?
no, you can only use |
I have to say that not showing warnings seems like the wrong default. Somebody preferring clean output is surely less important than somebody wanting to see the same warnings they get with other build systems, without having to read the manual first. Hiding warnings by default breaks The Principle of Least Astonishment imo. |
I've started a poll, and if the majority of people agree that warning output should be turned on by default, I'll consider changing the default behaviour. |
I have enabled it. #4651 |
Xmake Version
2.8.5
Operating System Version and Architecture
macOS
Describe Bug
I normally compile with
-Werror
, so I'm not sure how long this has been an issue, but I recently started using-Wno-error=
to make warnings back into warnings in some third-party code and was surprised that xmake did not report the warnings.Even with
xmake -v
(which I need to use to make xmake not annoyingly truncate error messages in the middle), I don't get any output.Expected Behavior
Warnings should be reported to the programmer!
Project Configuration
Minimal example:
ex.c:
xmake.lua:
Running
xmake
:No warnings!
Running
xmake -v
after deleting.xmake
andbuild
:No warnings!
But running the command that xmake tells me it ran:
Additional Information and Error Logs
N/A.
The text was updated successfully, but these errors were encountered: