meson: Cannot disable warnings in subproject -- warning_level should offer option to pass `-w` to GCC and Clang

In the release notes for Meson 0.50.0 is stated that a warning level of 0 does not enable any static analysis checks. GCC and Clang have a flag that does just that, -w, but it seems that Meson doesn’t pass it to the compiler.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

@punytroll look at werror, warning_level, or default_library

Disabling warnings in a subproject is an interesting angle that unfortunately wasn’t mentioned in the OP.

And apparently, it turns out you cannot use -Dsubproject:c_args=-w, since c_args is not per subproject. So that shoots down my initial thought on how to do this. Which means adding a warning_level that does it, would be an understandable desire.

Ok, so “0” means “use the default warning level of whatever compiler you are using”, and not “none”, even though the docs explicitly say that warning_level=0 means “none”. (Set the warning level. From 0 = none to 3 = highest).

You’re right in saying that users need this “don’t do anything” option, but it is also true that the docs are a bit misleading and at the moment users don’t have the option to disable warnings (a thing that would be particularly useful for subprojects).

Maybe add a warning_level=-1? Doesn’t look that great, but I don’t see alternatives 😕 GCC/Clang have -w, MSVC has /w.

Also @eli-schwartz, could you please avoid closing issues without even waiting for a response? That’s not really nice…