cereal
A C++11 library for serialization
macros.hpp
Go to the documentation of this file.
1 
17 /*
18  Copyright (c) 2014, Randolph Voorhies, Shane Grant
19  All rights reserved.
20 
21  Redistribution and use in source and binary forms, with or without
22  modification, are permitted provided that the following conditions are met:
23  * Redistributions of source code must retain the above copyright
24  notice, this list of conditions and the following disclaimer.
25  * Redistributions in binary form must reproduce the above copyright
26  notice, this list of conditions and the following disclaimer in the
27  documentation and/or other materials provided with the distribution.
28  * Neither the name of cereal nor the
29  names of its contributors may be used to endorse or promote products
30  derived from this software without specific prior written permission.
31 
32  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35  DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
36  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 */
43 
44 #ifndef CEREAL_MACROS_HPP_
45 #define CEREAL_MACROS_HPP_
46 
47 #ifndef CEREAL_THREAD_SAFE
48 
56 #define CEREAL_THREAD_SAFE 0
57 #endif // CEREAL_THREAD_SAFE
58 
59 // ######################################################################
60 #ifndef CEREAL_SERIALIZE_FUNCTION_NAME
61 
64 #define CEREAL_SERIALIZE_FUNCTION_NAME serialize
65 #endif // CEREAL_SERIALIZE_FUNCTION_NAME
66 
67 #ifndef CEREAL_LOAD_FUNCTION_NAME
68 
71 #define CEREAL_LOAD_FUNCTION_NAME load
72 #endif // CEREAL_LOAD_FUNCTION_NAME
73 
74 #ifndef CEREAL_SAVE_FUNCTION_NAME
75 
78 #define CEREAL_SAVE_FUNCTION_NAME save
79 #endif // CEREAL_SAVE_FUNCTION_NAME
80 
81 #ifndef CEREAL_LOAD_MINIMAL_FUNCTION_NAME
82 
85 #define CEREAL_LOAD_MINIMAL_FUNCTION_NAME load_minimal
86 #endif // CEREAL_LOAD_MINIMAL_FUNCTION_NAME
87 
88 #ifndef CEREAL_SAVE_MINIMAL_FUNCTION_NAME
89 
92 #define CEREAL_SAVE_MINIMAL_FUNCTION_NAME save_minimal
93 #endif // CEREAL_SAVE_MINIMAL_FUNCTION_NAME
94 
95 // ######################################################################
97 
100 #if !defined(CEREAL_HAS_NOEXCEPT)
101  #if defined(__clang__)
102  #if __has_feature(cxx_noexcept)
103  #define CEREAL_HAS_NOEXCEPT
104  #endif
105  #else // NOT clang
106  #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
107  defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
108  #define CEREAL_HAS_NOEXCEPT
109  #endif // end GCC/MSVC check
110  #endif // end NOT clang block
111 
112  #ifndef CEREAL_NOEXCEPT
113  #ifdef CEREAL_HAS_NOEXCEPT
114  #define CEREAL_NOEXCEPT noexcept
115  #else
116  #define CEREAL_NOEXCEPT
117  #endif // end CEREAL_HAS_NOEXCEPT
118  #endif // end !defined(CEREAL_HAS_NOEXCEPT)
119 #endif // ifndef CEREAL_NOEXCEPT
120 
121 #endif // CEREAL_MACROS_HPP_