Logo ROOT   6.12/07
Reference Guide
RConfig.h
Go to the documentation of this file.
1 /* @(#)root/base:$Id$ */
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_RConfig
12 #define ROOT_RConfig
13 
14 /*************************************************************************
15  * *
16  * RConfig *
17  * *
18  * Defines used by ROOT. *
19  * *
20  *************************************************************************/
21 
22 #include "RVersion.h"
23 
24 
25 /*---- new C++ features ------------------------------------------------------*/
26 
27 #if defined __has_feature
28 # if __has_feature(modules)
29 # define R__CXXMODULES
30 # endif
31 #endif
32 
33 #define R__USE_SHADOW_CLASS
34 
35 /* Now required, thus defined by default for backward compatibility */
36 #define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
37 #define R__SSTREAM /* use sstream or strstream header */
38 
39 #if defined(_MSC_VER)
40 # if (_MSC_VER < 1910)
41 # error "ROOT requires Visual Studio 2017 or higher."
42 # else
43 # define R__NULLPTR
44 # endif
45 #else
46 # if defined(__cplusplus) && (__cplusplus < 201103L)
47 # error "ROOT requires support for C++11 or higher."
48 # if defined(__GNUC__) || defined(__clang__)
49 # error "Pass `-std=c++11` as compiler argument."
50 # endif
51 # endif
52 #endif
53 
54 /*---- machines --------------------------------------------------------------*/
55 
56 #ifdef __hpux
57  /* R__HPUX10 or R__HPUX11 is determined in the Makefile */
58 # define R__HPUX
59 # define R__UNIX
60 # define ANSICPP
61 # ifdef __LP64__
62 # define R__B64
63 # endif
64 # ifdef R__HPUX10
65 # define NEED_SNPRINTF
66 # endif
67 #endif
68 
69 #ifdef _AIX
70 # define R__AIX
71 # define R__UNIX
72 # define ANSICPP
73 # define R__SEEK64
74 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
75 # define NEED_STRCASECMP
76 #endif
77 
78 #if defined(__linux) || defined(__linux__)
79 # ifndef linux
80 # define linux
81 # endif
82 #endif
83 
84 #if defined(__CYGWIN__) && defined(__GNUC__)
85 # ifndef linux
86 # define linux
87 # endif
88 # ifndef R__WINGCC
89 # define R__WINGCC
90 # endif
91 #endif
92 
93 #if defined(__sun) && !(defined(linux) || defined(__FCC_VERSION))
94 # ifdef __SVR4
95 # define R__SOLARIS
96 # define R__SEEK64
97 # define ANSICPP
98 # ifdef __i386
99 # define R__BYTESWAP
100 # endif
101 # ifdef __x86_64
102 # define R__B64
103 # define R__BYTESWAP
104 # endif
105 # else
106 # define R__SUN
107 # include <stdlib.h>
108 # endif
109 # define R__UNIX
110 # define NEED_STRING
111 # define NEED_SIGJMP
112 # if __SUNPRO_CC > 0x420
113 # define R__SOLARIS_CC50
114 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
115 # endif
116 # if __SUNPRO_CC >= 0x420
117 # define R__SUNCCBUG /* to work around a compiler bug */
118 # endif
119 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 /* modern egcs/gcc */
120 # define R__SUNGCC3
121 # endif
122 #endif
123 
124 #if defined(__FCC_VERSION) /* Solaris with Fujitsu compiler */
125 # define R__SOLARIS
126 # define R__SEEK64
127 # define ANSICPP
128 # define R__UNIX
129 # define NEED_STRING
130 # define NEED_SIGJMP
131 #endif
132 
133 #if defined(linux)
134 # ifndef _LARGEFILE64_SOURCE
135 # define _LARGEFILE64_SOURCE
136 # endif
137 # include <features.h>
138 # if __GNU_LIBRARY__ == 6
139 # ifndef R__GLIBC
140 # define R__GLIBC
141 # endif
142 # endif
143 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2
144 # define R__NONSCALARFPOS2
145 # define R__USESTHROW
146 # define R__SEEK64
147 # endif
148 #endif
149 
150 #if defined(linux) && defined(__i386__)
151 # define R__LINUX
152 # define R__UNIX
153 # define R__BYTESWAP
154 # ifndef __i486__
155 # define __i486__ /* turn off if you really want to run on an i386 */
156 # endif
157 # define NEED_SIGJMP
158 #endif
159 
160 #if defined(linux) && defined(__ia64__)
161 # define R__LINUX
162 # define R__UNIX
163 # define R__BYTESWAP
164 # define R__B64
165 # define NEED_SIGJMP
166 #endif
167 
168 #if defined(linux) && defined(__x86_64__)
169 # define R__LINUX
170 # define R__UNIX
171 # define R__BYTESWAP
172 # define R__B64
173 # define NEED_SIGJMP
174 #endif
175 
176 #if defined(linux) && defined(__arm__)
177 # define R__LINUX
178 # define R__UNIX
179 # define R__BYTESWAP
180 # define NEED_SIGJMP
181 #endif
182 
183 #if defined(linux) && defined(__sparc__)
184 # define R__LINUX
185 # define R__UNIX
186 # define NEED_SIGJMP
187 /*# define R__B64 */ /* enable when 64 bit machine */
188 #endif
189 
190 #if defined(linux) && defined(__hppa)
191 # define R__LINUX
192 # define R__UNIX
193 # define NEED_SIGJMP
194 #endif
195 
196 #if defined(linux) && defined(__powerpc__)
197 # define R__LINUX
198 # define R__UNIX
199 # define NEED_SIGJMP
200 # if defined(R__ppc64)
201 # define R__B64
202 # endif
203 # if defined(_LITTLE_ENDIAN)
204 # define R__BYTESWAP
205 # endif
206 #endif
207 
208 #if defined(linux) && defined(__aarch64__)
209 # define R__LINUX
210 # define R__UNIX
211 # define R__BYTESWAP
212 # define R__B64
213 # define NEED_SIGJMP
214 #endif
215 
216 #if defined(linux) && defined(__s390__)
217 # define R__LINUX
218 # define R__UNIX
219 # define NEED_SIGJMP
220 #endif
221 
222 #if defined(linux) && defined(__s390x__)
223 # define R__LINUX
224 # define R__UNIX
225 # define R__B64
226 # define NEED_SIGJMP
227 #endif
228 
229 #if defined(__MACH__) && defined(__i386__) && !defined(__APPLE__)
230 # define R__HURD
231 # define f2cFortran /* cfortran.h does not know HURD - sigh */
232 # define R__UNIX
233 # define R__BYTESWAP
234 # define R__GLIBC /* GNU/Hurd always use GLIBC 2.x :-) */
235 # define NEED_SIGJMP
236 #endif
237 
238 #if defined(__Lynx__) && defined(__powerpc__)
239 # define R__LYNXOS
240 # define R__UNIX
241 # define ANSICPP
242 # define NEED_SIGJMP
243 # define NEED_STRCASECMP
244 # define NEED_SNPRINTF
245 #endif
246 
247 #if defined(__FreeBSD__)
248 # define R__FBSD
249 # define R__UNIX
250 # define R__BYTESWAP
251 # if defined(__i386__)
252 # ifndef __i486__
253 # define __i486__ /* turn off if you really want to run on an i386 */
254 # endif
255 # endif
256 # if defined(__amd64__)
257 # define R__B64
258 # endif
259 # define HAS_STRLCPY
260 #endif
261 
262 #if defined(__OpenBSD__)
263 # define R__OBSD
264 # define R__UNIX
265 # define R__BYTESWAP
266 # if defined(__i386__)
267 # ifndef __i486__
268 # define __i486__ /* turn off if you really want to run on an i386 */
269 # endif
270 # endif
271 # if defined(__amd64__)
272 # define R__B64
273 # endif
274 # define HAS_STRLCPY
275 #endif
276 
277 #if defined(__APPLE__) /* MacOS X support, initially following FreeBSD */
278 # include <AvailabilityMacros.h>
279 # ifndef __CINT__
280 # include <TargetConditionals.h>
281 # endif
282 # define R__MACOSX
283 # define R__UNIX
284 # if defined(__xlC__) || defined(__xlc__)
285 # define ANSICPP
286 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
287 # endif
288 # if defined(__ppc64__)
289 # define R__B64 /* enable when 64 bit machine */
290 # endif
291 # if defined(__i386__)
292 # define R__BYTESWAP
293 # endif
294 # if defined(__arm__)
295 # define R__BYTESWAP
296 # endif
297 # if defined(__x86_64__)
298 # define R__BYTESWAP
299 # define R__B64 /* enable when 64 bit machine */
300 # endif
301 # define HAS_STRLCPY
302 #endif
303 
304 #ifdef _HIUX_SOURCE
305 # define R__HIUX
306 # define R__UNIX
307 # define NEED_SIGJMP
308 # define NEED_SNPRINTF
309 # define ANSICPP
310 #endif
311 
312 #ifdef __GNUC__
313 # define R__GNU
314 # define ANSICPP
315 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 /* egcs 1.0.3 */
316 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
317 # define R__PLACEMENTDELETE /* supports overloading placement delete */
318 # endif
319 # if __GNUC__ >= 3 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)
320 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
321 # endif
322 # if defined(__ia64__) && __GNUC__ < 3 /* gcc 2.9x (MINOR is 9!) */
323 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
324 # define R__PLACEMENTDELETE /* supports overloading placement delete */
325 # endif
326 # if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ > 1)
327 # define R__PRAGMA_DIAGNOSTIC
328 # endif
329 #endif
330 
331 #ifdef R__USE_CXX14
332 # if defined(R__MACOSX) && !defined(MAC_OS_X_VERSION_10_12)
333  // At least on 10.11, the compiler defines but the c++ library does not provide the size operator delete.
334  // See for example https://llvm.org/bugs/show_bug.cgi?id=22951 or
335  // https://github.com/gperftools/gperftools/issues/794.
336 # elif !defined(__GNUC__)
337 # define R__SIZEDDELETE
338 # elif __GNUC__ > 4
339 # define R__SIZEDDELETE
340 # endif
341 #endif
342 
343 /* allows symbols to be hidden from the shared library export symbol table */
344 /* use typically on file statics and private methods */
345 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
346 # define R__HIDDEN __attribute__((__visibility__("hidden")))
347 #else
348 # define R__HIDDEN
349 #endif
350 
351 #ifdef __INTEL_COMPILER
352 # define R__INTEL_COMPILER
353 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
354 # define R__PLACEMENTDELETE /* supports overloading placement delete */
355 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
356 # define ANSICPP
357 #endif
358 
359 #ifdef __HP_aCC
360 # define R__ACC
361 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
362 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
363 # if __HP_aCC <= 015000
364 # define R__OLDHPACC
365 # define R__TEMPLATE_OVERLOAD_BUG
366 # define R__GLOBALSTL /* STL in global name space */
367 # error "ROOT requires proper support for C++11 or higher"
368 # else
369 # define R__PLACEMENTDELETE /* supports overloading placement delete */
370 # define R__TMPLTSTREAM /* std::iostream implemented with templates */
371 # endif
372 # ifndef _INCLUDE_LONGLONG
373 # define _INCLUDE_LONGLONG
374 # endif
375 #endif
376 
377 #ifdef _WIN32
378 # define R__WIN32
379 # ifndef WIN32
380 # define WIN32
381 # endif
382 # define R__BYTESWAP
383 # define R__ACCESS_IN_SYMBOL
384 //# define __attribute__(X)
385 //# define thread_local static __declspec(thread)
386 #endif
387 
388 #ifdef __SC__
389 # define SC
390 # define R__SC
391 # if defined(WIN32)
392 # define NEED_STRING
393 # define NEED_STRCASECMP
394 # define NEED_SNPRINTF
395 # define ANSICPP
396 # else
397 # define MSDOS
398 # define NEED_STRCASECMP
399 # define R__BYTESWAP
400 # endif
401 #endif
402 
403 #ifdef _MSC_VER
404 # define R__VISUAL_CPLUSPLUS
405 # define NEED_STRING
406 # define NEED_STRCASECMP
407 # if _MSC_VER < 1900
408 # define NEED_SNPRINTF
409 # endif
410 # define ANSICPP
411 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
412 # define R__PLACEMENTDELETE /* supports overloading placement delete */
413 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
414 # if _MSC_VER >= 1400
415 # define DONTNEED_VSNPRINTF
416 # endif
417 # if _MSC_VER < 1310
418 # define R__NO_CLASS_TEMPLATE_SPECIALIZATION
419 # endif
420 # if _MSC_VER <= 1800
421 # define R__NO_ATOMIC_FUNCTION_POINTER
422 # endif
423 #endif
424 
425 /*--- memory and object statistics -------------------------------------------*/
426 
427 /* #define R__NOSTATS */
428 
429 /*--- cpp --------------------------------------------------------------------*/
430 
431 #ifdef ANSICPP
432  /* symbol concatenation operator */
433 # define _NAME1_(name) name
434 # define _NAME2_(name1,name2) name1##name2
435 # define _NAME3_(name1,name2,name3) name1##name2##name3
436 
437  /* stringizing */
438 # define _QUOTE_(name) #name
439 
440 #else
441 
442 # define _NAME1_(name) name
443 # define _NAME2_(name1,name2) _NAME1_(name1)name2
444 # define _NAME3_(name1,name2,name3) _NAME2_(name1,name2)name3
445 
446 # define _QUOTE_(name) "name"
447 
448 #endif
449 
450 /* produce an identifier that is almost unique inside a file */
451 #ifndef __CINT__
452 # define _R__JOIN_(X,Y) _NAME2_(X,Y)
453 # define _R__JOIN3_(F,X,Y) _NAME3_(F,X,Y)
454 # define _R__UNIQUE_DICT_(X) _R__JOIN3_(R__DICTIONARY_FILENAME,X,__LINE__)
455 # define _R__UNIQUE_(X) _R__JOIN_(X,__LINE__)
456 #else
457  /* Currently CINT does not really mind to have duplicates and */
458  /* does not work correctly as far as merging tokens is concerned. */
459 # define _R__UNIQUE_(X) X
460 #endif
461 
462 /*---- deprecation -----------------------------------------------------------*/
463 #if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
464 # if __GNUC__ == 5 && (__GNUC_MINOR__ == 1 || __GNUC_MINOR__ == 2)
465 /* GCC 5.1, 5.2: false positives due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15269 */
466 # define _R__DEPRECATED_LATER(REASON)
467 # else
468 # define _R__DEPRECATED_LATER(REASON) __attribute__((deprecated(REASON)))
469 # endif
470 #elif defined(_MSC_VER)
471 # define _R__DEPRECATED_LATER(REASON) __declspec(deprecated(REASON))
472 #else
473 /* Deprecation not supported for this compiler. */
474 # define _R__DEPRECATED_LATER(REASON)
475 #endif
476 #define _R_DEPRECATED_REMOVE_NOW(REASON) __attribute__((REMOVE_THIS_NOW))
477 
478 /* To be removed by 6.12 */
479 #if ROOT_VERSION_CODE < ROOT_VERSION(6,11,0)
480 # define _R__DEPRECATED_612(REASON) _R__DEPRECATED_LATER(REASON)
481 #else
482 # define _R__DEPRECATED_612(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
483 #endif
484 
485 /* To be removed by 6.14 */
486 #if ROOT_VERSION_CODE < ROOT_VERSION(6,13,0)
487 # define _R__DEPRECATED_614(REASON) _R__DEPRECATED_LATER(REASON)
488 #else
489 # define _R__DEPRECATED_614(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
490 #endif
491 
492 /* To be removed by 7.00 */
493 #if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
494 # define _R__DEPRECATED_700(REASON) _R__DEPRECATED_LATER(REASON)
495 #else
496 # define _R__DEPRECATED_700(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
497 #endif
498 
499 
500 /* Spell as R__DEPRECATED(6,04, "Not threadsafe; use TFoo::Bar().") */
501 #define R__DEPRECATED(MAJOR, MINOR, REASON) \
502  _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
503 
504 /*---- misc ------------------------------------------------------------------*/
505 
506 #ifdef R__GNU
507 # define SafeDelete(p) { if (p) { delete p; p = 0; } }
508 #else
509 # define SafeDelete(p) { delete p; p = 0; }
510 #endif
511 
512 #ifdef __FAST_MATH__
513 #define R__FAST_MATH
514 #endif
515 
516 #if (__GNUC__ >= 7)
517 #define R__DO_PRAGMA(x) _Pragma (#x)
518 # define R__INTENTIONALLY_UNINIT_BEGIN \
519  R__DO_PRAGMA(GCC diagnostic push) \
520  R__DO_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") \
521  R__DO_PRAGMA(GCC diagnostic ignored "-Wuninitialized")
522 # define R__INTENTIONALLY_UNINIT_END \
523  R__DO_PRAGMA(GCC diagnostic pop)
524 #else
525 # define R__INTENTIONALLY_UNINIT_BEGIN
526 # define R__INTENTIONALLY_UNINIT_END
527 
528 #endif
529 
530 #ifdef R__HAS_ATTRIBUTE_ALWAYS_INLINE
531 #define R__ALWAYS_INLINE inline __attribute__((always_inline))
532 #else
533 #define R__ALWAYS_INLINE inline
534 #endif
535 
536 /*---- unlikely / likely expressions -----------------------------------------*/
537 // These are meant to use in cases like:
538 // if (R__unlikely(expression)) { ... }
539 // in performance-critical sessions. R__unlikely / R__likely provide hints to
540 // the compiler code generation to heavily optimize one side of a conditional,
541 // causing the other branch to have a heavy performance cost.
542 //
543 // It is best to use this for conditionals that test for rare error cases or
544 // backward compatibility code.
545 
546 #if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
547 #if !defined(R__unlikely)
548  #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
549 #endif
550 #if !defined(R__likely)
551  #define R__likely(expr) __builtin_expect(!!(expr), 1)
552 #endif
553 #else
554  #define R__unlikely(expr) expr
555  #define R__likely(expr) expr
556 #endif
557 
558 
559 #endif