clang++ warning: “warning: unknown warning option

2019-07-21 16:57发布

问题:

Having installed LLVM on Ubuntu 16.04 using the command:

sudo apt-get install clang llvm

I get the following error when compiling:

nlykkei@nlykkei-VirtualBox:~$ clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs` -o toy
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean
      '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.

To be specific, I follow the tutorial: http://llvm.org/docs/tutorial/LangImpl03.html on the LLVM website.

The version of LLVM is 3.8.

How do I get rid of this warning?

Thanks.

回答1:

This is a bug in llvm-config. Long story short, llvm-config outputs -Wno-maybe-uninitialized which is not a warning implemented by clang.

One possible workaround is to add an extra flag squelching warnings about unknown warnings.

clang++ <your flags> -Wno-unknown-warning-option `llvm-config ...`