Commit f2afe6dd by Marek Polacek Committed by Marek Polacek

re PR bootstrap/67030 (ARM bootstrap failure due to [-Werror=tautological-compare])

	PR bootstrap/67030
	* c-common.c (warn_tautological_cmp): Don't warn for macro expansion.

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

From-SVN: r226264
parent cca444fb
2015-07-27 Marek Polacek <polacek@redhat.com> 2015-07-27 Marek Polacek <polacek@redhat.com>
PR bootstrap/67030
* c-common.c (warn_tautological_cmp): Don't warn for macro expansion.
2015-07-27 Marek Polacek <polacek@redhat.com>
PR c++/66555 PR c++/66555
PR c/54979 PR c/54979
* c-common.c (find_array_ref_with_const_idx_r): New function. * c-common.c (find_array_ref_with_const_idx_r): New function.
......
...@@ -1890,6 +1890,12 @@ warn_tautological_cmp (location_t loc, enum tree_code code, tree lhs, tree rhs) ...@@ -1890,6 +1890,12 @@ warn_tautological_cmp (location_t loc, enum tree_code code, tree lhs, tree rhs)
if (TREE_CODE_CLASS (code) != tcc_comparison) if (TREE_CODE_CLASS (code) != tcc_comparison)
return; return;
/* 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;
/* We do not warn for constants because they are typical of macro /* We do not warn for constants because they are typical of macro
expansions that test for features, sizeof, and similar. */ expansions that test for features, sizeof, and similar. */
if (CONSTANT_CLASS_P (lhs) || CONSTANT_CLASS_P (rhs)) if (CONSTANT_CLASS_P (lhs) || CONSTANT_CLASS_P (rhs))
......
2015-07-27 Marek Polacek <polacek@redhat.com>
PR bootstrap/67030
* c-c++-common/Wtautological-compare-2.c: New test.
2015-07-27 H.J. Lu <hongjiu.lu@intel.com> 2015-07-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/66232 PR target/66232
......
/* PR bootstrap/67030 */
/* { dg-do compile } */
/* { dg-options "-Wtautological-compare" } */
extern int foo (void);
#define A a
#define B A
#define FOO (A > B)
void
fn1 (int a)
{
if (FOO);
}
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