libsmbios_c library
gcc.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 Jens Maurer 2001 - 2002.
4 // (C) Copyright Beman Dawes 2001 - 2003.
5 // (C) Copyright Douglas Gregor 2002.
6 // (C) Copyright David Abrahams 2002 - 2003.
7 // (C) Copyright Synge Todo 2003.
8 // Use, modification and distribution are subject to the
9 // Boost Software License, Version 1.0. (See accompanying file
10 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 
12 // See http://www.boost.org for most recent version.
13 
14 // GNU C++ compiler setup:
15 
16 # if __GNUC__ == 2 && __GNUC_MINOR__ == 91
17  // egcs 1.1 won't parse shared_ptr.hpp without this:
18 # define LIBSMBIOS_NO_AUTO_PTR
19 # endif
20 # if __GNUC__ == 2 && __GNUC_MINOR__ < 95
21  //
22  // Prior to gcc 2.95 member templates only partly
23  // work - define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES
24  // instead since inline member templates mostly work.
25  //
26 # define LIBSMBIOS_NO_MEMBER_TEMPLATES
27 # if __GNUC_MINOR__ >= 9
28 # define LIBSMBIOS_MSVC6_MEMBER_TEMPLATES
29 # endif
30 # endif
31 
32 # if __GNUC__ == 2 && __GNUC_MINOR__ < 96
33 # define LIBSMBIOS_NO_SFINAE
34 # endif
35 
36 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 97
37 # define LIBSMBIOS_NO_MEMBER_TEMPLATE_FRIENDS
38 # define LIBSMBIOS_NO_OPERATORS_IN_NAMESPACE
39 # endif
40 
41 # if __GNUC__ < 3
42 # define LIBSMBIOS_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
43 # define LIBSMBIOS_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
44 # endif
45 
46 #ifndef __EXCEPTIONS
47 # define LIBSMBIOS_NO_EXCEPTIONS
48 #endif
49 
50 // GCC has __PRETTY_FUNCTION__ macro
51 #define LIBSMBIOS_HAS_PRETTY_FUNCTION
52 #define LIBSMBIOS_HAS_FUNCTION
53 #define LIBSMBIOS_PACKED_ATTR __attribute__ ((packed))
54 
55 #ifndef UNREFERENCED_PARAMETER
56 #define UNREFERENCED_PARAMETER(P) ((void)(P))
57 #endif
58 
59 # if __GNUC__ > 4
60 // internal compiler error in RHEL4 gcc when this is used.
61 #define MARK_UNUSED __attribute__ ((unused))
62 #else
63 #define MARK_UNUSED
64 #endif
65 
66 #define _dbg_iostream_out(stream, line) do { stream << line; } while(0)
67 #define _dbg_cout(line) _dbg_iostream_out(cout, line)
68 #define _dbg_cerr(line) _dbg_iostream_out(cerr, line)
69 #define _null_call( args...) do {} while(0)
70 #ifdef DEBUG_OUTPUT_ALL
71 #include <iostream>
72 #define DCOUT _dbg_cout
73 #define DCERR _dbg_cerr
74 #else
75 #define DCOUT _null_call
76 #define DCERR _null_call
77 #endif
78 
79 //
80 // Bug specific to gcc 3.1 and 3.2:
81 //
82 #if (__GNUC__ == 3) && ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2))
83 # define LIBSMBIOS_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
84 #endif
85 
86 //
87 // Threading support: Turn this on unconditionally here (except for
88 // those platforms where we can know for sure). It will get turned off again
89 // later if no threading API is detected.
90 //
91 #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
92 # define LIBSMBIOS_HAS_THREADS
93 #endif
94 
95 //
96 // gcc has "long long"
97 //
98 #define LIBSMBIOS_HAS_LONG_LONG
99 
100 //
101 // gcc implements the named return value optimization since version 3.1
102 //
103 #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
104 #define LIBSMBIOS_HAS_NRVO
105 #endif
106 
107 #define LIBSMBIOS_COMPILER "GNU C++ version " __VERSION__
108 
109 //
110 // versions check:
111 // we don't know gcc prior to version 2.90:
112 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
113 # error "Compiler not configured - please reconfigure"
114 #endif
115 //
116 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))
117 # if defined(LIBSMBIOS_ASSERT_CONFIG)
118 # error "Unknown compiler version - please run the configure tests and report the results"
119 # else
120 # warning "Unknown compiler version - please run the configure tests and report the results"
121 # endif
122 #endif
123 
124