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