Skip to content

Commit 950e0dd

Browse files
silverweedvepadulano
authored andcommitted
fix some warnings and set -Wno-error for cling
1 parent 1dd1462 commit 950e0dd

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

cling/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
if (NOT MSVC)
2+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
3+
endif()
4+
15
ROOTTEST_ADD_TESTDIRS()

root/dataframe/testIMT.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void getTracks(unsigned int mu, FourVectors& tracks) {
3636
auto nPart = R.Poisson(mu);
3737
tracks.clear();
3838
tracks.reserve(nPart);
39-
for (int i = 0; i < nPart; ++i) {
39+
for (size_t i = 0; i < nPart; ++i) {
4040
double px = R.Gaus(0,10);
4141
double py = R.Gaus(0,10);
4242
double pt = sqrt(px*px +py*py);

root/dataframe/test_misc.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void getTracks(FourVectors& tracks) {
1919
auto nPart = R.Poisson(5);
2020
tracks.clear();
2121
tracks.reserve(nPart);
22-
for (int i = 0; i < nPart; ++i) {
22+
for (size_t i = 0; i < nPart; ++i) {
2323
double px = R.Gaus(0,10);
2424
double py = R.Gaus(0,10);
2525
double pt = sqrt(px*px +py*py);

root/dataframe/test_read_leaves.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int main()
2828
}
2929

3030
RDataFrame d("t", "test_read_leaves.root");
31-
auto check_a_b = [](int a, int b) {
31+
auto check_a_b = []([[maybe_unused]] int a, [[maybe_unused]] int b) {
3232
assert(a == 1);
3333
assert(b == 2);
3434
return true;

root/dataframe/test_read_leaves_nodict.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main()
2626
}
2727

2828
ROOT::RDataFrame d("t", "test_read_leaves_nodict.root");
29-
auto check_a_b = [](int a, int b) {
29+
auto check_a_b = []([[maybe_unused]] int a, [[maybe_unused]] int b) {
3030
assert(a == 1);
3131
assert(b == 2);
3232
return true;

root/io/cpp11Containers/commonUtils.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,22 @@ bool IsSame<>(const TH1F& a, const TH1F& b){
198198
if (gVerboseComparison) std::cout << "The # of bins of the histograms differ: " << nbinsa << " " << nbinsb << std::endl;
199199
return false;
200200
}
201+
const auto AreBitwiseEqual = [](auto a, auto b) {
202+
ULong64_t la, lb;
203+
memcpy(&la, &a, sizeof(a));
204+
memcpy(&lb, &b, sizeof(b));
205+
return la == lb;
206+
};
201207
for (int i=0;i<a.GetNbinsX();++i) {
202208
auto binca = a.GetBinContent(i);
203-
auto bincallu = *(ULong64_t*)(&binca);
204209
auto bincb = b.GetBinContent(i);
205-
auto bincbllu = *(ULong64_t*)(&bincb);
206-
if (bincallu != bincbllu) {
210+
if (!AreBitwiseEqual(binca, bincb)) {
207211
if (gVerboseComparison) std::cout << "The content of bin " << i << " of the histograms differ: " << binca << " " << bincb << std::endl;
208212
return false;
209213
}
210214
auto binea = a.GetBinError(i);
211-
auto bineallu = *(ULong64_t*)(&binea);
212215
auto bineb = b.GetBinError(i);
213-
auto binebllu = *(ULong64_t*)(&bineb);
214-
if (bineallu != binebllu) {
216+
if (!AreBitwiseEqual(binea, bineb)) {
215217
if (gVerboseComparison) std::cout << "The error of bin " << i << " of the histograms differ: " << binea << " " << bineb << std::endl;
216218
return false;
217219
}

0 commit comments

Comments
 (0)