libsmbios_c library
visualc.hpp
Go to the documentation of this file.
1 // (C) Copyright John Maddock 2001 - 2003.
2 // (C) Copyright Darin Adler 2001 - 2002.
3 // (C) Copyright Peter Dimov 2001.
4 // (C) Copyright Aleksey Gurtovoy 2002.
5 // (C) Copyright David Abrahams 2002 - 2003.
6 // (C) Copyright Beman Dawes 2002 - 2003.
7 // Use, modification and distribution are subject to the
8 // Boost Software License, Version 1.0. (See accompanying file
9 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 
11 // See http://www.boost.org for most recent version.
12 
13 // Microsoft Visual C++ compiler setup:
14 
15 #define LIBSMBIOS_MSVC _MSC_VER
16 
17 // turn off the warnings before we #include anything
18 // 4503: warning: decorated name length exceeded
19 // 4250: 'class1' : inherits 'class2::member' via dominance
20 // 4201: nonstandard extension used : nameless struct/union
21 // 4127: warning: conditional expression is constant
22 #pragma warning( disable : 4201 4250 4503 4127 )
23 #ifndef DEBUG
24 // 4702: unreachable code
25 #pragma warning( disable : 4702 ) // disable in release because MS headers have tons of unreachable code
26 #endif
27 
28 // Only new MSVC has _strtoi64. Older compilers are screwed (will get undefined ref error)
29 #if _MSC_VER >= 1300
30 #define strtoll(p, e, b) _strtoi64(p, e, b)
31 #endif
32 
33 #define UNREFERENCED_PARAMETER(P) (P)
34 #define MARK_UNUSED
35 #define LIBSMBIOS_PACKED_ATTR
36 #define _dbg_iostream_out(stream, line) do { stream << line; } while(0)
37 #define _dbg_cout(line) _dbg_iostream_out(cout, line)
38 #define _dbg_cerr(line) _dbg_iostream_out(cerr, line)
39 #define _null_call(...) do {} while(0)
40 #ifdef DEBUG_OUTPUT_ALL
41 #include <iostream>
42 #define DCOUT _dbg_cout
43 #define DCERR _dbg_cerr
44 #else
45 #define DCOUT _null_call
46 #define DCERR _null_call
47 #endif
48 
49 
50 
51 // we require RTTI, guard against users:
52 #ifndef _CPPRTTI
53 #error RTTI required
54 #endif
55 
56 #if _MSC_VER <= 1200 // 1200 == VC++ 6.0
57 #pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
58 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
59 # define LIBSMBIOS_NO_VOID_RETURNS
60 # define LIBSMBIOS_NO_EXCEPTION_STD_NAMESPACE
61 # define LIBSMBIOS_NO_STDC_NAMESPACE
62  // disable min/max macro defines on vc6:
63  //
64 #endif
65 
66 #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0
67 
68 #if !defined(_MSC_EXTENSIONS) && !defined(LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za
69 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
70 #endif
71 
72 # define LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
73 # define LIBSMBIOS_NO_INCLASS_MEMBER_INITIALIZATION
74 # define LIBSMBIOS_NO_PRIVATE_IN_AGGREGATE
75 # define LIBSMBIOS_NO_ARGUMENT_DEPENDENT_LOOKUP
76 # define LIBSMBIOS_NO_INTEGRAL_INT64_T
77 # define LIBSMBIOS_NO_DEDUCED_TYPENAME
78 # define LIBSMBIOS_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
79 
80 // VC++ 6/7 has member templates but they have numerous problems including
81 // cases of silent failure, so for safety we define:
82 # define LIBSMBIOS_NO_MEMBER_TEMPLATES
83 // For VC++ experts wishing to attempt workarounds, we define:
84 # define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES
85 
86 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS
87 # define LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION
88 # define LIBSMBIOS_NO_CV_VOID_SPECIALIZATIONS
89 # define LIBSMBIOS_NO_FUNCTION_TEMPLATE_ORDERING
90 # define LIBSMBIOS_NO_USING_TEMPLATE
91 # define LIBSMBIOS_NO_SWPRINTF
92 # define LIBSMBIOS_NO_TEMPLATE_TEMPLATES
93 # define LIBSMBIOS_NO_SFINAE
94 # if (_MSC_VER > 1200)
95 # define LIBSMBIOS_NO_MEMBER_FUNCTION_SPECIALIZATIONS
96 # endif
97 
98 #endif
99 
100 #if _MSC_VER >= 1300
101 // VC++ 7 and higher have __FUNCTION__ macro
102 #define LIBSMBIOS_HAS_FUNCTION
103 #endif
104 
105 #if _MSC_VER < 1310 // 1310 == VC++ 7.1
106 # define LIBSMBIOS_NO_SWPRINTF
107 #endif
108 
109 #if _MSC_VER <= 1310
110 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS
111 #endif
112 
113 #ifndef _NATIVE_WCHAR_T_DEFINED
114 # define LIBSMBIOS_NO_INTRINSIC_WCHAR_T
115 #endif
116 
117 //
118 // check for exception handling support:
119 #ifndef _CPPUNWIND
120 # define LIBSMBIOS_NO_EXCEPTIONS
121 #endif
122 
123 //
124 // __int64 support:
125 //
126 #if (_MSC_VER >= 1200)
127 # define LIBSMBIOS_HAS_MS_INT64
128 #endif
129 #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
130 # define LIBSMBIOS_HAS_LONG_LONG
131 #endif
132 //
133 // disable Win32 API's if compiler extentions are
134 // turned off:
135 //
136 #ifndef _MSC_EXTENSIONS
137 # define LIBSMBIOS_DISABLE_WIN32
138 #endif
139 
140 //
141 // all versions support __declspec:
142 //
143 #define LIBSMBIOS_HAS_DECLSPEC
144 //
145 // prefix and suffix headers:
146 //
147 #ifndef LIBSMBIOS_ABI_PREFIX
148 # define LIBSMBIOS_ABI_PREFIX "smbios/config/abi/msvc_prefix.hpp"
149 #endif
150 #ifndef LIBSMBIOS_ABI_SUFFIX
151 # define LIBSMBIOS_ABI_SUFFIX "smbios/config/abi/msvc_suffix.hpp"
152 #endif
153 
154 # if _MSC_VER == 1200
155 # define LIBSMBIOS_COMPILER_VERSION 6.0
156 # elif _MSC_VER == 1300
157 # define LIBSMBIOS_COMPILER_VERSION 7.0
158 # elif _MSC_VER == 1310
159 # define LIBSMBIOS_COMPILER_VERSION 7.1
160 # else
161 # define LIBSMBIOS_COMPILER_VERSION _MSC_VER
162 # endif
163 
164 #define LIBSMBIOS_COMPILER "Microsoft Visual C++ version " LIBSMBIOS_STRINGIZE(LIBSMBIOS_COMPILER_VERSION)
165 
166 //
167 // versions check:
168 // we don't support Visual C++ prior to version 6:
169 #if _MSC_VER < 1200
170 #error "Compiler looks ancient. Sorry but we dont support it MSVC++ prior to version 6."
171 #endif
172 //
173 // last known and checked version is 1310:
174 #if (_MSC_VER > 1400)
175 # if defined(LIBSMBIOS_ASSERT_CONFIG)
176 # error "Unknown compiler version - please run the configure tests and report the results"
177 # else
178 # pragma message("Unknown compiler version - please run the configure tests and report the results")
179 # endif
180 #endif