Mailing List Archive

VTAILQ_EMPTY vs -Wparentheses-equality with clang
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
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
Weird. I'm using clang 3.7 and I'm not seeing any warnings.

What OS is this?

On Mon, Apr 4, 2016 at 2:46 PM, Dridi Boukelmoune <dridi@varni.sh> wrote:

> 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
>
> _______________________________________________
> varnish-dev mailing list
> varnish-dev@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
On Mon, Apr 4, 2016 at 4:43 PM, Federico Schwindt <fgsch@lodoss.net> wrote:
> Weird. I'm using clang 3.7 and I'm not seeing any warnings.
>
> What OS is this?

You know the OS is Fedora ;)

I'm running f23, up to date:
$ clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix

Maybe it's fixed in 3.7.1? What's your clang version?

Thanks

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
--------
In message <CAJV_h0bcW6MUNHbc8Qy4emHcrFfdvsGiPGSkoUSTQpXXrA64_g@mail.gmail.com>
, Federico Schwindt writes:

>Weird. I'm using clang 3.7 and I'm not seeing any warnings.

I havn't compared vqueue.h to FreeBSD's sys/queue.h, but since
FreeBSD is on Clain 3.8 now, that would be a place to look...


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
I think FreeBSD uses *-Wno-parentheses-equality. *

Might be worth adding it (if supported).


On Mon, Apr 4, 2016 at 3:57 PM, Poul-Henning Kamp <phk@phk.freebsd.dk>
wrote:

> --------
> In message <
> CAJV_h0bcW6MUNHbc8Qy4emHcrFfdvsGiPGSkoUSTQpXXrA64_g@mail.gmail.com>
> , Federico Schwindt writes:
>
> >Weird. I'm using clang 3.7 and I'm not seeing any warnings.
>
> I havn't compared vqueue.h to FreeBSD's sys/queue.h, but since
> FreeBSD is on Clain 3.8 now, that would be a place to look...
>
>
> --
> Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG | TCP/IP since RFC 956
> FreeBSD committer | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
--------
In message <CAJV_h0ZSJ3HieFBPA6NZGOSg-r_CAAVXJMN9D=NJRQ0nuZvR_w@mail.gmail.com>
, Federico Schwindt writes:

>I think FreeBSD uses *-Wno-parentheses-equality. *
>
>Might be worth adding it (if supported).

I've been pondering writing a program to automatically detect the
optimal set of compiler flags for any given source code, but I
have not been able to get myself to do so, because to follow style
in that space I would have to write it in PL/1, Modula-3,
SmallTalk or some other horrid and obsolete language.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
On Mon, Apr 4, 2016 at 4:57 PM, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> --------
> In message <CAJV_h0bcW6MUNHbc8Qy4emHcrFfdvsGiPGSkoUSTQpXXrA64_g@mail.gmail.com>
> , Federico Schwindt writes:
>
>>Weird. I'm using clang 3.7 and I'm not seeing any warnings.
>
> I havn't compared vqueue.h to FreeBSD's sys/queue.h, but since
> FreeBSD is on Clain 3.8 now, that would be a place to look...

I just tried running an autogen.des'ed build with clang 3.8 (Fedora
24) and I still get the same problem.

Dridi

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
clang-3.8: clang version 3.8.0-2 (tags/RELEASE_380/final)

No issues. Looks like it's Fedora specific.

On Thu, Jun 23, 2016 at 4:49 PM, Dridi Boukelmoune <dridi@varni.sh> wrote:

> On Mon, Apr 4, 2016 at 4:57 PM, Poul-Henning Kamp <phk@phk.freebsd.dk>
> wrote:
> > --------
> > In message <
> CAJV_h0bcW6MUNHbc8Qy4emHcrFfdvsGiPGSkoUSTQpXXrA64_g@mail.gmail.com>
> > , Federico Schwindt writes:
> >
> >>Weird. I'm using clang 3.7 and I'm not seeing any warnings.
> >
> > I havn't compared vqueue.h to FreeBSD's sys/queue.h, but since
> > FreeBSD is on Clain 3.8 now, that would be a place to look...
>
> I just tried running an autogen.des'ed build with clang 3.8 (Fedora
> 24) and I still get the same problem.
>
> Dridi
>
Re: VTAILQ_EMPTY vs -Wparentheses-equality with clang [ In reply to ]
On Thu, Jun 23, 2016 at 5:57 PM, Federico Schwindt <fgsch@lodoss.net> wrote:
> clang-3.8: clang version 3.8.0-2 (tags/RELEASE_380/final)
>
> No issues. Looks like it's Fedora specific.

I'll assume good faith although Fedora has an official bias towards
GCC and file a bug there.

_______________________________________________
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev