Boost logo

Boost :

Subject: Re: [boost] Win64 and abi_prefix.hpp/abi_suffix.hpp warnings
From: Chris Newbold (Chris.Newbold_at_[hidden])
Date: 2008-09-25 10:51:59


> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> On Behalf Of Chris Newbold
> Sent: Thursday, September 25, 2008 10:35 AM

> Assuming that's the case, I would like to propose adding a warning
> suppression to config/warning_disable.hpp to silence this particular
> warning. Here's a diff of what I'm proposing:
>
> @@ -43,5 +43,14 @@
> // std library function is encountered.
> # pragma warning(disable:1786)
> #endif
> +#if defined(_MSC_VER) && defined(_M_X64)
> + // warning: 'file': alignment changed after including header, may
> + // be due to missing #pragma pack(pop)
> + //
> + // Caused by MSVC-specific abi_prefix and abi_suffix bookends which
> + // twiddle the default structure alignment via #pragma pack(); this
> + // results in a warning only on x86_64 targets.
> +# pragma warning(disable:4103)
> +#endif
>
> #endif // BOOST_CONFIG_WARNING_DISABLE_HPP

Of course that doesn't work, because warning_disable.hpp isn't universally included. My bad.

Here's an alternate proposal that does work: add a warning suppression to config/abi/msvc_prefix.hpp:

@@ -3,6 +3,18 @@
 // Boost Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

+#if defined(_M_X64)
+ // warning: 'file': alignment changed after including header, may
+ // be due to missing #pragma pack(pop)
+ //
+ // Changing the default structure alignment across header file
+ // boundaries causes a warning on the x86_64 target. Unfortunately,
+ // there is no way to do a push-pop on the state of this warning
+ // since popping it back to the 'on' state results in a warning as
+ // the compiler exits the suffix file
+# pragma warning(disable:4103)
+#endif
+
 #pragma pack(push,8)

Does this seem reasonable?

-Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk