Re: Problems compiling with clang (3.8.21)

2019-04-05 Thread Andreas Fett
Hi,

On 05/04/19 10:03, Aleksander Morgado wrote:
>>
>> and the compilation was successful with clang 3.8.21.
>>

Would it be possible to add a clang build the freedesktop gitlab CI?

I looked around a little bit, but unfortunately couldn't figure out what
image to use. Maybe there is someone on this list who knows more about
configuring the CI builds.

Andreas



signature.asc
Description: OpenPGP digital signature
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-05 Thread Aleksander Morgado
Hey!

> > https://gitlab.freedesktop.org/mobile-broadband/libmbim/merge_requests/8
> > https://gitlab.freedesktop.org/mobile-broadband/libqmi/merge_requests/35
> >
> https://gitlab.freedesktop.org/mobile-broadband/ModemManager/merge_requests/88
>
> I tested the patches against the following versions:
>
> - libmbim: 1.16.0
> - libqmi: 1.20.0
> - ModemManager: 1.8.0
>
> and the compilation was successful with clang 3.8.21.
>
> For ModemManager I had to modify the patch as in 1.8.0 the -Werror had
> to be added, here is the resulting diff against 1.8.0:
>
> --- a/m4/compiler_warnings.m4
> +++ b/m4/compiler_warnings.m4
> @@ -10,10 +10,10 @@ if test "$GCC" = "yes" -a "$set_more_warnings" !=
> "no"; then
> for option in -Wmissing-declarations -Wmissing-prototypes \
>   -Wdeclaration-after-statement -Wstrict-prototypes \
>   -Wno-unused-parameter -Wno-sign-compare \
> - -Wno-deprecated-declarations \
> - -Wno-unused-but-set-variable -Wformat-security; do
> + -Wno-deprecated-declarations -Wno-unused-function \
> + -Wno-unused-variable -Wformat-security; do
> SAVE_CFLAGS="$CFLAGS"
> -   CFLAGS="$CFLAGS $option"
> +   CFLAGS="$CFLAGS $option -Werror"
> AC_MSG_CHECKING([whether gcc understands $option])
> AC_TRY_COMPILE([], [],
> has_option=yes,
>

I merged those 3 branches now, thanks to all.

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-05 Thread Torsten Hilbrich
[ I forgot to include the list in my previous answer]

On 03.04.19 19:48, Ben Chan wrote:
> Could you try these patches?
>
> https://gitlab.freedesktop.org/mobile-broadband/libmbim/merge_requests/8
> https://gitlab.freedesktop.org/mobile-broadband/libqmi/merge_requests/35
>
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/merge_requests/88

I tested the patches against the following versions:

- libmbim: 1.16.0
- libqmi: 1.20.0
- ModemManager: 1.8.0

and the compilation was successful with clang 3.8.21.

For ModemManager I had to modify the patch as in 1.8.0 the -Werror had
to be added, here is the resulting diff against 1.8.0:

--- a/m4/compiler_warnings.m4
+++ b/m4/compiler_warnings.m4
@@ -10,10 +10,10 @@ if test "$GCC" = "yes" -a "$set_more_warnings" !=
"no"; then
for option in -Wmissing-declarations -Wmissing-prototypes \
  -Wdeclaration-after-statement -Wstrict-prototypes \
  -Wno-unused-parameter -Wno-sign-compare \
- -Wno-deprecated-declarations \
- -Wno-unused-but-set-variable -Wformat-security; do
+ -Wno-deprecated-declarations -Wno-unused-function \
+ -Wno-unused-variable -Wformat-security; do
SAVE_CFLAGS="$CFLAGS"
-   CFLAGS="$CFLAGS $option"
+   CFLAGS="$CFLAGS $option -Werror"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,


Torsten

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-03 Thread Ben Chan
Could you try these patches?

https://gitlab.freedesktop.org/mobile-broadband/libmbim/merge_requests/8
https://gitlab.freedesktop.org/mobile-broadband/libqmi/merge_requests/35
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/merge_requests/88

Thanks,
Ben


On Tue, Apr 2, 2019 at 10:42 PM Torsten Hilbrich
 wrote:
>
> 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
>
> ___
> ModemManager-devel mailing list
> ModemManager-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-02 Thread Torsten Hilbrich
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

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-02 Thread Ben Chan
autoconf seems to set GCC = yes for clang.  I believe clang supports
Wunused-variable instead of Wunused-but-set-variable. We could use the
former, which is also supported by gcc.   For other unsupported options, we
can work around with -Wno-unknown-warning-option or -Xclang-only=

On Tue, Apr 2, 2019 at 8:02 AM Dan Williams  wrote:

> On Tue, 2019-04-02 at 15:34 +0200, Torsten Hilbrich wrote:
> > Hello,
> >
> > I tried to compile libmbim (1.16.0), libqmi (1.20.0) and ModemManager
> > (1.8.0) with clang and got strange results.
> >
> > I set the environment variables CC=clang and CXX=clang++ and ran the
> > autogen.sh, configure, and make steps.
> >
> > Then the configure noticed that clang was used and checked for the
> > supported warning options:
> >
> > CC='clang'
> > configure:3408: checking for gcc
> > configure:3435: result: clang
> > ...
> > configure:17644: checking whether gcc understands -Wno-unused-but-
> > set-variable
> > configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-
> > declarations -Wmissing-prototypes -Wdeclaration-after-statement
> > -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-
> > deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
> > warning: unknown warning option '-Wno-unused-but-set-variable'; did
> > you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
> > 1 warning generated.
> > configure:17657: $? = 0
> > configure:17666: result: yes
>
> 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?
>
> Also, does making this change in m4/compiler_warnings.m4 of
> ModemManager sources help?
>
> -   CFLAGS="$CFLAGS $option"
> +   CFLAGS="$CFLAGS $option -Werror"
>
> Dan
>
> >
> > However, when compiling the code I got the following error messages:
> >
> > make[4]: Entering directory
> > '/build/client/clang/freedesktop/modemmanager/work/modemmanager/libqc
> > dm/src'
> >   CC   libqcdm_la-com.lo
> > error: unknown warning option '-Wno-unused-but-set-variable'; did you
> > mean '-Wno-unused-const-variable'?
> >   [-Werror,-Wunknown-warning-option]
> > Makefile:516: recipe for target 'libqcdm_la-com.lo' failed
> > make[4]: *** [libqcdm_la-com.lo] Error 1
> >
> > I assume that checking in configure is done without -Werror, but
> > compilation at least in libqdcdm is done with -Werror.
> >
> >
> > It this a known problem? Are fixes welcome to support compilation
> > with clang?
> >
> > The same problem happened in libmbim and libqmi.
> >
> > With regards,
> >
> >   Torsten Hilbrich
> >
> >
> > ___
> > ModemManager-devel mailing list
> > ModemManager-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
>
> ___
> ModemManager-devel mailing list
> ModemManager-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Re: Problems compiling with clang (3.8.21)

2019-04-02 Thread Dan Williams
On Tue, 2019-04-02 at 15:34 +0200, Torsten Hilbrich wrote:
> Hello,
> 
> I tried to compile libmbim (1.16.0), libqmi (1.20.0) and ModemManager
> (1.8.0) with clang and got strange results.
> 
> I set the environment variables CC=clang and CXX=clang++ and ran the
> autogen.sh, configure, and make steps.
> 
> Then the configure noticed that clang was used and checked for the
> supported warning options:
> 
> CC='clang'
> configure:3408: checking for gcc
> configure:3435: result: clang
> ...
> configure:17644: checking whether gcc understands -Wno-unused-but-
> set-variable
> configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-
> declarations -Wmissing-prototypes -Wdeclaration-after-statement
> -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-
> deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
> warning: unknown warning option '-Wno-unused-but-set-variable'; did
> you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
> 1 warning generated.
> configure:17657: $? = 0
> configure:17666: result: yes

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?

Also, does making this change in m4/compiler_warnings.m4 of
ModemManager sources help?

-   CFLAGS="$CFLAGS $option"
+   CFLAGS="$CFLAGS $option -Werror"

Dan

> 
> However, when compiling the code I got the following error messages:
> 
> make[4]: Entering directory
> '/build/client/clang/freedesktop/modemmanager/work/modemmanager/libqc
> dm/src'
>   CC   libqcdm_la-com.lo
> error: unknown warning option '-Wno-unused-but-set-variable'; did you
> mean '-Wno-unused-const-variable'?
>   [-Werror,-Wunknown-warning-option]
> Makefile:516: recipe for target 'libqcdm_la-com.lo' failed
> make[4]: *** [libqcdm_la-com.lo] Error 1
> 
> I assume that checking in configure is done without -Werror, but
> compilation at least in libqdcdm is done with -Werror.
> 
> 
> It this a known problem? Are fixes welcome to support compilation
> with clang?
> 
> The same problem happened in libmbim and libqmi.
> 
> With regards,
> 
>   Torsten Hilbrich
> 
> 
> ___
> ModemManager-devel mailing list
> ModemManager-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel

Problems compiling with clang (3.8.21)

2019-04-02 Thread Torsten Hilbrich
Hello,

I tried to compile libmbim (1.16.0), libqmi (1.20.0) and ModemManager (1.8.0) 
with clang and got strange results.

I set the environment variables CC=clang and CXX=clang++ and ran the 
autogen.sh, configure, and make steps.

Then the configure noticed that clang was used and checked for the supported 
warning options:

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations 
-Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes 
-Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations 
-Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean 
'-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes


However, when compiling the code I got the following error messages:

make[4]: Entering directory 
'/build/client/clang/freedesktop/modemmanager/work/modemmanager/libqcdm/src'
  CC   libqcdm_la-com.lo
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean 
'-Wno-unused-const-variable'?
  [-Werror,-Wunknown-warning-option]
Makefile:516: recipe for target 'libqcdm_la-com.lo' failed
make[4]: *** [libqcdm_la-com.lo] Error 1

I assume that checking in configure is done without -Werror, but compilation at 
least in libqdcdm is done with -Werror.


It this a known problem? Are fixes welcome to support compilation with clang?

The same problem happened in libmbim and libqmi.

With regards,

Torsten Hilbrich


___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel