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