Boost GIL


gil_config.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Copyright 2018 Mateusz Loskot <mateusz at loskot dot net>
4 
5  Use, modification and distribution are subject to the Boost Software License,
6  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7  http://www.boost.org/LICENSE_1_0.txt).
8 
9  See http://opensource.adobe.com/gil for most recent version including documentation.
10 */
11 
12 /*************************************************************************************************/
13 
14 #ifndef GIL_CONFIG_HPP
15 #define GIL_CONFIG_HPP
16 
24 
25 #include <boost/config.hpp>
26 #include <boost/config/pragma_message.hpp>
27 
28 #if defined(BOOST_GIL_DOXYGEN_ONLY)
29 #define BOOST_GIL_CONFIG_HAS_UNALIGNED_ACCESS
37 #endif
38 
39 #if defined(BOOST_GIL_CONFIG_HAS_UNALIGNED_ACCESS)
40 #if defined(sun) || defined(__sun) || \ // SunOS
41  defined(__osf__) || defined(__osf) || \ // Tru64
42  defined(_hpux) || defined(hpux) || \ // HP-UX
43  defined(__arm__) || defined(__ARM_ARCH) || \ // ARM
44  defined(_AIX) // AIX
45 #error Unaligned access strictly disabled for some UNIX platforms or ARM architecture
46 #elif defined(__i386__) || defined(__x86_64__) || defined(__vax__)
47  // The check for little-endian architectures that tolerate unaligned memory
48  // accesses is just an optimization. Nothing will break if it fails to detect
49  // a suitable architecture.
50  //
51  // Unfortunately, this optimization may be a C/C++ strict aliasing rules violation
52  // if accessed data buffer has effective type that cannot be aliased
53  // without leading to undefined behaviour.
54 BOOST_PRAGMA_MESSAGE("CAUTION: Unaligned access tolerated on little-endian may cause undefined behaviour")
55 #else
56 #error Unaligned access disabled for unknown platforms and architectures
57 #endif
58 #endif // defined(BOOST_GIL_CONFIG_HAS_UNALIGNED_ACCESS)
59 
60 #endif