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