|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67112 - trunk/boost/optional
From: andrey.semashev_at_[hidden]
Date: 2010-12-08 13:32:37
Author: andysem
Date: 2010-12-08 13:32:36 EST (Wed, 08 Dec 2010)
New Revision: 67112
URL: http://svn.boost.org/trac/boost/changeset/67112
Log:
The may_alias workaround is also disabled for GCC prior to 3.2. Also added description for this workaround.
Text files modified:
trunk/boost/optional/optional.hpp | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
Modified: trunk/boost/optional/optional.hpp
==============================================================================
--- trunk/boost/optional/optional.hpp (original)
+++ trunk/boost/optional/optional.hpp 2010-12-08 13:32:36 EST (Wed, 08 Dec 2010)
@@ -82,6 +82,15 @@
#define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
#endif
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 302 \
+ && !defined(__INTEL_COMPILER)
+// GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with
+// regard to violation of the strict aliasing rules. The optional< T > storage type is marked
+// with this attribute in order to let the compiler know that it will alias objects of type T
+// and silence compilation warnings.
+#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
+#endif
+
// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<>
// member template of a factory as used in the optional<> implementation.
// He proposed this simple fix which is to move the call to apply<> outside
@@ -103,12 +112,6 @@
namespace optional_detail {
-#if defined(__GNUC__) \
- && !(__GNUC__ == 3 && __GNUC_MINOR__ == 2) \
- && !defined(__INTEL_COMPILER)
-#define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
-#endif
-
// This local class is used instead of that in "aligned_storage.hpp"
// because I've found the 'official' class to ICE BCB5.5
// when some types are used with optional<>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk