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