Skip to contentSkip to conversation

open-coded offsetof() in xen/include/public/ring.h

DISCUSSION Jan Beulich 2 participants 2 messages Feb 23, 2010

lore
Share & tools
lore
#0 lore raw

Using gcc 4.5 we're seeing a build failure of the netfront driver due to its use of the __RING_SIZE() macro in the size specification of array members of struct netfront_info. Since the use of pointer types in integer constant expressions is an extension (albeit one - for the specific form used here - so far supported by all compilers Xen appears to be used with, and certainly all of the ones I was able to test), I wonder whether requiring offsetof() to be defined in order to use __RING_SIZE (or really a clone thereof usable in constant expressions, since in that case a type rather than a pointer ought to be passed in) would be acceptable.

Jan

#1 lore raw
Quoted 10 lines · Jan Beulich

Using gcc 4.5 we're seeing a build failure of the netfront driver due to its use of the __RING_SIZE() macro in the size specification of array members of struct netfront_info. Since the use of pointer types in integer constant expressions is an extension (albeit one - for the specific form used here - so far supported by all compilers Xen appears to be used with, and certainly all of the ones I was able to test), I wonder whether requiring offsetof() to be defined in order to use __RING_SIZE (or really a clone thereof usable in constant expressions, since in that case a type rather than a pointer ought to be passed in) would be acceptable.

That would be acceptable. We already require some things like stdint types to be pre-defined for example.

-- Keir