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