GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / config-g++-common.h
bloba4c945249e4e6d01d97bb9acd0517fa2b5cbd6a8
1 // -*- C++ -*-
2 // This configuration file is designed to be included by another,
3 // specific configuration file. It provides config information common
4 // to all g++ platforms, including egcs.
6 #ifndef ACE_GNUG_COMMON_H
7 #define ACE_GNUG_COMMON_H
8 #include /**/ "ace/pre.h"
10 #if !defined (ACE_CC_NAME)
11 # define ACE_CC_NAME ACE_TEXT ("g++")
12 #endif
13 #define ACE_CC_MAJOR_VERSION __GNUC__
14 #define ACE_CC_MINOR_VERSION __GNUC_MINOR__
15 #define ACE_CC_BETA_VERSION (0)
17 #define ACE_HAS_CPLUSPLUS_HEADERS
18 #define ACE_HAS_STDCPP_STL_INCLUDES
19 #define ACE_HAS_STANDARD_CPP_LIBRARY 1
20 #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
21 #define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
22 #define ACE_TEMPLATES_REQUIRE_SOURCE
24 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
25 # define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS
26 #endif /* __GNUC__ >= 3.4 */
28 #define ACE_NEW_THROWS_EXCEPTIONS
29 #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
30 // Versions of g++ prior to 3.3 had a buggy operator // new(nothrow)[]().
31 # define ACE_HAS_NEW_NOTHROW
32 #endif /* __GNUC__ >= 3.3 */
34 #if __cplusplus >= 201103L
35 # define ACE_HAS_CPP11
36 #endif
37 #if __cplusplus >= 201402L
38 # define ACE_HAS_CPP14
39 #endif
40 #if __cplusplus >= 201703L
41 # define ACE_HAS_CPP17
42 #endif
43 #if __cplusplus >= 202002L
44 # define ACE_HAS_CPP20
45 #endif
47 #if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
48 # define ACE_SIZEOF_LONG_DOUBLE 12
49 #endif /* i386 */
51 #if !defined (__MINGW32__) && (defined (i386) || defined (__i386__))
52 // If running an Intel, assume that it's a Pentium so that
53 // ACE_OS::gethrtime () can use the RDTSC instruction. If running a
54 // 486 or lower, be sure to comment this out. (If not running an
55 // Intel CPU, this #define will not be seen because of the i386
56 // protection, so it can be ignored.)
57 # define ACE_HAS_PENTIUM
58 #endif /* i386 */
60 #if (defined (ACE_HAS_PENTIUM) || defined (__amd64__) || defined (__x86_64__))
61 # define ACE_HAS_INTEL_ASSEMBLY
62 #endif
64 #if !defined (ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE)
65 #define ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE 1
66 #endif
68 #if !defined (ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE)
69 #define ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE 1
70 #endif
72 #if !defined (ACE_HAS_GCC_DEPRECATED_ATTRIBUTE)
73 #define ACE_HAS_GCC_DEPRECATED_ATTRIBUTE 1
74 #endif
76 #if !defined (ACE_HAS_GCC_FORMAT_ATTRIBUTE)
77 #define ACE_HAS_GCC_FORMAT_ATTRIBUTE 1
78 #endif
80 #if (ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE == 1)
81 # define ACE_GCC_CONSTRUCTOR_ATTRIBUTE __attribute__ ((constructor))
82 #endif
84 #if (ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE == 1)
85 # define ACE_GCC_DESTRUCTOR_ATTRIBUTE __attribute__ ((destructor))
86 #endif
88 #if (ACE_HAS_GCC_DEPRECATED_ATTRIBUTE == 1)
89 #define ACE_DEPRECATED __attribute__ ((deprecated))
90 #endif
92 #if (ACE_HAS_GCC_FORMAT_ATTRIBUTE == 1)
93 # define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX) \
94 __attribute__ ((format (TYPE, STR_INDEX, FIRST_INDEX)))
95 #endif
97 // GNU g++ >= 4.x implements "#pragma once".
98 #if (__GNUC__ < 4) && !defined (ACE_LACKS_PRAGMA_ONCE)
99 // We define it with a -D with make depend.
100 # define ACE_LACKS_PRAGMA_ONCE
101 #endif /* ! ACE_LACKS_PRAGMA_ONCE */
103 // Take advantage of G++ (>= 4.x) visibility attributes to generate
104 // improved shared library binaries.
105 #if (__GNUC__ >= 4) && !defined (__MINGW32__) && !defined (ACE_HAS_CEGCC)
107 # if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0
108 # undef ACE_HAS_CUSTOM_EXPORT_MACROS
109 # if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS)
110 # undef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS
111 # endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */
112 # define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 0
113 # else
114 # ifndef ACE_HAS_CUSTOM_EXPORT_MACROS
115 # define ACE_HAS_CUSTOM_EXPORT_MACROS
116 # endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */
117 # ifndef ACE_Proper_Export_Flag
118 # define ACE_Proper_Export_Flag __attribute__ ((visibility("default")))
119 # endif /* !ACE_Proper_Export_Flag */
120 # ifndef ACE_Proper_Import_Flag
121 # define ACE_Proper_Import_Flag __attribute__ ((visibility("default")))
122 # endif /* !ACE_Proper_Import_Flag */
124 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
125 // Sadly, G++ 4.x silently ignores visibility attributes on
126 // template instantiations, which breaks singletons.
127 // As a workaround, we use the GCC visibility pragmas.
128 // And to make them fit in a macro, we use C99's _Pragma()
129 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470
130 // This has been fixed in GCC 4.1.1 with FC6 but not with SuSE 10.2
131 // that gets shipped with GCC 4.1.2 so we assume that with GCC 4.2
132 // this will be fixed on the head. With FC6 just set this define yourself
133 # ifndef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS
134 # define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1
135 # endif
136 # endif
138 # if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) && ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS == 1
139 # define ACE_EXPORT_SINGLETON_DECLARATION(T) __extension__ extern template class ACE_Proper_Export_Flag T
140 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>;
141 # define ACE_HAS_EXPLICIT_TEMPLATE_CLASS_INSTANTIATION
142 # else /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */
143 # define ACE_EXPORT_SINGLETON_DECLARATION(T) \
144 _Pragma ("GCC visibility push(default)") \
145 template class T \
146 _Pragma ("GCC visibility pop")
147 # define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) \
148 _Pragma ("GCC visibility push(default)") \
149 template class SINGLETON_TYPE<CLASS, LOCK>; \
150 _Pragma ("GCC visibility pop")
151 # endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */
153 // Note that the "__extension__" is needed to prevent g++ from issuing
154 // an error when using its "-pedantic" command line flag.
155 # define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T
156 # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
158 # endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
159 #endif /* __GNU__ >= 4 */
161 // GCC >= 4.1 provides __sync_XXXX builtins for use in atomic operations
162 // although the builtins are provided globally they are not supported on all platforms
163 #if defined (ACE_HAS_THREADS)
164 #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1))
165 # if defined (__powerpc__)
166 // The builtins seem to be provided for all powerpc platforms
167 # define ACE_HAS_GCC_ATOMIC_BUILTINS 1
168 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 1) && (__GNUC_PATCHLEVEL__ == 1))
169 // PPU GCC 4.1.1 doesn't have builtin atomic ops for size 1/2
170 # define ACE_LACKS_GCC_ATOMIC_BUILTINS_2
171 # define ACE_LACKS_GCC_ATOMIC_BUILTINS_1
172 # endif
173 # endif
174 # if defined (__ia64)
175 // The builtins seem to be provided for the IA64 platforms
176 # define ACE_HAS_GCC_ATOMIC_BUILTINS 1
177 # endif
178 # if defined (__amd64__) || defined (__x86_64__)
179 // The builtin's are provided also for 64bit linux
180 # define ACE_HAS_GCC_ATOMIC_BUILTINS 1
181 # endif
182 #endif
183 #endif /* ACE_HAS_THREADS */
185 #if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
186 # define ACE_GCC_NO_RETURN __attribute__ ((__noreturn__))
187 #endif
189 #include /**/ "ace/post.h"
190 #endif /* ACE_GNUG_COMMON_H */