This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples] creating singleton sequences


Hey there.

Frequently we want to create a new sequence that contains one element.
This is especially common when wrapping things with a BIND or in a TRY
block.

I'm tired of typing the same thing over and over.

How about a convenience function like this?

Index: gimple.h
===================================================================
--- gimple.h    (revision 134265)
+++ gimple.h    (working copy)
@@ -189,6 +189,17 @@ gimple_seq_empty_p (const_gimple_seq s)
 }
 
 
+/* Allocate a new sequence and initialize its first element with STMT.
*/
+
+static inline gimple_seq
+gimple_seq_alloc_with_stmt (gimple stmt)
+{
+  gimple_seq seq = NULL;
+  gimple_seq_add_stmt (&seq, stmt);
+  return seq;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]