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(__MACH__) && defined(__i386__) && !defined(__APPLE__)
242# define R__HURD
243# define f2cFortran /* cfortran.h does not know HURD - sigh */
244# define R__UNIX
245# define R__BYTESWAP
246# define R__GLIBC /* GNU/Hurd always use GLIBC 2.x :-) */
247# define NEED_SIGJMP
248#endif
249
250#if defined(__Lynx__) && defined(__powerpc__)
251# define R__LYNXOS
252# define R__UNIX
253# define ANSICPP
254# define NEED_SIGJMP
255# define NEED_STRCASECMP
256# define NEED_SNPRINTF
257#endif
258
259#if defined(__FreeBSD__)
260# define R__FBSD
261# define R__UNIX
262# define R__BYTESWAP
263# if defined(__i386__)
264# ifndef __i486__
265# define __i486__ /* turn off if you really want to run on an i386 */
266# endif
267# endif
268# if defined(__amd64__)
269# define R__B64
270# endif
271# define HAS_STRLCPY
272#endif
273
274#if defined(__OpenBSD__)
275# define R__OBSD
276# define R__UNIX
277# define R__BYTESWAP
278# if defined(__i386__)
279# ifndef __i486__
280# define __i486__ /* turn off if you really want to run on an i386 */
281# endif
282# endif
283# if defined(__amd64__)
284# define R__B64
285# endif
286# define HAS_STRLCPY
287#endif
288
289#if defined(__APPLE__) /* MacOS X support, initially following FreeBSD */
290# include <AvailabilityMacros.h>
291# include <TargetConditionals.h>
292# define R__MACOSX
293# define R__UNIX
294# if defined(__xlC__) || defined(__xlc__)
295# define ANSICPP
296# endif
297# if defined(__ppc64__)
298# define R__B64 /* enable when 64 bit machine */
299# endif
300# if defined(__i386__)
301# define R__BYTESWAP
302# endif
303# if defined(__x86_64__)
304# define R__BYTESWAP
305# define R__B64 /* enable when 64 bit machine */
306# endif
307# if defined(__arm__)
308# define R__BYTESWAP
309# endif
310# if defined (__arm64__)
311# define R__BYTESWAP
312# define R__B64 /* enable when 64 bit machine */
313# endif
314# define HAS_STRLCPY
315#endif
316
317#ifdef _HIUX_SOURCE
318# define R__HIUX
319# define R__UNIX
320# define NEED_SIGJMP
321# define NEED_SNPRINTF
322# define ANSICPP
323#endif
324
325#ifdef __GNUC__
326# define R__GNU
327# define ANSICPP
328# if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ > 1)
329# define R__PRAGMA_DIAGNOSTIC
330# endif
331# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
332# define R__BYTESWAP
333# endif
334#endif
335
336#ifdef __cpp_sized_deallocation
337// Sized global deallocation functions are only enabled if __cpp_sized_deallocation is defined.
338# define R__SIZEDDELETE
339#endif
340
341/* allows symbols to be hidden from the shared library export symbol table */
342/* use typically on file statics and private methods */
343#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
344# define R__HIDDEN __attribute__((__visibility__("hidden")))
345#else
346# define R__HIDDEN
347#endif
348
349#ifdef __INTEL_COMPILER
350# define R__INTEL_COMPILER
351# define ANSICPP
352#endif
353
354#ifdef __HP_aCC
355# define R__ACC
356# if __HP_aCC <= 015000
357# define R__OLDHPACC
358# define R__TEMPLATE_OVERLOAD_BUG
359# define R__GLOBALSTL /* STL in global name space */
360#error "ROOT requires proper support for C++17 or higher"
361# else
362# define R__TMPLTSTREAM /* std::iostream implemented with templates */
363# endif
364# ifndef _INCLUDE_LONGLONG
365# define _INCLUDE_LONGLONG
366# endif
367#endif
368
369#ifdef _WIN32
370# define R__WIN32
371# ifndef WIN32
372# define WIN32
373# endif
374# define R__BYTESWAP
375# define R__ACCESS_IN_SYMBOL
376//# define __attribute__(X)
377//# define thread_local static __declspec(thread)
378#endif
379#ifdef _WIN64
380# define R__WIN64
381# ifndef WIN64
382# define WIN64
383# endif
384# define R__x86_64__ 1
385# define R__B64 /* enable when 64 bit machine */
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# if _MSC_VER >= 1400
412# define DONTNEED_VSNPRINTF
413# endif
414# if _MSC_VER < 1310
415# define R__NO_CLASS_TEMPLATE_SPECIALIZATION
416# endif
417# if _MSC_VER <= 1800
418# define R__NO_ATOMIC_FUNCTION_POINTER
419# endif
420#endif
421
422/*--- memory and object statistics -------------------------------------------*/
423
424/* #define R__NOSTATS */
425
426/*--- cpp --------------------------------------------------------------------*/
427
428#ifdef ANSICPP
429 /* symbol concatenation operator */
430# define _NAME1_(name) name
431# define _NAME2_(name1,name2) name1##name2
432# define _NAME3_(name1,name2,name3) name1##name2##name3
433
434 /* stringizing */
435# define _QUOTE_(name) #name
436
437#else
438
439# define _NAME1_(name) name
440# define _NAME2_(name1,name2) _NAME1_(name1)name2
441# define _NAME3_(name1,name2,name3) _NAME2_(name1,name2)name3
442
443# define _QUOTE_(name) "name"
444
445#endif
446
447/* produce an identifier that is almost unique inside a file */
448# define _R__JOIN_(X,Y) _NAME2_(X,Y)
449# define _R__JOIN3_(F,X,Y) _NAME3_(F,X,Y)
450# define _R__UNIQUE_DICT_(X) _R__JOIN3_(R__DICTIONARY_FILENAME,X,__LINE__)
451# define _R__UNIQUE_(X) _R__JOIN_(X,__LINE__)
452
453/*---- deprecation -----------------------------------------------------------*/
454#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
455# if (__GNUC__ == 5 && (__GNUC_MINOR__ == 1 || __GNUC_MINOR__ == 2)) || defined(R__NO_DEPRECATION)
456/* GCC 5.1, 5.2: false positives due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15269
457 or deprecation turned off */
458# define _R__DEPRECATED_LATER(REASON)
459# else
460# define _R__DEPRECATED_LATER(REASON) __attribute__((deprecated(REASON)))
461# endif
462#elif defined(_MSC_VER) && !defined(R__NO_DEPRECATION)
463# define _R__DEPRECATED_LATER(REASON) __pragma(deprecated(REASON))
464#else
465/* Deprecation not supported for this compiler. */
466# define _R__DEPRECATED_LATER(REASON)
467#endif
468
469#ifdef R__WIN32
470#define _R_DEPRECATED_REMOVE_NOW(REASON)
471#else
472#define _R_DEPRECATED_REMOVE_NOW(REASON) __attribute__((REMOVE_THIS_NOW))
473#endif
474
475/* USE AS `R__DEPRECATED(6,34, "Not threadsafe; use TFoo::Bar().")`
476 To be removed by 6.34 */
477#if ROOT_VERSION_CODE <= ROOT_VERSION(6,33,2)
478# define _R__DEPRECATED_634(REASON) _R__DEPRECATED_LATER(REASON)
479#else
480# define _R__DEPRECATED_634(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
481#endif
482
483/* USE AS `R__DEPRECATED(6,36, "Not threadsafe; use TFoo::Bar().")`
484 To be removed by 6.36 */
485#if ROOT_VERSION_CODE <= ROOT_VERSION(6,35,0)
486# define _R__DEPRECATED_636(REASON) _R__DEPRECATED_LATER(REASON)
487#else
488# define _R__DEPRECATED_636(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
489#endif
490
491/* USE AS `R__DEPRECATED(6,38, "Not threadsafe; use TFoo::Bar().")`
492 To be removed by 6.38 */
493#if ROOT_VERSION_CODE <= ROOT_VERSION(6,37,0)
494# define _R__DEPRECATED_638(REASON) _R__DEPRECATED_LATER(REASON)
495#else
496# define _R__DEPRECATED_638(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
497#endif
498
499/* USE AS `R__DEPRECATED(7,00, "Not threadsafe; use TFoo::Bar().")`
500 To be removed by 7.00 */
501#if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
502# define _R__DEPRECATED_700(REASON) _R__DEPRECATED_LATER(REASON)
503#else
504# define _R__DEPRECATED_700(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
505#endif
506
507
508/* Spell as R__DEPRECATED(6,04, "Not threadsafe; use TFoo::Bar().") */
509#define R__DEPRECATED(MAJOR, MINOR, REASON) \
510 _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
511
512/* Mechanisms to advise users to avoid legacy functions and classes that will not be removed */
513#if defined R__SUGGEST_NEW_INTERFACE
514# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE) \
515 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
516#else
517# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
518#endif
519
520#define R__ALWAYS_SUGGEST_ALTERNATIVE(ALTERNATIVE) \
521 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
522
523
524
525/*---- misc ------------------------------------------------------------------*/
526
527#ifdef R__GNU
528# define SafeDelete(p) { if (p) { delete p; p = nullptr; } }
529#else
530# define SafeDelete(p) { delete p; p = nullptr; }
531#endif
532
533#ifdef __FAST_MATH__
534#define R__FAST_MATH
535#endif
536
537#if (__GNUC__ >= 7)
538#define R__DO_PRAGMA(x) _Pragma (#x)
539# define R__INTENTIONALLY_UNINIT_BEGIN \
540 R__DO_PRAGMA(GCC diagnostic push) \
541 R__DO_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") \
542 R__DO_PRAGMA(GCC diagnostic ignored "-Wuninitialized")
543# define R__INTENTIONALLY_UNINIT_END \
544 R__DO_PRAGMA(GCC diagnostic pop)
545#else
546# define R__INTENTIONALLY_UNINIT_BEGIN
547# define R__INTENTIONALLY_UNINIT_END
548
549#endif
550
551#ifdef R__HAS_ATTRIBUTE_ALWAYS_INLINE
552#define R__ALWAYS_INLINE inline __attribute__((always_inline))
553#else
554#if defined(_MSC_VER)
555#define R__ALWAYS_INLINE __forceinline
556#else
557#define R__ALWAYS_INLINE inline
558#endif
559#endif
560
561// See also https://nemequ.github.io/hedley/api-reference.html#HEDLEY_NEVER_INLINE
562// for other platforms.
563#ifdef R__HAS_ATTRIBUTE_NOINLINE
564#define R__NEVER_INLINE inline __attribute__((noinline))
565#else
566#if defined(_MSC_VER)
567#define R__NEVER_INLINE inline __declspec(noinline)
568#else
569#define R__NEVER_INLINE inline
570#endif
571#endif
572
573/*---- unlikely / likely expressions -----------------------------------------*/
574// These are meant to use in cases like:
575// if (R__unlikely(expression)) { ... }
576// in performance-critical sections. R__unlikely / R__likely provide hints to
577// the compiler code generation to heavily optimize one side of a conditional,
578// causing the other branch to have a heavy performance cost.
579//
580// It is best to use this for conditionals that test for rare error cases or
581// backward compatibility code.
582
583#if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
584#if !defined(R__unlikely)
585 #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
586#endif
587#if !defined(R__likely)
588 #define R__likely(expr) __builtin_expect(!!(expr), 1)
589#endif
590#else
591 #define R__unlikely(expr) expr
592 #define R__likely(expr) expr
593#endif
594
595// Setting this define causes ROOT to keep statistics about memory buffer allocation
596// time within the TTree. Given that this is a "hot-path", we provide a mechanism
597// for enabling / disabling this at compile time by developers; default is disabled.
598#ifndef R__TRACK_BASKET_ALLOC_TIME
599//#define R__TRACK_BASKET_ALLOC_TIME 1
600#endif
601
602#endif