From 99b2911f0be94593f197ffd67130729f831caf78 Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Tue, 18 Aug 2026 11:11:36 -0400 Subject: [PATCH 1/6] fix some meaningless warnings --- AmpTools/IUAmpTools/AmpToolsInterface.cc | 2 +- AmpTools/IUAmpToolsMPI/DataReaderMPI.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AmpTools/IUAmpTools/AmpToolsInterface.cc b/AmpTools/IUAmpTools/AmpToolsInterface.cc index 4ae72a43..93b32e55 100644 --- a/AmpTools/IUAmpTools/AmpToolsInterface.cc +++ b/AmpTools/IUAmpTools/AmpToolsInterface.cc @@ -906,7 +906,7 @@ AmpToolsInterface::forceUserVarRecalculation( bool state ){ float AmpToolsInterface::random( float randMax ) const { - return ( (float) rand() / RAND_MAX ) * randMax; + return ( (float) rand() / (float) RAND_MAX ) * randMax; } void diff --git a/AmpTools/IUAmpToolsMPI/DataReaderMPI.h b/AmpTools/IUAmpToolsMPI/DataReaderMPI.h index c188668f..a98b88e5 100644 --- a/AmpTools/IUAmpToolsMPI/DataReaderMPI.h +++ b/AmpTools/IUAmpToolsMPI/DataReaderMPI.h @@ -379,7 +379,7 @@ template< class T > void DataReaderMPI::defineMPIType() { - KinStruct kinStruct; + KinStruct kinStruct = {0}; // arrays used to define info about the six elements in the struct int length[6]; From 773c12752b80fe638e8a805daedb5e6fda95b3de Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Fri, 4 Sep 2026 12:40:38 -0400 Subject: [PATCH 2/6] turn off compiler warnings for a few lines where gcc is unable to follow the old fortran logic --- AmpTools/UpRootMinuit/URMinuit.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AmpTools/UpRootMinuit/URMinuit.cc b/AmpTools/UpRootMinuit/URMinuit.cc index 37243b19..3dbfb27b 100644 --- a/AmpTools/UpRootMinuit/URMinuit.cc +++ b/AmpTools/UpRootMinuit/URMinuit.cc @@ -6131,11 +6131,15 @@ void URMinuit::mnplot(Double_urt *xpt, Double_urt *ypt, char* chpt, Int_urt nxyp overpr = kurFALSE; for (i = 1; i <= ny; ++i) { for (ibk = 1; ibk <= nx; ++ibk) { cline[ibk-1] = ' '; } + //*-*- nx/nxbest are clamped above, but gcc's VRP can't see that across the gotos below +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" cline[nx] = '\0'; cline[nx+1] = '\0'; cline[0] = '.'; cline[nx-1] = '.'; cline[nxbest-1] = '.'; +#pragma GCC diagnostic pop if (i != 1 && i != nybest && i != ny) goto L320; for (j = 1; j <= nx; ++j) { cline[j-1] = '.'; } L320: From 71ec17df970993868a3eb7c500150b04233273e8 Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Fri, 4 Sep 2026 12:42:32 -0400 Subject: [PATCH 3/6] unify enums into a common declartion to avoid warnings about mixed types with newer compilers --- AmpPlotter/AmpPlotter/PlotterMainWindow.cc | 4 ++-- AmpPlotter/AmpPlotter/PlotterMainWindow.h | 26 ++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/AmpPlotter/AmpPlotter/PlotterMainWindow.cc b/AmpPlotter/AmpPlotter/PlotterMainWindow.cc index d0f84682..483ad032 100644 --- a/AmpPlotter/AmpPlotter/PlotterMainWindow.cc +++ b/AmpPlotter/AmpPlotter/PlotterMainWindow.cc @@ -253,7 +253,7 @@ m_generator( factory.generator() ) m_canvFrame->AddFrame( m_canvButton, &canvLayoutHints ); // create a button to clear the canvas... - m_clearCanvButton = new TGTextButton( m_canvFrame, "&Clear Canvas", kclearCanv ); + m_clearCanvButton = new TGTextButton( m_canvFrame, "&Clear Canvas", kClearCanv ); m_clearCanvButton->Associate( this ); m_clearCanvButton->Resize( kWidth/3, 20 ); m_canvFrame->AddFrame( m_clearCanvButton, &canvLayoutHints ); @@ -467,7 +467,7 @@ PlotterMainWindow::ProcessMessage( long mes, long p1, long p2 ) } break; - case kclearCanv: + case kClearCanv: m_factory.clearCanvas(); break; diff --git a/AmpPlotter/AmpPlotter/PlotterMainWindow.h b/AmpPlotter/AmpPlotter/PlotterMainWindow.h index db667449..fed03aeb 100644 --- a/AmpPlotter/AmpPlotter/PlotterMainWindow.h +++ b/AmpPlotter/AmpPlotter/PlotterMainWindow.h @@ -57,21 +57,23 @@ class PlotterMainWindow : public TGMainFrame public: - enum { kWidth = 690 }; - enum { kHeight = 500 }; + enum { + kWidth = 690, + kHeight = 500, - enum { kIndexMask = 0x000000FF }; - enum { kButtonMask = 0xFFFFFF00 }; + kIndexMask = 0x000000FF, + kButtonMask = 0xFFFFFF00, - enum { kReaction = 0x000100 }; - enum { kType = 0x000200 }; - enum { kDrawOption = 0x000400 }; + kReaction = 0x000100, + kType = 0x000200, + kDrawOption = 0x000400, - enum { kExit, kPlot, kSelectAllAmp, kClearAmp, kSelectAllSum, kClearSum, - kChoosePlot, kChoosePad , kclearCanv, kChooseCanv}; - enum { kData, kBkgnd, kAccMC, kGenMC }; - enum { kSumSelect, kAmpSelect }; - enum { kWeightMC }; + kExit = 0, kPlot, kSelectAllAmp, kClearAmp, kSelectAllSum, kClearSum, + kChoosePlot, kChoosePad , kClearCanv, kChooseCanv, + kData=0, kBkgnd, kAccMC, kGenMC, + kSumSelect=0, kAmpSelect, + kWeightMC=0 +}; PlotterMainWindow( const TGWindow*, PlotFactory& ); From 22b3556ccb5a720bab758aa2ef88f8cfcaa0bb9d Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Fri, 4 Sep 2026 12:42:56 -0400 Subject: [PATCH 4/6] unify enums into a common declartion to avoid warnings about mixed types with newer compilers --- AmpPlotter/AmpPlotter/PlotterMainWindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmpPlotter/AmpPlotter/PlotterMainWindow.h b/AmpPlotter/AmpPlotter/PlotterMainWindow.h index fed03aeb..ec4ba136 100644 --- a/AmpPlotter/AmpPlotter/PlotterMainWindow.h +++ b/AmpPlotter/AmpPlotter/PlotterMainWindow.h @@ -73,7 +73,7 @@ class PlotterMainWindow : public TGMainFrame kData=0, kBkgnd, kAccMC, kGenMC, kSumSelect=0, kAmpSelect, kWeightMC=0 -}; + }; PlotterMainWindow( const TGWindow*, PlotFactory& ); From 9ae5df132682f41a49513f1efbdb594f2f014a51 Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Fri, 4 Sep 2026 12:45:44 -0400 Subject: [PATCH 5/6] disable all compiler warnings for 5 lines --- AmpTools/UpRootMinuit/URMinuit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AmpTools/UpRootMinuit/URMinuit.cc b/AmpTools/UpRootMinuit/URMinuit.cc index 3dbfb27b..c649b5f0 100644 --- a/AmpTools/UpRootMinuit/URMinuit.cc +++ b/AmpTools/UpRootMinuit/URMinuit.cc @@ -6133,7 +6133,7 @@ void URMinuit::mnplot(Double_urt *xpt, Double_urt *ypt, char* chpt, Int_urt nxyp for (ibk = 1; ibk <= nx; ++ibk) { cline[ibk-1] = ' '; } //*-*- nx/nxbest are clamped above, but gcc's VRP can't see that across the gotos below #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wall" cline[nx] = '\0'; cline[nx+1] = '\0'; cline[0] = '.'; From a4003dbeb5f892581c015229f53685e0b74c7ad3 Mon Sep 17 00:00:00 2001 From: Matthew Shepherd Date: Fri, 4 Sep 2026 13:02:28 -0400 Subject: [PATCH 6/6] avoid warning on clang --- AmpTools/UpRootMinuit/URMinuit.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AmpTools/UpRootMinuit/URMinuit.cc b/AmpTools/UpRootMinuit/URMinuit.cc index c649b5f0..56bfeeb8 100644 --- a/AmpTools/UpRootMinuit/URMinuit.cc +++ b/AmpTools/UpRootMinuit/URMinuit.cc @@ -6131,15 +6131,19 @@ void URMinuit::mnplot(Double_urt *xpt, Double_urt *ypt, char* chpt, Int_urt nxyp overpr = kurFALSE; for (i = 1; i <= ny; ++i) { for (ibk = 1; ibk <= nx; ++ibk) { cline[ibk-1] = ' '; } - //*-*- nx/nxbest are clamped above, but gcc's VRP can't see that across the gotos below + //*-*- gcc can't prove nx/nxbest stay within cline's bounds across the gotos below +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wall" +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif cline[nx] = '\0'; cline[nx+1] = '\0'; cline[0] = '.'; cline[nx-1] = '.'; cline[nxbest-1] = '.'; +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop +#endif if (i != 1 && i != nybest && i != ny) goto L320; for (j = 1; j <= nx; ++j) { cline[j-1] = '.'; } L320: