On 10/06/2015 11:29 AM, Marek Polacek wrote:
I've been chasing a bogus -Wtautological-compare warning that only
occurred in the C++ FE.  Turned out that we were building COND_EXPRs
without a location; that means that this code in warn_tautological_cmp
didn't work as planned:

   /* Don't warn for various macro expansions.  */
   if (from_macro_expansion_at (loc)
       || from_macro_expansion_at (EXPR_LOCATION (lhs))
       || from_macro_expansion_at (EXPR_LOCATION (rhs)))
     return;

If we set the location properly, we're able to detect that either LHS
or RHS comes from a macro expansion.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2015-10-06  Marek Polacek  <pola...@redhat.com>

        PR c++/67863
        * call.c (build_conditional_expr_1): Build the COND_EXPR with
        a location.

        * c-c++-common/Wtautological-compare-4.c: New test.
OK.

Related, I'll drop my proposed patch to builtins.c that worked around this problem.

Jeff

Reply via email to