Namely, un-parenthesized assignments should be warned about, as in:

void func(void);

void test(int n) {
        if(n = 1)
                func();
        if(__builtin_expect(n = 1, 0))
                func();
}

If __builtin_expect() is expected to be used outside of conditionals (the only
useful case I can see is inside switch()), then the treatment of the argument
should be done with knowledge of the surrounding context.


-- 
           Summary: __builtin_expect()'s first argument should be treated
                    like other conditional expressions
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbeulich at novell dot com
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34781

Reply via email to