Hi,

As I said on IRC I have hit a bug while working on a VMOD and then on
Varnish itself. I thought I had seen other false-positives but that's
the only one, in several places.

Basically it complains when you use it in an if or while statement or
I suppose anything that expects a condition, because it interprets the
outer set of parentheses as a hint not to warn about assignment. So
we've gone full circle on this one!

Do we use this kind of condition in Varnish?

   if ((var = expr))

If not I suggest we disable it in autogen.des, my workaround is to use gcc.

I haven't tried clang above 3.7.0, but basically it is _not_ looking
at preprocessed code, in which we obviously don't have the outer
parentheses:

   if (VTAILQ_EMPTY(...))

make -k log attached.

Current Travis CI continuous integration uses clang 3.4 FYI.

Best Regards,
Dridi
vsc.c:473:35: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&vsc->sf_list)->vtqh_first == ((void*)0)))
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
vsc.c:473:35: note: remove extraneous parentheses around the comparison to silence this warning
 if (((&vsc->sf_list)->vtqh_first == ((void*)0)))
     ~                            ^            ~
vsc.c:473:35: note: use '=' to turn this equality comparison into an assignment
 if (((&vsc->sf_list)->vtqh_first == ((void*)0)))
                                  ^~
                                  =
1 error generated.
make[4]: *** [libvarnishapi_la-vsc.lo] Error 1
make[4]: Target 'all-am' not remade because of errors.
make[3]: *** [all] Error 2
make[2]: *** [all-recursive] Error 1
make[2]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishadm'.
make[3]: Target 'all' not remade because of errors.
mgt/mgt_main.c:768:37: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&heritage.socks)->vtqh_first == ((void*)0)))
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
mgt/mgt_main.c:768:37: note: remove extraneous parentheses around the comparison to silence this warning
 if (((&heritage.socks)->vtqh_first == ((void*)0)))
     ~                              ^            ~
mgt/mgt_main.c:768:37: note: use '=' to turn this equality comparison into an assignment
 if (((&heritage.socks)->vtqh_first == ((void*)0)))
                                    ^~
                                    =
1 error generated.
make[3]: *** [varnishd-mgt_main.o] Error 1
cache/cache_pool.c:169:40: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 while (((&pp->idle_queue)->vtqh_first == ((void*)0)))
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
cache/cache_pool.c:169:40: note: remove extraneous parentheses around the comparison to silence this warning
 while (((&pp->idle_queue)->vtqh_first == ((void*)0)))
        ~                              ^            ~
cache/cache_pool.c:169:40: note: use '=' to turn this equality comparison into an assignment
 while (((&pp->idle_queue)->vtqh_first == ((void*)0)))
                                       ^~
                                       =
1 error generated.
make[3]: *** [varnishd-cache_pool.o] Error 1
mgt/mgt_cli.c:684:34: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&m_addr_list)->vtqh_first == ((void*)0)))
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
mgt/mgt_cli.c:684:34: note: remove extraneous parentheses around the comparison to silence this warning
 if (((&m_addr_list)->vtqh_first == ((void*)0)))
     ~                           ^            ~
mgt/mgt_cli.c:684:34: note: use '=' to turn this equality comparison into an assignment
 if (((&m_addr_list)->vtqh_first == ((void*)0)))
                                 ^~
                                 =
1 error generated.
make[3]: *** [varnishd-mgt_cli.o] Error 1
storage/storage_persistent.c:331:28: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
 if (((&silos)->vtqh_first == ((void*)0)))
      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
storage/storage_persistent.c:331:28: note: remove extraneous parentheses around the comparison to silence this warning
 if (((&silos)->vtqh_first == ((void*)0)))
     ~                     ^            ~
storage/storage_persistent.c:331:28: note: use '=' to turn this equality comparison into an assignment
 if (((&silos)->vtqh_first == ((void*)0)))
                           ^~
                           =
1 error generated.
make[3]: *** [varnishd-storage_persistent.o] Error 1
cache/cache_vcl.c:530:42: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
  else if (((&vcl->ref_list)->vtqh_first == ((void*)0)))
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
cache/cache_vcl.c:530:42: note: remove extraneous parentheses around the comparison to silence this warning
  else if (((&vcl->ref_list)->vtqh_first == ((void*)0)))
           ~                             ^            ~
cache/cache_vcl.c:530:42: note: use '=' to turn this equality comparison into an assignment
  else if (((&vcl->ref_list)->vtqh_first == ((void*)0)))
                                         ^~
                                         =
1 error generated.
make[3]: *** [varnishd-cache_vcl.o] Error 1
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishhist'.
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishlog'.
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishncsa'.
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishstat'.
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishtest'.
make[3]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../lib/libvarnishapi/libvarnishapi.la', needed by 'varnishtop'.
make[3]: Target 'all' not remade because of errors.
make[2]: *** [all-recursive] Error 1
make[2]: Target 'all' not remade because of errors.
make[3]: *** No rule to make target '../../bin/varnishd/varnishd', needed by 'include/params.rst'.
make[3]: Target 'all' not remade because of errors.
make[2]: *** [all-recursive] Error 1
make[2]: Target 'all' not remade because of errors.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to