SMBIOS 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 LIBSMBIOS_PACKED_ATTR
35 
36 // we require RTTI, guard against users:
37 #ifndef _CPPRTTI
38 #error RTTI required
39 #endif
40 
41 #if _MSC_VER <= 1200 // 1200 == VC++ 6.0
42 #pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
43 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
44 # define LIBSMBIOS_NO_VOID_RETURNS
45 # define LIBSMBIOS_NO_EXCEPTION_STD_NAMESPACE
46 # define LIBSMBIOS_NO_STDC_NAMESPACE
47  // disable min/max macro defines on vc6:
48  //
49 #endif
50 
51 #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0
52 
53 #if !defined(_MSC_EXTENSIONS) && !defined(LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za
54 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
55 #endif
56 
57 # define LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
58 # define LIBSMBIOS_NO_INCLASS_MEMBER_INITIALIZATION
59 # define LIBSMBIOS_NO_PRIVATE_IN_AGGREGATE
60 # define LIBSMBIOS_NO_ARGUMENT_DEPENDENT_LOOKUP
61 # define LIBSMBIOS_NO_INTEGRAL_INT64_T
62 # define LIBSMBIOS_NO_DEDUCED_TYPENAME
63 # define LIBSMBIOS_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
64 
65 // VC++ 6/7 has member templates but they have numerous problems including
66 // cases of silent failure, so for safety we define:
67 # define LIBSMBIOS_NO_MEMBER_TEMPLATES
68 // For VC++ experts wishing to attempt workarounds, we define:
69 # define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES
70 
71 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS
72 # define LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION
73 # define LIBSMBIOS_NO_CV_VOID_SPECIALIZATIONS
74 # define LIBSMBIOS_NO_FUNCTION_TEMPLATE_ORDERING
75 # define LIBSMBIOS_NO_USING_TEMPLATE
76 # define LIBSMBIOS_NO_SWPRINTF
77 # define LIBSMBIOS_NO_TEMPLATE_TEMPLATES
78 # define LIBSMBIOS_NO_SFINAE
79 # if (_MSC_VER > 1200)
80 # define LIBSMBIOS_NO_MEMBER_FUNCTION_SPECIALIZATIONS
81 # endif
82 
83 #endif
84 
85 #if _MSC_VER >= 1300
86 // VC++ 7 and higher have __FUNCTION__ macro
87 #define LIBSMBIOS_HAS_FUNCTION
88 #endif
89 
90 #if _MSC_VER < 1310 // 1310 == VC++ 7.1
91 # define LIBSMBIOS_NO_SWPRINTF
92 #endif
93 
94 #if _MSC_VER <= 1310
95 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS
96 #endif
97 
98 #ifndef _NATIVE_WCHAR_T_DEFINED
99 # define LIBSMBIOS_NO_INTRINSIC_WCHAR_T
100 #endif
101 
102 //
103 // check for exception handling support:
104 #ifndef _CPPUNWIND
105 # define LIBSMBIOS_NO_EXCEPTIONS
106 #endif
107 
108 //
109 // __int64 support:
110 //
111 #if (_MSC_VER >= 1200)
112 # define LIBSMBIOS_HAS_MS_INT64
113 #endif
114 #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
115 # define LIBSMBIOS_HAS_LONG_LONG
116 #endif
117 //
118 // disable Win32 API's if compiler extentions are
119 // turned off:
120 //
121 #ifndef _MSC_EXTENSIONS
122 # define LIBSMBIOS_DISABLE_WIN32
123 #endif
124 
125 //
126 // all versions support __declspec:
127 //
128 #define LIBSMBIOS_HAS_DECLSPEC
129 //
130 // prefix and suffix headers:
131 //
132 #ifndef LIBSMBIOS_ABI_PREFIX
133 # define LIBSMBIOS_ABI_PREFIX "smbios/config/abi/msvc_prefix.hpp"
134 #endif
135 #ifndef LIBSMBIOS_ABI_SUFFIX
136 # define LIBSMBIOS_ABI_SUFFIX "smbios/config/abi/msvc_suffix.hpp"
137 #endif
138 
139 # if _MSC_VER == 1200
140 # define LIBSMBIOS_COMPILER_VERSION 6.0
141 # elif _MSC_VER == 1300
142 # define LIBSMBIOS_COMPILER_VERSION 7.0
143 # elif _MSC_VER == 1310
144 # define LIBSMBIOS_COMPILER_VERSION 7.1
145 # else
146 # define LIBSMBIOS_COMPILER_VERSION _MSC_VER
147 # endif
148 
149 #define LIBSMBIOS_COMPILER "Microsoft Visual C++ version " LIBSMBIOS_STRINGIZE(LIBSMBIOS_COMPILER_VERSION)
150 
151 //
152 // versions check:
153 // we don't support Visual C++ prior to version 6:
154 #if _MSC_VER < 1200
155 #error "Compiler looks ancient. Sorry but we dont support it MSVC++ prior to version 6."
156 #endif
157 //
158 // last known and checked version is 1310:
159 #if (_MSC_VER > 1400)
160 # if defined(LIBSMBIOS_ASSERT_CONFIG)
161 # error "Unknown compiler version - please run the configure tests and report the results"
162 # else
163 # pragma message("Unknown compiler version - please run the configure tests and report the results")
164 # endif
165 #endif