+2016-05-04 Marek Polacek <polacek@redhat.com>
+
+ PR c/48778
+ * c-typeck.c (build_binary_op): Don't issue -Waddress warnings
+ for macro expansions.
+
2016-05-03 Marek Polacek <polacek@redhat.com>
PR c/70859
else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1))
{
if (TREE_CODE (op0) == ADDR_EXPR
- && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0)))
+ && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))
+ && !from_macro_expansion_at (location))
{
if (code == EQ_EXPR)
warning_at (location,
else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0))
{
if (TREE_CODE (op1) == ADDR_EXPR
- && decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0)))
+ && decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0))
+ && !from_macro_expansion_at (location))
{
if (code == EQ_EXPR)
warning_at (location,
+2016-05-04 Marek Polacek <polacek@redhat.com>
+
+ PR c/48778
+ * gcc.dg/Waddress-2.c: New test.
+
2016-05-04 Alan Modra <amodra@gmail.com>
* gcc.target/powerpc/pr70866.c: New.
--- /dev/null
+/* PR c/48778 */
+/* { dg-do compile } */
+/* { dg-options "-Waddress" } */
+
+#define NULL ((void *) 0)
+
+#define M1(b) ((b) != NULL ? 0 : (b))
+#define M2(b) ((b) == NULL ? 0 : (b))
+#define M3(b) (NULL != (b) ? 0 : (b))
+#define M4(b) (NULL == (b) ? 0 : (b))
+
+int
+func (int b)
+{
+ if (M1 (&b) > 0)
+ return 1;
+ if (M2 (&b) > 0)
+ return 2;
+ if (M3 (&b) > 0)
+ return 3;
+ if (M4 (&b) > 0)
+ return 4;
+ return 0;
+}