Commit d0eccfcd by Jason Merrill Committed by Jason Merrill

c-common.c (shorten_compare): Don't -Wtype-limits if the non-constant operand comes from a macro.

	* c-common.c (shorten_compare): Don't -Wtype-limits if the
	non-constant operand comes from a macro.

From-SVN: r230589
parent 7d7e7aca
2015-11-18 Jason Merrill <jason@redhat.com>
* c-common.c (shorten_compare): Don't -Wtype-limits if the
non-constant operand comes from a macro.
2015-11-17 Jason Merrill <jason@redhat.com> 2015-11-17 Jason Merrill <jason@redhat.com>
PR bootstrap/68346 PR bootstrap/68346
......
...@@ -4650,7 +4650,9 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, ...@@ -4650,7 +4650,9 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
type = c_common_unsigned_type (type); type = c_common_unsigned_type (type);
} }
if (TREE_CODE (primop0) != INTEGER_CST) if (TREE_CODE (primop0) != INTEGER_CST
/* Don't warn if it's from a macro. */
&& !from_macro_expansion_at (EXPR_LOCATION (primop0)))
{ {
if (val == truthvalue_false_node) if (val == truthvalue_false_node)
warning_at (loc, OPT_Wtype_limits, warning_at (loc, OPT_Wtype_limits,
......
// { dg-options -Wtype-limits }
unsigned char array[4];
bool b;
#define VAL (b ? array[0] : (unsigned char)0)
int main()
{
if (VAL > 1000)
__builtin_abort();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment