Problems compiling with clang (3.8.21)

Torsten Hilbrich torsten.hilbrich at secunet.com
Wed Apr 3 05:42:22 UTC 2019


On 02.04.19 17:02, Dan Williams wrote:
> I think -Wno-unused-but-set-variable is actually a mistake and it
> should be "-Wunused-but-set-variable". But that causes build errors
> that we should fix.
> 
> Does clang support -Wunused-but-set-variable?

No.

> 
> Also, does making this change in m4/compiler_warnings.m4 of
> ModemManager sources help?
> 
> -               CFLAGS="$CFLAGS $option"
> +               CFLAGS="$CFLAGS $option -Werror"

This did the job of correctly checking which option is supported:

...
checking whether gcc understands -Wunused-but-set-variable... no
...

It seems clang is failing on unknown warning options only when using -Werror.

This modification of adding -Werror was sufficient for ModemManager. For libmbim and libqmi the additional option "-Wno-unused-function" was also required, otherwise clang would report errors like:

qmi-ctl.c:352:1: error: unused function 'qmi_message_result_validate' [-Werror,-Wunused-function]
qmi_message_result_validate (
^
1 error generated.

or

mbim-basic-connect.c:89:1: error: unused function '_mbim_message_read_mbim_pin_desc_struct_array' [-Werror,-Wunused-function]
_mbim_message_read_mbim_pin_desc_struct_array (
^

	Torsten



More information about the ModemManager-devel mailing list