This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is -Wparentheses b0rken in 3.3?



    Hello, hackers!


  The manual says:

" `-Wparentheses'
     Warn if parentheses are omitted in certain contexts, such as when
     there is an assignment in a context where a truth value is
     expected, or when operators are nested whose precedence people
     often get confused about. "

but my testcase says:

----------------------------<snip!>----------------------------
dk@mace /test/wparen> cat foo.c

int main (int argc, const char **argv)
{
    if (argc /= 7)
        return -1;
    return 0;
}
dk@mace /test/wparen> gcc -Wparentheses foo.c -o foo
dk@mace /test/wparen> cat bar.c

int main (int argc, const char **argv)
{
    if (argc = 7)
        return -1;
    return 0;
}
dk@mace /test/wparen> gcc -Wparentheses bar.c -o bar
bar.c: In function `main':
bar.c:4: warning: suggest parentheses around assignment used as truth value
dk@mace /test/wparen>
----------------------------<snip!>----------------------------

  This is with 3.3.3 (cygwin and mainline variants).

  Is -Wparentheses supposed to catch these cases?  I could file a bug.
Would anyone like to try it with HEAD?

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]