Re: RFC/error: Re: [PATCH 3/6] perf tools: Improve thread_stack__event() for trace begin / end

From: Arnaldo Carvalho de Melo
Date: Thu Sep 20 2018 - 14:19:03 EST


Em Thu, Sep 20, 2018 at 03:13:52PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Sep 19, 2018 at 02:23:35PM +0300, Adrian Hunter escreveu:
> > + return thread_stack__push(thread->ts, ret_addr,
> > + flags && PERF_IP_FLAG_TRACE_END);
> > + } else if (flags & PERF_IP_FLAG_TRACE_BEGIN) {
>
> Some of the build containers caught this:
>
> util/thread-stack.c:274:14: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
> flags && PERF_IP_FLAG_TRACE_END);
> ^ ~~~~~~~~~~~~~~~~~~~~~~
> util/thread-stack.c:274:14: note: use '&' for a bitwise operation
> flags && PERF_IP_FLAG_TRACE_END);
> ^~
> &
> util/thread-stack.c:274:14: note: remove constant to silence this warning
> flags && PERF_IP_FLAG_TRACE_END);
> ~^~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
>
> --------------------------
>
> Should be a '&' as suggested by:
>
> 16 146.45 debian:9 : FAIL gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
> 17 138.35 debian:experimental : FAIL gcc (Debian 8.2.0-4) 8.2.0

Ok, the compilers that caught this was:

debian:9: clang version 3.8.1-24 (tags/RELEASE_381/final)
debian:experimental: clang version 6.0.1-6 (tags/RELEASE_601/final)


Those gcc versions (6.3 and 8.2) compiled it without warnings.

- Arnaldo

>
> I'm changing this here, please Ack.
>
> - Arnaldo