[vlc-devel] [vlc-commits] contrib: avoid clang warning about invalid compiler arguments

Martin Storsjö martin at martin.st
Fri Dec 20 09:52:20 CET 2019

On Fri, 20 Dec 2019, Marvin Scholz wrote:

> On 20 Dec 2019, at 9:33, Steve Lhomme wrote:
>> reverted as it breaks a lot of things
>> The patch does the opposite of what it claims (turns warnings into 
>> errors instead of silencing them)
> Silencing invalid-command-line-argument would not be acceptable, as it 
> means you can add invalid
> argument accidentally and will never notice it and just wonder why 
> things dont work the way
> you expected. So this would cause a debugging nightmare when using 
> additional flags…

The full story is, normally clang only warns instead of errors out on 
unknown/unsupported flags. This is good in most cases, as it doesn't 
always exactly support the same flags as gcc does.

However, if you have a configure style script (or any code in build 
systems setup really), which tries to detect which options are supported, 
clang will accept all of them, as it will merely print a warning when you 
try to use an unsupported one.

With such a configure setup, it might be good to enable 
-Werror=invalid-command-line-argument, at least during the section of the 
configure style that tests for options.

But it's not a good idea to enable it with build systems that use a fixed, 
unprobed set of command line flags.

// Martin

More information about the vlc-devel mailing list