Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RConfig.hxx
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#include "RConfigure.h"
24
25
26/*---- new C++ features ------------------------------------------------------*/
27
28#if defined __has_feature
29# if __has_feature(modules)
30# define R__CXXMODULES
31# endif
32#endif
33
34#define R__USE_SHADOW_CLASS
35
36/* Now required, thus defined by default for backward compatibility */
37#define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
38#define R__SSTREAM /* use sstream or strstream header */
39
40#if defined(_MSC_VER)
41# if (_MSC_VER < 1910)
42# error "ROOT requires Visual Studio 2017 or higher."
43# else
44# define R__NULLPTR
45# endif
46#else
47#if defined(__cplusplus) && (__cplusplus < 201703L)
48#error "ROOT requires support for C++17 or higher."
49# if defined(__GNUC__) || defined(__clang__)
50#error "Pass `-std=c++17` as compiler argument."
51# endif
52# endif
53#endif
54
55/*---- machines --------------------------------------------------------------*/
56
57#ifdef __hpux
58 /* R__HPUX10 or R__HPUX11 is determined in the Makefile */
59# define R__HPUX
60# define R__UNIX
61# define ANSICPP
62# ifdef __LP64__
63# define R__B64
64# endif
65# ifdef R__HPUX10
66# define NEED_SNPRINTF
67# endif
68#endif
69
70#ifdef _AIX
71# define R__AIX
72# define R__UNIX
73# define ANSICPP
74# define R__SEEK64
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# endif
115# if __SUNPRO_CC >= 0x420
116# define R__SUNCCBUG /* to work around a compiler bug */
117# endif
118# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 /* modern egcs/gcc */
119# define R__SUNGCC3
120# endif
121#endif
122
123#if defined(__FCC_VERSION) /* Solaris with Fujitsu compiler */
124# define R__SOLARIS
125# define R__SEEK64
126# define ANSICPP
127# define R__UNIX
128# define NEED_STRING
129# define NEED_SIGJMP
130#endif
131
132#if defined(linux)
133# ifndef _LARGEFILE64_SOURCE
134# define _LARGEFILE64_SOURCE
135# endif
136# include <features.h>
137# if __GNU_LIBRARY__ == 6
138# ifndef R__GLIBC
139# define R__GLIBC
140# endif
141# endif
142# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2
143# define R__NONSCALARFPOS2
144# define R__USESTHROW
145# define R__SEEK64
146# endif
147# if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38)
148# define HAS_STRLCPY
149# endif
150#endif
151
152#if defined(linux) && defined(__i386__)
153# define R__LINUX
154# define R__UNIX
155# define R__BYTESWAP
156# ifndef __i486__
157# define __i486__ /* turn off if you really want to run on an i386 */
158# endif
159# define NEED_SIGJMP
160#endif
161
162#if defined(linux) && defined(__ia64__)
163# define R__LINUX
164# define R__UNIX
165# define R__BYTESWAP
166# define R__B64
167# define NEED_SIGJMP
168#endif
169
170#if defined(linux) && defined(__x86_64__)
171# define R__LINUX
172# define R__UNIX
173# define R__BYTESWAP
174# define R__B64
175# define NEED_SIGJMP
176#endif
177
178#if defined(linux) && defined(__arm__)
179# define R__LINUX
180# define R__UNIX
181# define R__BYTESWAP
182# define NEED_SIGJMP
183#endif
184
185#if defined(linux) && defined(__sparc__)
186# define R__LINUX
187# define R__UNIX
188# define NEED_SIGJMP
189/*# define R__B64 */ /* enable when 64 bit machine */
190#endif
191
192#if defined(linux) && defined(__hppa)
193# define R__LINUX
194# define R__UNIX
195# define NEED_SIGJMP
196#endif
197
198#if defined(linux) && defined(__powerpc__)
199# define R__LINUX
200# define R__UNIX
201# define NEED_SIGJMP
202# if defined(R__ppc64)
203# define R__B64
204# endif
205# if defined(_LITTLE_ENDIAN)
206# define R__BYTESWAP
207# endif
208#endif
209
210#if defined(linux) && defined(__aarch64__)
211# define R__LINUX
212# define R__UNIX
213# define R__BYTESWAP
214# define R__B64
215# define NEED_SIGJMP
216#endif
217
218#if defined(linux) && defined(__s390__)
219# define R__LINUX
220# define R__UNIX
221# define NEED_SIGJMP
222#endif
223
224#if defined(linux) && defined(__s390x__)
225# define R__LINUX
226# define R__UNIX
227# define R__B64
228# define NEED_SIGJMP
229#endif
230
231#if defined(linux) && defined(__riscv)
232# define R__LINUX
233# define R__UNIX
234# define R__BYTESWAP
235# if __riscv_xlen >= 64
236# define R__B64
237# endif
238# define NEED_SIGJMP
239#endif
240
241#if defined(linux) && defined(__loongarch_lp64)
242# define R__LINUX
243# define R__UNIX
244# define R__BYTESWAP
245# define R__B64
246# define NEED_SIGJMP
247#endif
248
249#if defined(__MACH__) && defined(__i386__) && !defined(__APPLE__)
250# define R__HURD
251# define f2cFortran /* cfortran.h does not know HURD - sigh */
252# define R__UNIX
253# define R__BYTESWAP
254# define R__GLIBC /* GNU/Hurd always use GLIBC 2.x :-) */
255# define NEED_SIGJMP
256#endif
257
258#if defined(__Lynx__) && defined(__powerpc__)
259# define R__LYNXOS
260# define R__UNIX
261# define ANSICPP
262# define NEED_SIGJMP
263# define NEED_STRCASECMP
264# define NEED_SNPRINTF
265#endif
266
267#if defined(__FreeBSD__)
268# define R__FBSD
269# define R__UNIX
270# define R__BYTESWAP
271# if defined(__i386__)
272# ifndef __i486__
273# define __i486__ /* turn off if you really want to run on an i386 */
274# endif
275# endif
276# if defined(__amd64__)
277# define R__B64
278# endif
279# define HAS_STRLCPY
280#endif
281
282#if defined(__OpenBSD__)
283# define R__OBSD
284# define R__UNIX
285# define R__BYTESWAP
286# if defined(__i386__)
287# ifndef __i486__
288# define __i486__ /* turn off if you really want to run on an i386 */
289# endif
290# endif
291# if defined(__amd64__)
292# define R__B64
293# endif
294# define HAS_STRLCPY
295#endif
296
297#if defined(__APPLE__) /* MacOS X support, initially following FreeBSD */
298# include <AvailabilityMacros.h>
299# include <TargetConditionals.h>
300# define R__MACOSX
301# define R__UNIX
302# if defined(__xlC__) || defined(__xlc__)
303# define ANSICPP
304# endif
305# if defined(__ppc64__)
306# define R__B64 /* enable when 64 bit machine */
307# endif
308# if defined(__i386__)
309# define R__BYTESWAP
310# endif
311# if defined(__x86_64__)
312# define R__BYTESWAP
313# define R__B64 /* enable when 64 bit machine */
314# endif
315# if defined(__arm__)
316# define R__BYTESWAP
317# endif
318# if defined (__arm64__)
319# define R__BYTESWAP
320# define R__B64 /* enable when 64 bit machine */
321# endif
322# define HAS_STRLCPY
323#endif
324
325#ifdef _HIUX_SOURCE
326# define R__HIUX
327# define R__UNIX
328# define NEED_SIGJMP
329# define NEED_SNPRINTF
330# define ANSICPP
331#endif
332
333#ifdef __GNUC__
334# define R__GNU
335# define ANSICPP
336# if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ > 1)
337# define R__PRAGMA_DIAGNOSTIC
338# endif
339# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
340# define R__BYTESWAP
341# endif
342#endif
343
344#if defined(__GLIBCXX__) && !defined(__cpp_sized_deallocation)
345 // Sized global deallocation functions in libstc++ are only enabled if
346 // __cpp_sized_deallocation is defined, which Clang only does if explicitly
347 // passed -fsized-deallocation.
348#else
349# define R__SIZEDDELETE
350#endif
351
352/* allows symbols to be hidden from the shared library export symbol table */
353/* use typically on file statics and private methods */
354#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
355# define R__HIDDEN __attribute__((__visibility__("hidden")))
356#else
357# define R__HIDDEN
358#endif
359
360#ifdef __INTEL_COMPILER
361# define R__INTEL_COMPILER
362# define ANSICPP
363#endif
364
365#ifdef __HP_aCC
366# define R__ACC
367# if __HP_aCC <= 015000
368# define R__OLDHPACC
369# define R__TEMPLATE_OVERLOAD_BUG
370# define R__GLOBALSTL /* STL in global name space */
371#error "ROOT requires proper support for C++17 or higher"
372# else
373# define R__TMPLTSTREAM /* std::iostream implemented with templates */
374# endif
375# ifndef _INCLUDE_LONGLONG
376# define _INCLUDE_LONGLONG
377# endif
378#endif
379
380#ifdef _WIN32
381# define R__WIN32
382# ifndef WIN32
383# define WIN32
384# endif
385# define R__BYTESWAP
386# define R__ACCESS_IN_SYMBOL
387//# define __attribute__(X)
388//# define thread_local static __declspec(thread)
389#endif
390#ifdef _WIN64
391# define R__WIN64
392# ifndef WIN64
393# define WIN64
394# endif
395# define R__x86_64__ 1
396# define R__B64 /* enable when 64 bit machine */
397#endif
398
399#ifdef __SC__
400# define SC
401# define R__SC
402# if defined(WIN32)
403# define NEED_STRING
404# define NEED_STRCASECMP
405# define NEED_SNPRINTF
406# define ANSICPP
407# else
408# define MSDOS
409# define NEED_STRCASECMP
410# define R__BYTESWAP
411# endif
412#endif
413
414#ifdef _MSC_VER
415# define R__VISUAL_CPLUSPLUS
416# define NEED_STRING
417# define NEED_STRCASECMP
418# if _MSC_VER < 1900
419# define NEED_SNPRINTF
420# endif
421# define ANSICPP
422# if _MSC_VER >= 1400
423# define DONTNEED_VSNPRINTF
424# endif
425# if _MSC_VER < 1310
426# define R__NO_CLASS_TEMPLATE_SPECIALIZATION
427# endif
428# if _MSC_VER <= 1800
429# define R__NO_ATOMIC_FUNCTION_POINTER
430# endif
431#endif
432
433/*--- memory and object statistics -------------------------------------------*/
434
435/* #define R__NOSTATS */
436
437/*--- cpp --------------------------------------------------------------------*/
438
439#ifdef ANSICPP
440 /* symbol concatenation operator */
441# define _NAME1_(name) name
442# define _NAME2_(name1,name2) name1##name2
443# define _NAME3_(name1,name2,name3) name1##name2##name3
444
445 /* stringizing */
446# define _QUOTE_(name) #name
447
448#else
449
450# define _NAME1_(name) name
451# define _NAME2_(name1,name2) _NAME1_(name1)name2
452# define _NAME3_(name1,name2,name3) _NAME2_(name1,name2)name3
453
454# define _QUOTE_(name) "name"
455
456#endif
457
458/* produce an identifier that is almost unique inside a file */
459# define _R__JOIN_(X,Y) _NAME2_(X,Y)
460# define _R__JOIN3_(F,X,Y) _NAME3_(F,X,Y)
461# define _R__UNIQUE_DICT_(X) _R__JOIN3_(R__DICTIONARY_FILENAME,X,__LINE__)
462# define _R__UNIQUE_(X) _R__JOIN_(X,__LINE__)
463
464/*---- deprecation -----------------------------------------------------------*/
465#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
466# if (__GNUC__ == 5 && (__GNUC_MINOR__ == 1 || __GNUC_MINOR__ == 2)) || defined(R__NO_DEPRECATION)
467/* GCC 5.1, 5.2: false positives due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15269
468 or deprecation turned off */
469# define _R__DEPRECATED_LATER(REASON)
470# else
471# define _R__DEPRECATED_LATER(REASON) __attribute__((deprecated(REASON)))
472# endif
473#elif defined(_MSC_VER) && !defined(R__NO_DEPRECATION)
474# define _R__DEPRECATED_LATER(REASON) __pragma(deprecated(REASON))
475#else
476/* Deprecation not supported for this compiler. */
477# define _R__DEPRECATED_LATER(REASON)
478#endif
479
480#ifdef R__WIN32
481#define _R_DEPRECATED_REMOVE_NOW(REASON)
482#else
483#define _R_DEPRECATED_REMOVE_NOW(REASON) __attribute__((REMOVE_THIS_NOW))
484#endif
485
486/* USE AS `R__DEPRECATED(6,34, "Not threadsafe; use TFoo::Bar().")`
487 To be removed by 6.34 */
488#if ROOT_VERSION_CODE <= ROOT_VERSION(6,33,2)
489# define _R__DEPRECATED_634(REASON) _R__DEPRECATED_LATER(REASON)
490#else
491# define _R__DEPRECATED_634(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
492#endif
493
494/* USE AS `R__DEPRECATED(6,36, "Not threadsafe; use TFoo::Bar().")`
495 To be removed by 6.36 */
496#if ROOT_VERSION_CODE <= ROOT_VERSION(6,35,0)
497# define _R__DEPRECATED_636(REASON) _R__DEPRECATED_LATER(REASON)
498#else
499# define _R__DEPRECATED_636(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
500#endif
501
502/* USE AS `R__DEPRECATED(6,38, "Not threadsafe; use TFoo::Bar().")`
503 To be removed by 6.38 */
504#if ROOT_VERSION_CODE <= ROOT_VERSION(6,37,0)
505# define _R__DEPRECATED_638(REASON) _R__DEPRECATED_LATER(REASON)
506#else
507# define _R__DEPRECATED_638(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
508#endif
509
510/* USE AS `R__DEPRECATED(7,00, "Not threadsafe; use TFoo::Bar().")`
511 To be removed by 7.00 */
512#if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
513# define _R__DEPRECATED_700(REASON) _R__DEPRECATED_LATER(REASON)
514#else
515# define _R__DEPRECATED_700(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
516#endif
517
518
519/* Spell as R__DEPRECATED(6,04, "Not threadsafe; use TFoo::Bar().") */
520#define R__DEPRECATED(MAJOR, MINOR, REASON) \
521 _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
522
523/* Mechanisms to advise users to avoid legacy functions and classes that will not be removed */
524#if defined R__SUGGEST_NEW_INTERFACE
525# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE) \
526 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
527#else
528# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
529#endif
530
531#define R__ALWAYS_SUGGEST_ALTERNATIVE(ALTERNATIVE) \
532 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
533
534
535
536/*---- misc ------------------------------------------------------------------*/
537
538#ifdef R__GNU
539# define SafeDelete(p) { if (p) { delete p; p = nullptr; } }
540#else
541# define SafeDelete(p) { delete p; p = nullptr; }
542#endif
543
544#ifdef __FAST_MATH__
545#define R__FAST_MATH
546#endif
547
548#if (__GNUC__ >= 7)
549#define R__DO_PRAGMA(x) _Pragma (#x)
550# define R__INTENTIONALLY_UNINIT_BEGIN \
551 R__DO_PRAGMA(GCC diagnostic push) \
552 R__DO_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") \
553 R__DO_PRAGMA(GCC diagnostic ignored "-Wuninitialized")
554# define R__INTENTIONALLY_UNINIT_END \
555 R__DO_PRAGMA(GCC diagnostic pop)
556#else
557# define R__INTENTIONALLY_UNINIT_BEGIN
558# define R__INTENTIONALLY_UNINIT_END
559
560#endif
561
562#ifdef R__HAS_ATTRIBUTE_ALWAYS_INLINE
563#define R__ALWAYS_INLINE inline __attribute__((always_inline))
564#else
565#if defined(_MSC_VER)
566#define R__ALWAYS_INLINE __forceinline
567#else
568#define R__ALWAYS_INLINE inline
569#endif
570#endif
571
572// See also https://nemequ.github.io/hedley/api-reference.html#HEDLEY_NEVER_INLINE
573// for other platforms.
574#ifdef R__HAS_ATTRIBUTE_NOINLINE
575#define R__NEVER_INLINE inline __attribute__((noinline))
576#else
577#if defined(_MSC_VER)
578#define R__NEVER_INLINE inline __declspec(noinline)
579#else
580#define R__NEVER_INLINE inline
581#endif
582#endif
583
584/*---- unlikely / likely expressions -----------------------------------------*/
585// These are meant to use in cases like:
586// if (R__unlikely(expression)) { ... }
587// in performance-critical sections. R__unlikely / R__likely provide hints to
588// the compiler code generation to heavily optimize one side of a conditional,
589// causing the other branch to have a heavy performance cost.
590//
591// It is best to use this for conditionals that test for rare error cases or
592// backward compatibility code.
593
594#if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
595#if !defined(R__unlikely)
596 #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
597#endif
598#if !defined(R__likely)
599 #define R__likely(expr) __builtin_expect(!!(expr), 1)
600#endif
601#else
602 #define R__unlikely(expr) expr
603 #define R__likely(expr) expr
604#endif
605
606// Setting this define causes ROOT to keep statistics about memory buffer allocation
607// time within the TTree. Given that this is a "hot-path", we provide a mechanism
608// for enabling / disabling this at compile time by developers; default is disabled.
609#ifndef R__TRACK_BASKET_ALLOC_TIME
610//#define R__TRACK_BASKET_ALLOC_TIME 1
611#endif
612
613#endif