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