aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-08-31 12:54:37 -0400
committerJason Merrill <jason@redhat.com>2021-09-07 14:09:38 -0400
commitc03db573b9e619f9e4f7d7111f99877368c78e26 (patch)
tree6339d667948245908afdd9af00080eda82edfc53 /gcc/tree.h
parent81f9718139cb1cc164ada411ada8cca9f32b8be8 (diff)
downloadgcc-c03db573b9e619f9e4f7d7111f99877368c78e26.zip
gcc-c03db573b9e619f9e4f7d7111f99877368c78e26.tar.gz
gcc-c03db573b9e619f9e4f7d7111f99877368c78e26.tar.bz2
tree: Change error_operand_p to an inline function
I've thought for a while that many of the macros in tree.h and such should become inline functions. This one in particular was confusing Coverity; the null check in the macro made it think that all code guarded by error_operand_p would also need null checks. gcc/ChangeLog: * tree.h (error_operand_p): Change to inline function.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 1559fe0..1b51420 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4365,11 +4365,14 @@ tree_strip_any_location_wrapper (tree exp)
#define long_long_integer_type_node integer_types[itk_long_long]
#define long_long_unsigned_type_node integer_types[itk_unsigned_long_long]
-/* True if NODE is an erroneous expression. */
+/* True if T is an erroneous expression. */
-#define error_operand_p(NODE) \
- ((NODE) == error_mark_node \
- || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
+inline bool
+error_operand_p (const_tree t)
+{
+ return (t == error_mark_node
+ || (t && TREE_TYPE (t) == error_mark_node));
+}
/* Return the number of elements encoded directly in a VECTOR_CST. */