Boost.Nowide
config.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 // Copyright (c) 2019 - 2020 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 //
31 // Automatically link to the correct build variant where possible.
32 //
33 #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE)
34 //
35 // Set the name of our library, this will get undef'ed by auto_link.hpp
36 // once it's done with it:
37 //
38 #define BOOST_LIB_NAME boost_nowide
39 //
40 // If we're importing code from a dll, then tell auto_link.hpp about it:
41 //
42 #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
43 #define BOOST_DYN_LINK
44 #endif
45 //
46 // And include the header that does the work:
47 //
48 #include <boost/config/auto_link.hpp>
49 #endif // auto-linking disabled
50 
52 
56 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
57 #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 1
58 #else
59 #define BOOST_NOWIDE_USE_WCHAR_OVERLOADS 0
60 #endif
61 
71 #if defined(BOOST_WINDOWS) || BOOST_NOWIDE_USE_WCHAR_OVERLOADS
72 #ifdef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
73 #undef BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT
74 #endif
75 #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 1
76 #elif !defined(BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT)
77 #define BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT 0
78 #endif
79 
81 
82 #if BOOST_VERSION < 106500 && defined(BOOST_GCC) && __GNUC__ >= 7
83 #define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough))
84 #else
85 #define BOOST_NOWIDE_FALLTHROUGH BOOST_FALLTHROUGH
86 #endif
87 
88 // The std::codecvt<char16/32_t, char, std::mbstate_t> are deprecated in C++20
89 // These macros can suppress this warning
90 #if defined(_MSC_VER)
91 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN __pragma(warning(push)) __pragma(warning(disable : 4996))
92 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END __pragma(warning(pop))
93 #elif(__cplusplus >= 202002L) && defined(__clang__)
94 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
95  _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
96 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("clang diagnostic pop")
97 #elif(__cplusplus >= 202002L) && defined(__GNUC__)
98 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
99  _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
100 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("GCC diagnostic pop")
101 #else
102 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN
103 #define BOOST_NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END
104 #endif
105 
107 
108 namespace boost {
115 namespace nowide {}
116 } // namespace boost
117 
118 #endif // boost/nowide/config.hpp