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