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