public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3388] tree: Change error_operand_p to an inline function
@ 2021-09-07 18:10 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-09-07 18:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c03db573b9e619f9e4f7d7111f99877368c78e26

commit r12-3388-gc03db573b9e619f9e4f7d7111f99877368c78e26
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Aug 31 12:54:37 2021 -0400

    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.

Diff:
---
 gcc/tree.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/tree.h b/gcc/tree.h
index 1559fe060a0..1b51420819b 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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-07 18:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 18:10 [gcc r12-3388] tree: Change error_operand_p to an inline function Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).