Boost.Nowide
config.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 // Copyright (c) 2019 - 2022 Alexander Grund
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 #ifndef BOOST_NOWIDE_CONFIG_HPP_INCLUDED
10 #define BOOST_NOWIDE_CONFIG_HPP_INCLUDED
11 
13 
14 #include <boost/config.hpp>
16 #include <boost/version.hpp>
17 
19 
20 #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
21 #ifdef BOOST_NOWIDE_SOURCE
22 #define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT
23 #else
24 #define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT
25 #endif // BOOST_NOWIDE_SOURCE
26 #else
27 #define BOOST_NOWIDE_DECL
28 #endif // BOOST_NOWIDE_DYN_LINK
29 
30 // Automatically link to the correct build variant where possible.
31 #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE)
32 //
33 // Set the name of our library, this will get undef'ed by auto_link.hpp
34 // once it's done with it:
35 //
36 #define BOOST_LIB_NAME boost_nowide
37 //
38 // If we're importing code from a dll, then tell auto_link.hpp about it:
39 //
40 #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
41 #define BOOST_DYN_LINK
42 #endif
43 //
44 // And include the header that does the work:
45 //
46 #include <boost/config/auto_link.hpp>
47 #endif // auto-linking disabled
48 
50 
55 #ifndef BOOST_NOWIDE_USE_WCHAR_OVERLOADS
56 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(BOOST_NOWIDE_DOXYGEN)
57 #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 1
58 #else
59 #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 0
60 #endif
61 #endif
62 
73 #if defined(BOOST_WINDOWS) || defined(BOOST_NOWIDE_DOXYGEN)
74 #ifdef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
75 #undef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
76 #endif
77 #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 1
78 #elif !defined(BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT)
79 #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT BOOST_NOWIDE_USE_WCHAR_OVERLOADS
80 #endif
81 
83 
84 #if BOOST_VERSION < 106500 && defined(__GNUC__) && __GNUC__ >= 7
85 #define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough))
86 #else
87 #define BOOST_NOWIDE_FALLTHROUGH BOOST_FALLTHROUGH
88 #endif
89 
90 // The std::codecvt<char16/32_t, char, std::mbstate_t> are deprecated in C++20
91 // These macros can suppress this warning
92 #if defined(_MSC_VER)
93 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN __pragma(warning(push)) __pragma(warning(disable : 4996))
94 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END __pragma(warning(pop))
95 #elif(__cplusplus >= 202002L) && defined(__clang__)
96 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
97  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
98 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("clang diagnostic pop")
99 #elif(__cplusplus >= 202002L) && defined(__GNUC__)
100 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
101  _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
102 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("GCC diagnostic pop")
103 #else
104 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN
105 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END
106 #endif
107 
109 
110 namespace boost {
117 namespace nowide {}
118 } // namespace boost
119 
120 #endif