[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] trunk r117897: Port USE_LOCAL_ALLOCATORS code to clang
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] trunk r117897: Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. |
Date: |
Wed, 17 Sep 2014 22:43:22 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> +/* Alignment fixup needed for alloca. GCC aligns alloca properly already,
> + Clang sometimes doesn't, and play it safe for other random compilers. */
> +# if __GNUC__ && !__clang__
> +enum { ALLOCA_FIXUP = 0 };
> +# else
> +enum { ALLOCA_FIXUP = GCALIGNMENT - 1 };
> +# endif
> +
> +/* Declare a void * variable PTR and set it to a properly-aligned array of
> + N newly allocated bytes with function lifetime. */
> +# define LOCAL_ALLOCA(ptr, n) \
> + void *ptr = alloca ((n) + ALLOCA_FIXUP); \
> + ptr = (void *) ((intptr_t) ptr_ & ~(ALLOCA_FIXUP))
I find this hideous. I'd prefer we just don't use alloca in
those cases where alignment would be a problem.
Stefan
- Re: [Emacs-diffs] trunk r117897: Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.,
Stefan Monnier <=