libsmbios_c library
|
00001 // (C) Copyright John Maddock 2001 - 2003. 00002 // (C) Copyright Darin Adler 2001 - 2002. 00003 // (C) Copyright Peter Dimov 2001. 00004 // (C) Copyright Aleksey Gurtovoy 2002. 00005 // (C) Copyright David Abrahams 2002 - 2003. 00006 // (C) Copyright Beman Dawes 2002 - 2003. 00007 // Use, modification and distribution are subject to the 00008 // Boost Software License, Version 1.0. (See accompanying file 00009 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00010 00011 // See http://www.boost.org for most recent version. 00012 00013 // Microsoft Visual C++ compiler setup: 00014 00015 #define LIBSMBIOS_MSVC _MSC_VER 00016 00017 // turn off the warnings before we #include anything 00018 // 4503: warning: decorated name length exceeded 00019 // 4250: 'class1' : inherits 'class2::member' via dominance 00020 // 4201: nonstandard extension used : nameless struct/union 00021 // 4127: warning: conditional expression is constant 00022 #pragma warning( disable : 4201 4250 4503 4127 ) 00023 #ifndef DEBUG 00024 // 4702: unreachable code 00025 #pragma warning( disable : 4702 ) // disable in release because MS headers have tons of unreachable code 00026 #endif 00027 00028 // Only new MSVC has _strtoi64. Older compilers are screwed (will get undefined ref error) 00029 #if _MSC_VER >= 1300 00030 #define strtoll(p, e, b) _strtoi64(p, e, b) 00031 #endif 00032 00033 #define UNREFERENCED_PARAMETER(P) (P) 00034 #define MARK_UNUSED 00035 #define LIBSMBIOS_PACKED_ATTR 00036 #define _dbg_iostream_out(stream, line) do { stream << line; } while(0) 00037 #define _dbg_cout(line) _dbg_iostream_out(cout, line) 00038 #define _dbg_cerr(line) _dbg_iostream_out(cerr, line) 00039 #define _null_call(...) do {} while(0) 00040 #ifdef DEBUG_OUTPUT_ALL 00041 #include <iostream> 00042 #define DCOUT _dbg_cout 00043 #define DCERR _dbg_cerr 00044 #else 00045 #define DCOUT _null_call 00046 #define DCERR _null_call 00047 #endif 00048 00049 00050 00051 // we require RTTI, guard against users: 00052 #ifndef _CPPRTTI 00053 #error RTTI required 00054 #endif 00055 00056 #if _MSC_VER <= 1200 // 1200 == VC++ 6.0 00057 #pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info 00058 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS 00059 # define LIBSMBIOS_NO_VOID_RETURNS 00060 # define LIBSMBIOS_NO_EXCEPTION_STD_NAMESPACE 00061 # define LIBSMBIOS_NO_STDC_NAMESPACE 00062 // disable min/max macro defines on vc6: 00063 // 00064 #endif 00065 00066 #if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 00067 00068 #if !defined(_MSC_EXTENSIONS) && !defined(LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za 00069 # define LIBSMBIOS_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS 00070 #endif 00071 00072 # define LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS 00073 # define LIBSMBIOS_NO_INCLASS_MEMBER_INITIALIZATION 00074 # define LIBSMBIOS_NO_PRIVATE_IN_AGGREGATE 00075 # define LIBSMBIOS_NO_ARGUMENT_DEPENDENT_LOOKUP 00076 # define LIBSMBIOS_NO_INTEGRAL_INT64_T 00077 # define LIBSMBIOS_NO_DEDUCED_TYPENAME 00078 # define LIBSMBIOS_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE 00079 00080 // VC++ 6/7 has member templates but they have numerous problems including 00081 // cases of silent failure, so for safety we define: 00082 # define LIBSMBIOS_NO_MEMBER_TEMPLATES 00083 // For VC++ experts wishing to attempt workarounds, we define: 00084 # define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES 00085 00086 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS 00087 # define LIBSMBIOS_NO_TEMPLATE_PARTIAL_SPECIALIZATION 00088 # define LIBSMBIOS_NO_CV_VOID_SPECIALIZATIONS 00089 # define LIBSMBIOS_NO_FUNCTION_TEMPLATE_ORDERING 00090 # define LIBSMBIOS_NO_USING_TEMPLATE 00091 # define LIBSMBIOS_NO_SWPRINTF 00092 # define LIBSMBIOS_NO_TEMPLATE_TEMPLATES 00093 # define LIBSMBIOS_NO_SFINAE 00094 # if (_MSC_VER > 1200) 00095 # define LIBSMBIOS_NO_MEMBER_FUNCTION_SPECIALIZATIONS 00096 # endif 00097 00098 #endif 00099 00100 #if _MSC_VER >= 1300 00101 // VC++ 7 and higher have __FUNCTION__ macro 00102 #define LIBSMBIOS_HAS_FUNCTION 00103 #endif 00104 00105 #if _MSC_VER < 1310 // 1310 == VC++ 7.1 00106 # define LIBSMBIOS_NO_SWPRINTF 00107 #endif 00108 00109 #if _MSC_VER <= 1310 00110 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS 00111 #endif 00112 00113 #ifndef _NATIVE_WCHAR_T_DEFINED 00114 # define LIBSMBIOS_NO_INTRINSIC_WCHAR_T 00115 #endif 00116 00117 // 00118 // check for exception handling support: 00119 #ifndef _CPPUNWIND 00120 # define LIBSMBIOS_NO_EXCEPTIONS 00121 #endif 00122 00123 // 00124 // __int64 support: 00125 // 00126 #if (_MSC_VER >= 1200) 00127 # define LIBSMBIOS_HAS_MS_INT64 00128 #endif 00129 #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) 00130 # define LIBSMBIOS_HAS_LONG_LONG 00131 #endif 00132 // 00133 // disable Win32 API's if compiler extentions are 00134 // turned off: 00135 // 00136 #ifndef _MSC_EXTENSIONS 00137 # define LIBSMBIOS_DISABLE_WIN32 00138 #endif 00139 00140 // 00141 // all versions support __declspec: 00142 // 00143 #define LIBSMBIOS_HAS_DECLSPEC 00144 // 00145 // prefix and suffix headers: 00146 // 00147 #ifndef LIBSMBIOS_ABI_PREFIX 00148 # define LIBSMBIOS_ABI_PREFIX "smbios/config/abi/msvc_prefix.hpp" 00149 #endif 00150 #ifndef LIBSMBIOS_ABI_SUFFIX 00151 # define LIBSMBIOS_ABI_SUFFIX "smbios/config/abi/msvc_suffix.hpp" 00152 #endif 00153 00154 # if _MSC_VER == 1200 00155 # define LIBSMBIOS_COMPILER_VERSION 6.0 00156 # elif _MSC_VER == 1300 00157 # define LIBSMBIOS_COMPILER_VERSION 7.0 00158 # elif _MSC_VER == 1310 00159 # define LIBSMBIOS_COMPILER_VERSION 7.1 00160 # else 00161 # define LIBSMBIOS_COMPILER_VERSION _MSC_VER 00162 # endif 00163 00164 #define LIBSMBIOS_COMPILER "Microsoft Visual C++ version " LIBSMBIOS_STRINGIZE(LIBSMBIOS_COMPILER_VERSION) 00165 00166 // 00167 // versions check: 00168 // we don't support Visual C++ prior to version 6: 00169 #if _MSC_VER < 1200 00170 #error "Compiler looks ancient. Sorry but we dont support it MSVC++ prior to version 6." 00171 #endif 00172 // 00173 // last known and checked version is 1310: 00174 #if (_MSC_VER > 1400) 00175 # if defined(LIBSMBIOS_ASSERT_CONFIG) 00176 # error "Unknown compiler version - please run the configure tests and report the results" 00177 # else 00178 # pragma message("Unknown compiler version - please run the configure tests and report the results") 00179 # endif 00180 #endif