Skip to content

Commit bd9681b

Browse files
committed
Fix warnings when compiling with Clang 21
Fixing warnings like: ```txt In file included from /home/rembserj/code/root/root_src/core/metacling/src/TClingCallFunc.cxx:32: /home/rembserj/code/root/root_src/core/metacling/src/TCling.h:372:17: warning: virtual method 'GetFunctionName' is inside a 'final' class and can never be overridden [-Wunnecessary-virtual-specifier] 372 | virtual void GetFunctionName(const clang::Decl *decl, std::string &name) const; | ^ 1 warning generated. ``` or ``` /home/rembserj/code/root/root_src/tree/ntuple/test/ntuple_parallel_writer.cxx:97:29: warning: variable 'pt1' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] 97 | e1->BindRawPtr("pt", &pt1); | ```
1 parent 477137c commit bd9681b

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

core/metacling/src/TCling.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class TCling final : public TInterpreter {
191191

192192
public: // Public Interface
193193

194-
virtual ~TCling();
194+
~TCling() override;
195195
TCling(const char* name, const char* title, const char* const argv[], void *interpLibHandle);
196196

197197
void AddIncludePath(const char* path) final;
@@ -219,11 +219,11 @@ class TCling final : public TInterpreter {
219219
const char* GetClassSharedLibs(const char* cls, bool skipCore = true) final;
220220
const char* GetSharedLibDeps(const char* lib, bool tryDyld = false) final;
221221
const char* GetIncludePath() final;
222-
virtual const char* GetSTLIncludePath() const final;
222+
const char* GetSTLIncludePath() const final override;
223223
TObjArray* GetRootMapFiles() const final { return fRootmapFiles; }
224224
unsigned long long GetInterpreterStateMarker() const final { return fTransactionCount;}
225-
virtual void Initialize() final;
226-
virtual void ShutDown() final;
225+
void Initialize() final override;
226+
void ShutDown() final override;
227227
void InspectMembers(TMemberInspector&, const void* obj, const TClass* cl, Bool_t isTransient) final;
228228
Bool_t IsLoaded(const char* filename) const final;
229229
Bool_t IsLibraryLoaded(const char* libname) const final;
@@ -252,7 +252,7 @@ class TCling final : public TInterpreter {
252252
const char** classesHeaders,
253253
Bool_t lateRegistration = false,
254254
Bool_t hasCxxModule = false) final;
255-
virtual void AddAvailableIndentifiers(TSeqCollection& Idents) final;
255+
void AddAvailableIndentifiers(TSeqCollection& Idents) final override;
256256
void RegisterTClassUpdate(TClass *oldcl,DictFuncPtr_t dict) final;
257257
void UnRegisterTClassUpdate(const TClass *oldcl) final;
258258

@@ -301,7 +301,7 @@ class TCling final : public TInterpreter {
301301
DeclId_t GetFunctionWithValues(ClassInfo_t *cl, const char* method, const char* params, Bool_t objectIsConst = kFALSE) final;
302302
DeclId_t GetFunctionTemplate(ClassInfo_t *cl, const char *funcname) final;
303303
void GetFunctionOverloads(ClassInfo_t *cl, const char *funcname, std::vector<DeclId_t>& res) const final;
304-
virtual void LoadFunctionTemplates(TClass* cl) const final;
304+
void LoadFunctionTemplates(TClass* cl) const final override;
305305

306306
std::vector<std::string> GetUsingNamespaces(ClassInfo_t *cl) const final;
307307

@@ -369,7 +369,7 @@ class TCling final : public TInterpreter {
369369

370370
// core/meta helper functions.
371371
EReturnType MethodCallReturnType(TFunction *func) const final;
372-
virtual void GetFunctionName(const clang::Decl *decl, std::string &name) const;
372+
void GetFunctionName(const clang::Decl *decl, std::string &name) const;
373373
bool DiagnoseIfInterpreterException(const std::exception &e) const final;
374374

375375
// CallFunc interface

roofit/roofitcore/inc/RooFit/ModelConfig.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
6767
/// Set a workspace that owns all the necessary components for the analysis.
6868
void SetWS(RooWorkspace &ws) override;
6969
//// alias for SetWS(...)
70-
virtual void SetWorkspace(RooWorkspace &ws) { SetWS(ws); }
70+
void SetWorkspace(RooWorkspace &ws) { SetWS(ws); }
7171

7272
/// Remove the existing reference to a workspace and replace it with this new one.
7373
void ReplaceWS(RooWorkspace *ws) override
@@ -77,28 +77,28 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
7777
}
7878

7979
/// Set the proto DataSet, add to the workspace if not already there
80-
virtual void SetProtoData(RooAbsData &data)
80+
void SetProtoData(RooAbsData &data)
8181
{
8282
ImportDataInWS(data);
8383
SetProtoData(data.GetName());
8484
}
8585

8686
/// Set the Pdf, add to the workspace if not already there
87-
virtual void SetPdf(const RooAbsPdf &pdf)
87+
void SetPdf(const RooAbsPdf &pdf)
8888
{
8989
ImportPdfInWS(pdf);
9090
SetPdf(pdf.GetName());
9191
}
9292

9393
/// Set the Prior Pdf, add to the workspace if not already there
94-
virtual void SetPriorPdf(const RooAbsPdf &pdf)
94+
void SetPriorPdf(const RooAbsPdf &pdf)
9595
{
9696
ImportPdfInWS(pdf);
9797
SetPriorPdf(pdf.GetName());
9898
}
9999

100100
/// Specify parameters of the PDF.
101-
virtual void SetParameters(const RooArgSet &set)
101+
void SetParameters(const RooArgSet &set)
102102
{
103103
if (!SetHasOnlyParameters(set, "ModelConfig::SetParameters"))
104104
return;
@@ -107,7 +107,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
107107
}
108108

109109
/// Specify parameters of interest.
110-
virtual void SetParametersOfInterest(const RooArgSet &set)
110+
void SetParametersOfInterest(const RooArgSet &set)
111111
{
112112
if (!SetHasOnlyParameters(set, "ModelConfig::SetParametersOfInterest"))
113113
return;
@@ -116,7 +116,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
116116

117117
/// Specify parameters
118118
/// using a list of comma-separated list of arguments already in the workspace.
119-
virtual void SetParameters(const char *argList)
119+
void SetParameters(const char *argList)
120120
{
121121
if (!GetWS())
122122
return;
@@ -125,10 +125,10 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
125125

126126
/// Specify parameters of interest
127127
/// using a comma-separated list of arguments already in the workspace.
128-
virtual void SetParametersOfInterest(const char *argList) { SetParameters(argList); }
128+
void SetParametersOfInterest(const char *argList) { SetParameters(argList); }
129129

130130
/// Specify the nuisance parameters (parameters that are not POI).
131-
virtual void SetNuisanceParameters(const RooArgSet &set)
131+
void SetNuisanceParameters(const RooArgSet &set)
132132
{
133133
if (!SetHasOnlyParameters(set, "ModelConfig::SetNuisanceParameters"))
134134
return;
@@ -138,15 +138,15 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
138138

139139
/// Specify the nuisance parameters
140140
/// using a comma-separated list of arguments already in the workspace.
141-
virtual void SetNuisanceParameters(const char *argList)
141+
void SetNuisanceParameters(const char *argList)
142142
{
143143
if (!GetWS())
144144
return;
145145
SetNuisanceParameters(GetWS()->argSet(argList));
146146
}
147147

148148
/// Specify the constraint parameters
149-
virtual void SetConstraintParameters(const RooArgSet &set)
149+
void SetConstraintParameters(const RooArgSet &set)
150150
{
151151
if (!SetHasOnlyParameters(set, "ModelConfig::SetConstrainedParameters"))
152152
return;
@@ -155,15 +155,15 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
155155
}
156156
/// Specify the constraint parameters
157157
/// through a comma-separated list of arguments already in the workspace.
158-
virtual void SetConstraintParameters(const char *argList)
158+
void SetConstraintParameters(const char *argList)
159159
{
160160
if (!GetWS())
161161
return;
162162
SetConstraintParameters(GetWS()->argSet(argList));
163163
}
164164

165165
/// Specify the observables.
166-
virtual void SetObservables(const RooArgSet &set)
166+
void SetObservables(const RooArgSet &set)
167167
{
168168
if (!SetHasOnlyParameters(set, "ModelConfig::SetObservables"))
169169
return;
@@ -172,27 +172,27 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
172172
}
173173
/// specify the observables
174174
/// through a comma-separated list of arguments already in the workspace.
175-
virtual void SetObservables(const char *argList)
175+
void SetObservables(const char *argList)
176176
{
177177
if (!GetWS())
178178
return;
179179
SetObservables(GetWS()->argSet(argList));
180180
}
181181

182-
virtual void SetConditionalObservables(const RooArgSet &set);
182+
void SetConditionalObservables(const RooArgSet &set);
183183
/// Specify the conditional observables
184184
/// through a comma-separated list of arguments already in the workspace.
185-
virtual void SetConditionalObservables(const char *argList)
185+
void SetConditionalObservables(const char *argList)
186186
{
187187
if (!GetWS())
188188
return;
189189
SetConditionalObservables(GetWS()->argSet(argList));
190190
}
191191

192-
virtual void SetGlobalObservables(const RooArgSet &set);
192+
void SetGlobalObservables(const RooArgSet &set);
193193
/// Specify the global observables
194194
/// through a comma-separated list of arguments already in the workspace.
195-
virtual void SetGlobalObservables(const char *argList)
195+
void SetGlobalObservables(const char *argList)
196196
{
197197
if (!GetWS())
198198
return;
@@ -202,7 +202,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
202202
void SetExternalConstraints(const RooArgSet &set);
203203
/// Specify the external constraints
204204
/// through a comma-separated list of arguments already in the workspace.
205-
virtual void SetExternalConstraints(const char *argList)
205+
void SetExternalConstraints(const char *argList)
206206
{
207207
if (!GetWS())
208208
return;
@@ -211,10 +211,10 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
211211

212212
/// Set parameter values for a particular hypothesis if using a common PDF
213213
/// by saving a snapshot in the workspace.
214-
virtual void SetSnapshot(const RooArgSet &set);
214+
void SetSnapshot(const RooArgSet &set);
215215

216216
/// Specify the name of the PDF in the workspace to be used.
217-
virtual void SetPdf(const char *name)
217+
void SetPdf(const char *name)
218218
{
219219
if (!GetWS())
220220
return;
@@ -231,7 +231,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
231231
}
232232

233233
/// Specify the name of the PDF in the workspace to be used.
234-
virtual void SetPriorPdf(const char *name)
234+
void SetPriorPdf(const char *name)
235235
{
236236
if (!GetWS())
237237
return;
@@ -248,7 +248,7 @@ class ModelConfig final : public TNamed, public RooWorkspaceHandle {
248248
}
249249

250250
/// Specify the name of the dataset in the workspace to be used.
251-
virtual void SetProtoData(const char *name)
251+
void SetProtoData(const char *name)
252252
{
253253
if (!GetWS())
254254
return;

roofit/roofitcore/inc/RooStringVar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class RooStringVar final : public RooAbsArg {
2929
TObject* clone(const char* newname=nullptr) const override { return new RooStringVar(*this,newname); }
3030

3131
// Parameter value and error accessors
32-
virtual operator TString() {return TString(_string.c_str()); }
32+
operator TString() {return TString(_string.c_str()); }
3333
const char* getVal() const { clearValueDirty(); return _string.c_str(); }
3434
void setVal(const char* newVal) { _string = newVal ? newVal : ""; setValueDirty(); }
35-
virtual RooAbsArg& operator=(const char* newVal) { setVal(newVal); return *this; }
35+
RooAbsArg& operator=(const char* newVal) { setVal(newVal); return *this; }
3636

3737
// We implement a fundamental type of AbsArg that can be stored in a dataset
3838
bool isFundamental() const override { return true; }
@@ -62,7 +62,7 @@ class RooStringVar final : public RooAbsArg {
6262
protected:
6363
// Internal consistency checking (needed by RooDataSet)
6464
bool isValid() const override { return true; }
65-
virtual bool isValidString(const char*, bool /*printError=false*/) const { return true; }
65+
bool isValidString(const char*, bool /*printError=false*/) const { return true; }
6666

6767
void syncCache(const RooArgSet* /*nset*/ = nullptr) override { }
6868
void copyCache(const RooAbsArg* source, bool valueOnly=false, bool setValDiry=true) override;

tree/ntuple/test/ntuple_parallel_writer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ TEST(RNTupleParallelWriter, RawPtrWriteEntry)
9393
// Create two RNTupleFillContext to prepare clusters in parallel.
9494
auto c1 = writer->CreateFillContext();
9595
auto e1 = c1->CreateRawPtrWriteEntry();
96-
float pt1;
96+
float pt1 = 0.f;
9797
e1->BindRawPtr("pt", &pt1);
9898

9999
auto c2 = writer->CreateFillContext();
100100
auto e2 = c2->CreateRawPtrWriteEntry();
101-
float pt2;
101+
float pt2 = 0.f;
102102
e2->BindRawPtr("pt", &pt2);
103103

104104
// Fill one entry per context and commit a cluster each.

0 commit comments

Comments
 (0)