From c3579325fa780cd8ee35c29ed649834496645350 Mon Sep 17 00:00:00 2001
From: Pere Mato <pere.mato@cern.ch>
Date: Fri, 9 Jun 2017 16:27:36 +0200
Subject: [PATCH] Warnings cleanup for gcc 7

---
 build/unix/makepchinput.py               | 5 +++--
 hist/histpainter/src/TGraph2DPainter.cxx | 2 +-
 math/minuit/src/TMinuit.cxx              | 4 ++--
 math/rtools/CMakeLists.txt               | 2 +-
 misc/table/src/TVolume.cxx               | 4 ++--
 misc/table/src/TVolumeView.cxx           | 4 ++--
 montecarlo/eg/src/TGenerator.cxx         | 2 +-
 tmva/rmva/CMakeLists.txt                 | 2 +-
 8 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/build/unix/makepchinput.py b/build/unix/makepchinput.py
index 846952fcdbf..1d84e8e8d35 100755
--- a/build/unix/makepchinput.py
+++ b/build/unix/makepchinput.py
@@ -46,10 +46,11 @@ def getParams():
    clingetpchList = argv[3:posDelim]
    cxxflags = argv[posDelim + 1:]
    #print (', '.join(cxxflags))
-   cxxflagsNoW = [flag for flag in cxxflags if (flag[0:2] != '-W' and flag[0:3] != '-wd' and \
+   cxxflagsNoW = {flag for flag in cxxflags if (flag[0:2] != '-W' and flag[0:3] != '-wd' and \
                                                 flag[0:2] != '-x' and flag[0:3] != '-ax' and \
                                                 flag[0:2] != '-O' and flag[0:5] != '-arch') \
-                                                or flag[0:4] == '-Wno']
+                                                or flag[0:4] == '-Wno'} - \
+                  {'-Wno-noexcept-type'}
    #print (', '.join(cxxflagsNoW))
 
    return rootSrcDir, modules, clingetpchList, cxxflagsNoW
diff --git a/hist/histpainter/src/TGraph2DPainter.cxx b/hist/histpainter/src/TGraph2DPainter.cxx
index 0adb25b7257..b868eda67f5 100644
--- a/hist/histpainter/src/TGraph2DPainter.cxx
+++ b/hist/histpainter/src/TGraph2DPainter.cxx
@@ -365,7 +365,7 @@ TList *TGraph2DPainter::GetContourList(Double_t contour)
       }
    }
 
-   Bool_t *segUsed = new Bool_t[fNdt];
+   Bool_t *segUsed = new Bool_t[size_t(fNdt)];
    for(i=0; i<fNdt; i++) segUsed[i]=kFALSE;
 
    // Find all the graphs making the contour. There is two kind of graphs,
diff --git a/math/minuit/src/TMinuit.cxx b/math/minuit/src/TMinuit.cxx
index ff62b8a9501..b44f401b0f8 100644
--- a/math/minuit/src/TMinuit.cxx
+++ b/math/minuit/src/TMinuit.cxx
@@ -6095,7 +6095,7 @@ void TMinuit::mnplot(Double_t *xpt, Double_t *ypt, char *chpt, Int_t nxypt, Int_
    Int_t nxbest, nybest, km1, ibk, isp1, nx, ny, ks, ix;
    TString chmess, ctemp;
    Bool_t overpr;
-   char cline[120];
+   char cline[144];
    char chsav, chbest;
 
    /* Function Body */
@@ -6228,7 +6228,7 @@ L400:
    }
    iten = (nx + 9) / 10;
    for (ibk = 1; ibk <= iten && ibk <= 12; ++ibk) {
-      snprintf(cline + (ibk-1)*10, 11-(ibk == 12), "%#9.3g ", xvalus[ibk-1]);
+      snprintf(cline + (ibk-1)*12, 12-(ibk == 12), "%#9.3g ", xvalus[ibk-1]);
    }
    Printf("           %s", cline);
    chmess = " ";
diff --git a/math/rtools/CMakeLists.txt b/math/rtools/CMakeLists.txt
index b073a2e561d..ce7b171f185 100644
--- a/math/rtools/CMakeLists.txt
+++ b/math/rtools/CMakeLists.txt
@@ -3,7 +3,7 @@
 # @author Pere Mato, CERN
 ############################################################################
 
-include_directories(${R_INCLUDE_DIRS})
+include_directories(SYSTEM ${R_INCLUDE_DIRS})
 
 ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-overloaded-virtual)
 
diff --git a/misc/table/src/TVolume.cxx b/misc/table/src/TVolume.cxx
index 093eebc4aa0..d21b0f223de 100644
--- a/misc/table/src/TVolume.cxx
+++ b/misc/table/src/TVolume.cxx
@@ -435,10 +435,10 @@ void TVolume::Draw(Option_t *option)
 
    Int_t iopt = atoi(option);
    TDataSet *parent = 0;
-   char buffer[10];
+   char buffer[12];
    if (iopt < 0) {
       // set the "positive option"
-      snprintf(buffer,10,"%d",-iopt);
+      snprintf(buffer,12,"%d",-iopt);
       option = buffer;
       // select parent to draw
       parent = this;
diff --git a/misc/table/src/TVolumeView.cxx b/misc/table/src/TVolumeView.cxx
index 49d0b8dd562..33a479b72bd 100644
--- a/misc/table/src/TVolumeView.cxx
+++ b/misc/table/src/TVolumeView.cxx
@@ -529,9 +529,9 @@ void TVolumeView::Draw(Option_t *option)
 
    Int_t iopt = atoi(option);
    TDataSet *parent = 0;
-   char buffer[10];
+   char buffer[12];
    if (iopt < 0) {
-      snprintf(buffer,10,"%d",-iopt);
+      snprintf(buffer,12,"%d",-iopt);
       option = buffer;
       // select parent to draw
       parent = this;
diff --git a/montecarlo/eg/src/TGenerator.cxx b/montecarlo/eg/src/TGenerator.cxx
index 739db1d9fb3..900f9b8dc39 100644
--- a/montecarlo/eg/src/TGenerator.cxx
+++ b/montecarlo/eg/src/TGenerator.cxx
@@ -480,7 +480,7 @@ void TGenerator::Draw(Option_t *option)
    text->DrawText(-0.45,-0.92,tcount);
 
    if (nPionPlus+nPionMinus) {
-      snprintf(tcount,12,"Kaons/Pions= %4f",Float_t(nKaons)/Float_t(nPionPlus+nPionMinus));
+      snprintf(tcount,31,"Kaons/Pions= %4f",Float_t(nKaons)/Float_t(nPionPlus+nPionMinus));
    } else {
       strlcpy(tcount,"Kaons/Pions= inf",31);
    }
diff --git a/tmva/rmva/CMakeLists.txt b/tmva/rmva/CMakeLists.txt
index c95fcf3d9ad..744b02644f8 100644
--- a/tmva/rmva/CMakeLists.txt
+++ b/tmva/rmva/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 set(libname RMVA)
 
-include_directories(${R_INCLUDE_DIRS})
+include_directories(SYSTEM ${R_INCLUDE_DIRS})
 
 set(R_HEADERS ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/RMethodBase.h 
               ${CMAKE_SOURCE_DIR}/tmva/rmva/inc/TMVA/MethodC50.h
-- 
GitLab