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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-19 
14:43:05 UTC ---
This has been introduced with
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01402.html
which has been written as a better way of:
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01393.html
Perhaps the older patch is a better way than this one, which, if I understand
it right, is that ignoring of the promotion at the -Wsign-compare handling
spot?
Setting TREE_NO_WARNING, at least until we have a way to say which warnings we
want to prohibit and which should be kept, is an ugly hack and shouldn't be
taken lightly.

While Ian's patch doesn't set TREE_NO_WARNING in this testcase, it just
disables the warning if any of the operands is TREE_NO_WARNING and uses this
bit for yet another purpose.  The TREE_NO_WARNING bit in this case is set by
finish_parenthesized_expr:
1504      if (EXPR_P (expr))
1505        /* This inhibits warnings in c_common_truthvalue_conversion.  */
1506        TREE_NO_WARNING (expr) = 1;

So, what was wrong with the first approach?
And, perhaps for 4.8 we want to turn TREE_NO_WARNING bit into a bit that just
tells us whether that tree in question is in some hash table (see e.g.
DECL_HAS_VALUE_EXPR_P etc.) and that hash table would contain details what
warnings are we supposed to ignore.  This isn't the only problematic spot.

Reply via email to