From 266aae9b3b8dd7886098ccacedc1934d3c4e2061 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Wed, 4 Jul 2001 17:25:58 +0000 Subject: bitmap.c (bitmap_union_of_diff): Don't use BITMAP_ALLOCA. * 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. From-SVN: r43760 --- gcc/bitmap.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'gcc/bitmap.h') diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 95c2a5e..58e14ee 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))) -- cgit v1.1