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#if defined(__GLIBCXX__) && !defined(__cpp_sized_deallocation)
337 // Sized global deallocation functions in libstc++ are only enabled if
338 // __cpp_sized_deallocation is defined, which Clang only does if explicitly
339 // passed -fsized-deallocation.
340#else
341# define R__SIZEDDELETE
342#endif
343
344/* allows symbols to be hidden from the shared library export symbol table */
345/* use typically on file statics and private methods */
346#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
347# define R__HIDDEN __attribute__((__visibility__("hidden")))
348#else
349# define R__HIDDEN
350#endif
351
352#ifdef __INTEL_COMPILER
353# define R__INTEL_COMPILER
354# define ANSICPP
355#endif
356
357#ifdef __HP_aCC
358# define R__ACC
359# if __HP_aCC <= 015000
360# define R__OLDHPACC
361# define R__TEMPLATE_OVERLOAD_BUG
362# define R__GLOBALSTL /* STL in global name space */
363#error "ROOT requires proper support for C++17 or higher"
364# else
365# define R__TMPLTSTREAM /* std::iostream implemented with templates */
366# endif
367# ifndef _INCLUDE_LONGLONG
368# define _INCLUDE_LONGLONG
369# endif
370#endif
371
372#ifdef _WIN32
373# define R__WIN32
374# ifndef WIN32
375# define WIN32
376# endif
377# define R__BYTESWAP
378# define R__ACCESS_IN_SYMBOL
379//# define __attribute__(X)
380//# define thread_local static __declspec(thread)
381#endif
382#ifdef _WIN64
383# define R__WIN64
384# ifndef WIN64
385# define WIN64
386# endif
387# define R__x86_64__ 1
388# define R__B64 /* enable when 64 bit machine */
389#endif
390
391#ifdef __SC__
392# define SC
393# define R__SC
394# if defined(WIN32)
395# define NEED_STRING
396# define NEED_STRCASECMP
397# define NEED_SNPRINTF
398# define ANSICPP
399# else
400# define MSDOS
401# define NEED_STRCASECMP
402# define R__BYTESWAP
403# endif
404#endif
405
406#ifdef _MSC_VER
407# define R__VISUAL_CPLUSPLUS
408# define NEED_STRING
409# define NEED_STRCASECMP
410# if _MSC_VER < 1900
411# define NEED_SNPRINTF
412# endif
413# define ANSICPP
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# define _R__JOIN_(X,Y) _NAME2_(X,Y)
452# define _R__JOIN3_(F,X,Y) _NAME3_(F,X,Y)
453# define _R__UNIQUE_DICT_(X) _R__JOIN3_(R__DICTIONARY_FILENAME,X,__LINE__)
454# define _R__UNIQUE_(X) _R__JOIN_(X,__LINE__)
455
456/*---- deprecation -----------------------------------------------------------*/
457#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
458# if (__GNUC__ == 5 && (__GNUC_MINOR__ == 1 || __GNUC_MINOR__ == 2)) || defined(R__NO_DEPRECATION)
459/* GCC 5.1, 5.2: false positives due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15269
460 or deprecation turned off */
461# define _R__DEPRECATED_LATER(REASON)
462# else
463# define _R__DEPRECATED_LATER(REASON) __attribute__((deprecated(REASON)))
464# endif
465#elif defined(_MSC_VER) && !defined(R__NO_DEPRECATION)
466# define _R__DEPRECATED_LATER(REASON) __pragma(deprecated(REASON))
467#else
468/* Deprecation not supported for this compiler. */
469# define _R__DEPRECATED_LATER(REASON)
470#endif
471
472#ifdef R__WIN32
473#define _R_DEPRECATED_REMOVE_NOW(REASON)
474#else
475#define _R_DEPRECATED_REMOVE_NOW(REASON) __attribute__((REMOVE_THIS_NOW))
476#endif
477
478/* USE AS `R__DEPRECATED(6,34, "Not threadsafe; use TFoo::Bar().")`
479 To be removed by 6.34 */
480#if ROOT_VERSION_CODE <= ROOT_VERSION(6,33,2)
481# define _R__DEPRECATED_634(REASON) _R__DEPRECATED_LATER(REASON)
482#else
483# define _R__DEPRECATED_634(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
484#endif
485
486/* USE AS `R__DEPRECATED(6,36, "Not threadsafe; use TFoo::Bar().")`
487 To be removed by 6.36 */
488#if ROOT_VERSION_CODE <= ROOT_VERSION(6,35,0)
489# define _R__DEPRECATED_636(REASON) _R__DEPRECATED_LATER(REASON)
490#else
491# define _R__DEPRECATED_636(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
492#endif
493
494/* USE AS `R__DEPRECATED(6,38, "Not threadsafe; use TFoo::Bar().")`
495 To be removed by 6.38 */
496#if ROOT_VERSION_CODE <= ROOT_VERSION(6,37,0)
497# define _R__DEPRECATED_638(REASON) _R__DEPRECATED_LATER(REASON)
498#else
499# define _R__DEPRECATED_638(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
500#endif
501
502/* USE AS `R__DEPRECATED(7,00, "Not threadsafe; use TFoo::Bar().")`
503 To be removed by 7.00 */
504#if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
505# define _R__DEPRECATED_700(REASON) _R__DEPRECATED_LATER(REASON)
506#else
507# define _R__DEPRECATED_700(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
508#endif
509
510
511/* Spell as R__DEPRECATED(6,04, "Not threadsafe; use TFoo::Bar().") */
512#define R__DEPRECATED(MAJOR, MINOR, REASON) \
513 _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
514
515/* Mechanisms to advise users to avoid legacy functions and classes that will not be removed */
516#if defined R__SUGGEST_NEW_INTERFACE
517# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE) \
518 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
519#else
520# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
521#endif
522
523#define R__ALWAYS_SUGGEST_ALTERNATIVE(ALTERNATIVE) \
524 _R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
525
526
527
528/*---- misc ------------------------------------------------------------------*/
529
530#ifdef R__GNU
531# define SafeDelete(p) { if (p) { delete p; p = nullptr; } }
532#else
533# define SafeDelete(p) { delete p; p = nullptr; }
534#endif
535
536#ifdef __FAST_MATH__
537#define R__FAST_MATH
538#endif
539
540#if (__GNUC__ >= 7)
541#define R__DO_PRAGMA(x) _Pragma (#x)
542# define R__INTENTIONALLY_UNINIT_BEGIN \
543 R__DO_PRAGMA(GCC diagnostic push) \
544 R__DO_PRAGMA(GCC diagnostic ignored "-Wmaybe-uninitialized") \
545 R__DO_PRAGMA(GCC diagnostic ignored "-Wuninitialized")
546# define R__INTENTIONALLY_UNINIT_END \
547 R__DO_PRAGMA(GCC diagnostic pop)
548#else
549# define R__INTENTIONALLY_UNINIT_BEGIN
550# define R__INTENTIONALLY_UNINIT_END
551
552#endif
553
554#ifdef R__HAS_ATTRIBUTE_ALWAYS_INLINE
555#define R__ALWAYS_INLINE inline __attribute__((always_inline))
556#else
557#if defined(_MSC_VER)
558#define R__ALWAYS_INLINE __forceinline
559#else
560#define R__ALWAYS_INLINE inline
561#endif
562#endif
563
564// See also https://nemequ.github.io/hedley/api-reference.html#HEDLEY_NEVER_INLINE
565// for other platforms.
566#ifdef R__HAS_ATTRIBUTE_NOINLINE
567#define R__NEVER_INLINE inline __attribute__((noinline))
568#else
569#if defined(_MSC_VER)
570#define R__NEVER_INLINE inline __declspec(noinline)
571#else
572#define R__NEVER_INLINE inline
573#endif
574#endif
575
576/*---- unlikely / likely expressions -----------------------------------------*/
577// These are meant to use in cases like:
578// if (R__unlikely(expression)) { ... }
579// in performance-critical sections. R__unlikely / R__likely provide hints to
580// the compiler code generation to heavily optimize one side of a conditional,
581// causing the other branch to have a heavy performance cost.
582//
583// It is best to use this for conditionals that test for rare error cases or
584// backward compatibility code.
585
586#if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
587#if !defined(R__unlikely)
588 #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
589#endif
590#if !defined(R__likely)
591 #define R__likely(expr) __builtin_expect(!!(expr), 1)
592#endif
593#else
594 #define R__unlikely(expr) expr
595 #define R__likely(expr) expr
596#endif
597
598// Setting this define causes ROOT to keep statistics about memory buffer allocation
599// time within the TTree. Given that this is a "hot-path", we provide a mechanism
600// for enabling / disabling this at compile time by developers; default is disabled.
601#ifndef R__TRACK_BASKET_ALLOC_TIME
602//#define R__TRACK_BASKET_ALLOC_TIME 1
603#endif
604
605#endif