aboutsummaryrefslogtreecommitdiff
path: root/gcc/bitmap.h
diff options
context:
space:
mode:
authorKaveh Ghazi <ghazi@caip.rutgers.edu>2001-07-04 17:25:58 +0000
committerKaveh Ghazi <ghazi@caip.rutgers.edu>2001-07-04 17:25:58 +0000
commitdd24a3f6ca5886bf9a5df5e12241a082b8ade147 (patch)
tree6bb92d9f33321c19aa430a23b59d9bc643ac1e5c /gcc/bitmap.h
parent2f655188d940a5f7804127520f9f2eb583e91619 (diff)
* 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@43760 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r--gcc/bitmap.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 95c2a5e8f0d..58e14ee08c5 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -119,10 +119,17 @@ extern int bitmap_last_set_bit PARAMS((bitmap));
#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)))