+2001-07-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * bitmap.c (bitmap_union_of_diff): Don't use BITMAP_ALLOCA.
+
+ * bitmap.h (BITMAP_ALLOCA): Don't pass alloca as an argument to a
+ function.
+
2001-07-04 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/include: New directory.
bitmap c;
{
int changed = 0;
- bitmap temp = BITMAP_ALLOCA ();
+ bitmap temp = BITMAP_XMALLOC ();
+
bitmap_operation (temp, b, c, BITMAP_AND_COMPL);
changed = bitmap_operation (dst, temp, a, BITMAP_IOR);
+ BITMAP_XFREE (temp);
return changed;
}
#define BITMAP_OBSTACK_ALLOC(OBSTACK) \
bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head)))
-/* Allocate a bitmap with alloca. */
-#define BITMAP_ALLOCA() \
- bitmap_initialize ((bitmap) alloca (sizeof (bitmap_head)))
-
+/* Allocate a bitmap with alloca. Note alloca cannot be passed as an
+ argument to a function, so we set a temporary variable to the value
+ returned by alloca and pass that variable to bitmap_initialize().
+ PTR is then set to the value returned from bitmap_initialize() to
+ avoid having it appear more than once in case it has side effects. */
+#define BITMAP_ALLOCA(PTR) \
+do { \
+ bitmap temp_bitmap_ = (bitmap) alloca (sizeof (bitmap_head)); \
+ (PTR) = bitmap_initialize (temp_bitmap_); \
+} while (0)
+
/* Allocate a bitmap with xmalloc. */
#define BITMAP_XMALLOC() \
bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head)))