aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1993-01-25 03:40:07 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1993-01-25 03:40:07 +0000
commit82bde8543bc70f5cec5fe54150f4907d8445b8c9 (patch)
tree590dc583870707060c0197b1ad2619268921b078
parent21cd4ffcadaa122bbd82c734f250b16c8946ce62 (diff)
downloadgcc-82bde8543bc70f5cec5fe54150f4907d8445b8c9.zip
gcc-82bde8543bc70f5cec5fe54150f4907d8445b8c9.tar.gz
gcc-82bde8543bc70f5cec5fe54150f4907d8445b8c9.tar.bz2
Do not give a warning for a plain 0 used in a pointer context.
From-SVN: r3322
-rw-r--r--gcc/c-typeck.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index d1f49a7..98a3c9e 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -56,6 +56,8 @@ static void pedantic_lvalue_warning ();
tree truthvalue_conversion ();
void incomplete_type_error ();
void readonly_warning ();
+static tree internal_build_compound_expr ();
+
/* Do `exp = require_complete_type (exp);' to make sure exp
does not have an incomplete type. (That includes void types.) */
@@ -3633,6 +3635,14 @@ tree
build_compound_expr (list)
tree list;
{
+ internal_build_compound_expr (list, TRUE);
+}
+
+static tree
+internal_build_compound_expr (list, first_p)
+ tree list;
+ int first_p;
+{
register tree rest;
if (TREE_CHAIN (list) == 0)
@@ -3646,7 +3656,7 @@ build_compound_expr (list)
#endif
/* Don't let (0, 0) be null pointer constant. */
- if (integer_zerop (TREE_VALUE (list)))
+ if (!first_p && integer_zerop (TREE_VALUE (list)))
return non_lvalue (TREE_VALUE (list));
return TREE_VALUE (list);
}
@@ -3659,7 +3669,7 @@ build_compound_expr (list)
= default_conversion (TREE_VALUE (TREE_CHAIN (list)));
}
- rest = build_compound_expr (TREE_CHAIN (list));
+ rest = internal_build_compound_expr (TREE_CHAIN (list), FALSE);
if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
return rest;