[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] build: work around older systemtap header



On 07/05/2011 09:03 PM, Josh Stone wrote:
> I'm sorry to discover that you're fighting old sdt.h bugs.  If only we
> could put on our time-traveling cap and get it right the first time...
> We do hope that all the corner cases are dealt with correctly in the
> newest systemtap package.  Please let us know if you find otherwise.

Thanks for joining the thread.  So far, all the problems that libvirt
has had were with sdt.h 1.2 and 1.3; 1.4 compiled out of the box, and it
was only in porting to older versions where we ran into interesting issues.

> 
> All these typing issues are indeed very hairy to get right, which is a
> large part of what inspired our sdt.h rewrite in 1.4.  If you really
> want to maintain compatibility with older sdt.h, then perhaps the newer
> version can guide you in wrapping around some of the issues.  For
> example, dealing with array types, the new version has:
> 
> #define _SDT_ARGARRAY(x)	(__builtin_classify_type (x) == 14 \
> 				 || __builtin_classify_type (x) == 5)
>

Too bad gcc doesn't document this builtin.

> So perhaps you could copy that macro and let your compatibility casting
> do something like this:
> 
> #define _SDT_CAST(x) \
>     __builtin_choose_expr (_SDT_ARGARRAY(x), (uintptr_t)(x), (x))

That depends on gcc - so we'd have to provide a fallback define to a
plain cast for other compilers.  I'll keep that in mind if the current
patch for libvirt (which doesn't use any gcc extensions) proves to be
problematic.  And we may still end up defining away the problem, by just
stating that libvirt requires systemtap 1.4 or newer before libvirt will
use systemtap.

> That way array-like types will be cast, but all others will be left with
> their proper size and signedness, including e.g. any long long that
> wouldn't fit in a 32-bit intptr.  That __builtin_choose_expr only works
> in C, but hopefully for libvirt that should suffice.

Yes, libvirt is C-only.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]