This is the mail archive of the gcc-bugs@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]

Re: Wish: __builtin_side_effect_free_p, __builtin_lvalue_p


Richard Henderson <rth@redhat.com> writes:

> On Wed, Feb 21, 2001 at 11:49:48AM +0100, Niels Möller wrote:
> >   #define FOO(f, a) ((f)->foo((f), (a)))
> 
> Try
> 
>   #define FOO(f, a)  ({ __typeof(f) f_ = (f); f_->foo(f_, (a)); })

I thought a little about that. A drawback is that it uses the gcc
block-with-value extension, and it seems more painful to
conditionalize than

  #if HAVE_BUILTIN_SIDE_EFFECT_FREE_P
  # define SIDE_EFFECT_FREE(x) __builtin_side_effect_free_p(x)
  #else
  # define SIDE_EFFECT_FREE(x) 1
  #endif

But if I move to generating all the macro definitions automatically,
it may well be the best way. What is the recommended way to check for
the block-with-value feature?

Thanks,
/Niels


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