Re: [exim-dev] [Valgrind-users] [Bug 1050] [PATCH] Portabili…

Top Page
Delete this message
Reply to this message
Author: Bart Van Assche
Date:  
To: David Woodhouse
CC: Tony Finch, exim-dev, Chris Thompson, valgrind-users, Steen Hammerum
Subject: Re: [exim-dev] [Valgrind-users] [Bug 1050] [PATCH] Portability fixes for memcheck.h.
On Wed, Jan 12, 2011 at 8:53 AM, David Woodhouse <dwmw2@???> wrote:
>
> On Tue, 2011-01-11 at 15:12 +0000, Tony Finch wrote:
> > Exim doesn't compile with Sun or HP CC since Valgrind support was
> > added. Although valgrind.h protects against usage on unsupported
> > platforms, memcheck.h uses the __extension__() macro without checking.
> > Remove all uses since VALGRIND_DO_CLIENT_REQUEST() has all the
> > necessary portability support.
> > ---
> >
> > Chris and Steen,
> >
> > Could you please try this patch and see if it fixes the
> > compilation problems with 4.73?
>
> Thanks.
>
> This wants to go to Valgrind upstream too.
> [ ... ]
> >  /* Client-code macros to check the state of memory. */
> > @@ -176,24 +176,24 @@ typedef
> >     error message and returns the address of the first offending byte.
> >     Otherwise it returns zero. */
> >  #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)    \
> > -   (__extension__({unsigned long _qzz_res;                       \
> > +   {unsigned long _qzz_res;                                      \
> >      VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0,                      \
> >                              VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\
> >                              _qzz_addr, _qzz_len, 0, 0, 0);       \
> >      _qzz_res;                                                    \
> > -   }))
> > +   }
> > [ ... ]


Hello Tony,

Did you realize that with that patch you have broken
VALGRIND_CHECK_MEM_IS_ADDRESSABLE() and several other macros ? The
above patch converts e.g. the following code into a syntax error:

void* addr;
int len;
int addressable;

addressable = VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, len);

Bart.