|
Boost : |
Subject: Re: [boost] Win64 and abi_prefix.hpp/abi_suffix.hpp warnings
From: John Maddock (john_at_[hidden])
Date: 2008-09-26 04:40:32
Chris Newbold wrote:
>>> I'm unclear on the rationale for forcing 8-byte alignment in
>>> config/abi/msvc_(pre|suf)fix.hpp: 8-byte alignment is the compiler
>>> default. Is there concern over Boost headers being included in a
>>> context where the alignment has been otherwise artificially altered?
Yes: it's to ensure that the included header is binary compatible with the
boost binaries, which are all built with default alignment settings.
Obviously for header only libraries, including the abi_prefix/suffix headers
is unnecessary.
>> I'm starting to question the wisdom of unconditionally forcing
>> 8-byte alignment in the MSVC ABI headers, particularly given that
>> this happens on two architectures (x86 and x86_64) that have
>> different pointer widths.
>>
>> I can see some merit to enforcing a uniform alignment for Boost to
>> avoid ABI issues due to users' project settings, etc., but I think
>> that we need to account for the fact that different architectures
>> have different default alignments. On x86_64, the default alignment
>> for MSVC is 16 bytes.
>>
>> However, changing msvc_prefix.hpp to look like...
>>
>> #if defined(_M_X64)
>> # pragma pack(push,16)
>> #else
>> # pragma pack(push,8)
>> #endif
>>
>> ... is only an incomplete solution. It suppresses the warnings in
>> the default case where the user has not already changed the
>> alignment. If, for whatever reason, the user has changed the default
>> alignment they're going to start getting the warnings again.
Sigh, yes indeed.
But we should definitely make that change IMO.
>> I think the only solution is to combine this change (so that Boost
>> uses the "true" default alignment on x86_64) with the big-hammer
>> disable-the-warning-for-good change.
I'm less keen on that as it may suppress warnings about genuine bugs, but
don't know what else to suggest :-(
Unless there are any violent objections, I'm going to commit the x64 fix
soon, but what do folks feel about suppressing the warnings globally as
well?
Thanks for raising this, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk