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