Skip to content

Commit 1fde829

Browse files
committed
[CMake] Add R__HAS_CLAD preprocessor macro
To avoid warnings about unknown pragmas, it's useful to have a `R__HAS_CLAD` macro defined in the interpreter, so that Clad pragmas can be conditional on Clad being available.
1 parent c591107 commit 1fde829

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

cmake/modules/RootConfiguration.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ if(lz4)
355355
else()
356356
set(haslz4compression undef)
357357
endif()
358+
if(clad)
359+
set(hasclad define)
360+
else()
361+
set(hasclad undef)
362+
endif()
358363
if(cocoa)
359364
set(hascocoa define)
360365
else()

config/RConfigure.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#@hasmathmore@ R__HAS_MATHMORE /**/
3636
#@haspthread@ R__HAS_PTHREAD /**/
3737
#@hasxft@ R__HAS_XFT /**/
38+
#@hasclad@ R__HAS_CLAD /**/
3839
#@hascocoa@ R__HAS_COCOA /**/
3940
#@hasvc@ R__HAS_VC /**/
4041
#@hasvdt@ R__HAS_VDT /**/

roofit/roofitcore/inc/RooFit/Detail/MathFuncs.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#ifndef RooFit_Detail_MathFuncs_h
1515
#define RooFit_Detail_MathFuncs_h
1616

17+
#include <ROOT/RConfig.hxx> // for R__HAS_CLAD
18+
1719
#include <TMath.h>
1820
#include <Math/PdfFuncMathCore.h>
1921
#include <Math/ProbFuncMathCore.h>
@@ -177,9 +179,9 @@ template <typename DoubleArray>
177179
double constraintSum(DoubleArray comp, unsigned int compSize)
178180
{
179181
double sum = 0;
180-
#ifdef __CLING__
181-
#pragma clad checkpoint loop
182-
#endif
182+
#if defined(__CLING__) && defined(R__HAS_CLAD)
183+
#pragma clad checkpoint loop
184+
#endif
183185
for (unsigned int i = 0; i < compSize; i++) {
184186
sum -= std::log(comp[i]);
185187
}
@@ -367,9 +369,9 @@ double flexibleInterp(unsigned int code, ParamsArray params, unsigned int n, Dou
367369
double boundary, double nominal, int doCutoff)
368370
{
369371
double total = nominal;
370-
#ifdef __CLING__
371-
#pragma clad checkpoint loop
372-
#endif
372+
#if defined(__CLING__) && defined(R__HAS_CLAD)
373+
#pragma clad checkpoint loop
374+
#endif
373375
for (std::size_t i = 0; i < n; ++i) {
374376
total += flexibleInterpSingle(code, low[i], high[i], boundary, nominal, params[i], total);
375377
}

0 commit comments

Comments
 (0)