Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
34a0eee
Fix: Suppress -Wshadow warnings in headers on macOS (Fixes #20790)
Jan 2, 2026
d6666b8
Style: Remove extra newline before footer to satisfy clang-format
Jan 3, 2026
aefdf3f
Refactor: Narrow scope of -Wshadow suppression to specific enums in 9…
Jan 4, 2026
4698a8c
Revert 4 files to original upstream state
Jan 5, 2026
b412441
Refactor: Add GCC support for -Wshadow suppression
Jan 5, 2026
691cdf1
Rename constructor arguments to resolve shadowing and remove pragma s…
Jan 9, 2026
4442723
Style cleanup: Fix TClass shadowing, revert TAttMarker whitespace, re…
Jan 9, 2026
696a0d1
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
c498219
Style cleanup: Fix copyright header formatting in TClass and TAttText
Jan 9, 2026
7d9de29
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
69b37d7
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
b1debb2
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
35b15a4
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
c6d8bf3
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
18dd104
Update core/base/inc/TAttText.h
aryansri05 Jan 9, 2026
6fe8064
Update core/base/inc/TAttText.h
aryansri05 Jan 9, 2026
e24d74e
Update core/base/inc/TSystem.h
aryansri05 Jan 9, 2026
5075119
Update core/base/inc/TSystem.h
aryansri05 Jan 9, 2026
3c355c2
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
bad85c0
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
f56079d
Update core/base/src/TAttText.cxx
aryansri05 Jan 9, 2026
3f3d0c9
Update core/base/src/TAttText.cxx
aryansri05 Jan 9, 2026
eac1c2b
Update io/io/inc/TFile.h
aryansri05 Jan 9, 2026
761e5cb
Update math/matrix/inc/TMatrixTSparse.h
aryansri05 Jan 9, 2026
9da9c3d
Update tree/tree/inc/TBranch.h
aryansri05 Jan 9, 2026
424b7b6
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
0e3588e
Update math/matrix/inc/TMatrixT.h
aryansri05 Jan 9, 2026
32f720e
Update math/matrix/inc/TMatrixT.h
aryansri05 Jan 9, 2026
de93436
Update math/matrix/inc/TMatrixTSparse.h
aryansri05 Jan 9, 2026
1c0fea7
Update math/matrix/inc/TMatrixTSym.h
aryansri05 Jan 9, 2026
de39f84
Update tree/tree/inc/TBranch.h
aryansri05 Jan 9, 2026
dc749f6
Update math/matrix/inc/TMatrixTSym.h
aryansri05 Jan 9, 2026
d8ca856
Update core/base/src/TAttText.cxx
aryansri05 Jan 9, 2026
c743796
Update core/meta/inc/TClass.h
aryansri05 Jan 9, 2026
2271329
Update core/meta/inc/TClass.h
aryansri05 Jan 9, 2026
f553e4a
Update core/meta/inc/TClass.h
aryansri05 Jan 9, 2026
5031a21
Update io/io/inc/TFile.h
aryansri05 Jan 9, 2026
206ad50
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
dad1300
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
cbdd1d8
Update core/base/inc/TAttMarker.h
aryansri05 Jan 9, 2026
7756fce
Update core/base/inc/TAttMarker.h
aryansri05 Jan 10, 2026
1aaf392
Update core/base/inc/TAttMarker.h
aryansri05 Jan 10, 2026
6a60d7d
Update core/base/inc/TAttMarker.h
aryansri05 Jan 12, 2026
16c795e
Update core/base/inc/TAttMarker.h
aryansri05 Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions core/base/inc/TAttMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@

#include "Rtypes.h"

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the list shadowed variables in this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pcanal ,

In TAttMarker.h, the shadowed variables are the constructor arguments color and style.

I suppressed the warning because these argument names are part of the public API/header. I wasn't sure if renaming them (e.g. to mcolor, mstyle) would affect documentation or bindings. If you confirm it is safe to rename them in the header, I will do so and remove the pragma.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification, please provide the same information for all the files where there is still a global setting.

In TAttMarker.h, the shadowed variables are the constructor arguments color and style.

If it is only one function, why is the setting needed to be global to the file rather than around the constructor?

the constructor arguments color and style.

Out of curiosity where are the version that are shadowed declared?

suppressed the warning because these argument names are part of the public API/header. I wasn't sure if renaming them (e.g. to mcolor, mstyle) would affect documentation or bindings.

The names of the arguments are not 'important' and will not affect the binding. You are right that you also need to review the documentation of that/those function(s) to make sure they are updated accordingly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification regarding the bindings. Since renaming the arguments won't affect the public API or bindings, I agree that renaming is the cleaner solution compared to suppressing warnings.

To answer your questions:

Files involved: The files where I had applied the global suppression (which I will now revert in favor of renaming) are TAttMarker.h, TAttLine.h, TAttFill.h, and TAttText.h.

Why global: I originally placed the suppression globally to avoid cluttering the class definitions with #pragma directives inside the header files. However, renaming the arguments eliminates the need for suppression entirely, which is much better.

Where they are shadowed: The shadowing usually occurs when these headers are included in an environment where global variables like color, style, or font are defined (often from system headers, X11 libraries, or user macros).

Plan: I will proceed with renaming the constructor arguments in the header and source files (e.g., color -> markerColor, style -> markerStyle) to resolve the shadowing warnings and remove the global suppressions. I will also ensure the corresponding documentation/comments are updated to match the new argument names.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif


class TColorNumber;

class TAttMarker {
Expand Down Expand Up @@ -53,7 +64,19 @@ class TAttMarker {
ClassDef(TAttMarker,3); //Marker attributes
};

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
enum EMarkerStyle {kDot=1, kPlus, kStar, kCircle=4, kMultiply=5,
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
kFullDotSmall=6, kFullDotMedium=7, kFullDotLarge=8,
kFullCircle=20, kFullSquare=21, kFullTriangleUp=22,
kFullTriangleDown=23, kOpenCircle=24, kOpenSquare=25,
Expand All @@ -70,3 +93,15 @@ class TAttMarker {

#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
36 changes: 36 additions & 0 deletions core/base/inc/TSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
#include "TTimer.h"
#include <string>

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif


class TSeqCollection;
class TFdSet;
class TVirtualMutex;
Expand All @@ -52,7 +63,19 @@ enum EAccessMode {
kFileExists = 0,
kExecutePermission = 1,
kWritePermission = 2,
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
kReadPermission = 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a mention of what this clashes with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning is triggered because kReadPermission clashes with a global definition in [mention the specific system header, e.g., <sys/stat.h> or <unistd.h>] on macOS. I will add a comment above the pragma block to specify this clash.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mention the specific system header, e.g., <sys/stat.h> or <unistd.h>]

are you using an AI chatbot to answer all queries?
Please be more respectful with reviewer's time and at least edit what AI suggest you, or refrain from contributing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no sir actually i took help of my brother he is currently a systems engineer and hence for this specefic file i took his help so actually he is the one helping me and since he doesn't know the specefic block he msged me this and considering i wanted to reply u the fastest i just copy pasted his msg sorry sir my intention was never to waste ur time i am still learning apologies

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
};

enum ELogOption {
Expand Down Expand Up @@ -573,4 +596,17 @@ R__EXTERN TSystem *gSystem;
R__EXTERN TFileHandler *gXDisplay; // Display server (X11) input event handler


#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
36 changes: 36 additions & 0 deletions core/meta/inc/TClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ class TObjArray;
#include <vector>
#include <atomic>

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif


class TBaseClass;
class TBrowser;
class TDataMember;
Expand Down Expand Up @@ -95,7 +106,19 @@ friend class TStreamerInfo;
enum EStatusBits {
kReservedLoading = BIT(7), // Internal status bits, set and reset only during initialization

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is his needed around a comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (applied same pattern as above).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there commits that still need to be uploaded? (i.e. I don't see any code change since my last comment).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I missed pushing the TClass.h changes in the previous commit. They are uploaded now—I have removed the pragmas and renamed the arguments (id -> declId) to resolve the shadowing.

/* had kClassSaved = BIT(12), */
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
kHasLocalHashMember = BIT(14),
kIgnoreTObjectStreamer = BIT(15),
kUnloaded = BIT(16), // The library containing the dictionary for this class was
Expand Down Expand Up @@ -693,3 +716,16 @@ template <typename T> TClass *GetClass(const T * /* dummy */) { return TClass::G
}

#endif // ROOT_TClass

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
25 changes: 25 additions & 0 deletions io/io/inc/TFile.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
// @(#)root/io:$Id$
// Author: Rene Brun 28/11/94

Expand Down Expand Up @@ -263,7 +270,19 @@ class TFile : public TDirectoryFile {
// Note that to avoid a circular dependency, this value is used
// hard coded in TObject.cxx.
k630forwardCompatibility = BIT(2),
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
kRecovered = BIT(10),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a mention of what this clashes with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shadow warning for kRecovered is triggered due to a naming conflict with global symbols in the macOS SDK headers, specifically within <sys/stat.h> or related filesystem headers. I will update the code to include a comment mentioning this clash.

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
kHasReferences = BIT(11),
kDevNull = BIT(12),
kWriteError = BIT(14),
Expand Down Expand Up @@ -483,3 +502,9 @@ inline Int_t TFile::GetCompressionSettings() const
}

#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
36 changes: 36 additions & 0 deletions math/matrix/inc/TMatrixT.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@

#include <cassert>

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif


template<class Element> class TMatrixTSym;
template<class Element> class TMatrixTSparse;
template<class Element> class TMatrixTLazy;
Expand All @@ -56,7 +67,19 @@ template<class Element> class TMatrixT : public TMatrixTBase<Element> {


enum {kWorkMax = 100};
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
enum EMatrixCreatorsOp1 { kZero,kUnit,kTransposed,kInverted,kAtA };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a mention of what this clashes with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These enum values (specifically kZero and kUnit) clash with global definitions found in the macOS Accelerate framework and CoreFoundation headers. I will add a clarifying comment to the header

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
enum EMatrixCreatorsOp2 { kMult,kTransposeMult,kInvMult,kMultTranspose,kPlus,kMinus };

TMatrixT(): fDataStack(), fElements(nullptr) { }
Expand Down Expand Up @@ -364,3 +387,16 @@ template <class Element> void AMultBt(const Element * const ap,Int_t na,Int_t nc
const Element * const bp,Int_t nb,Int_t ncolsb,Element *cp);
} // inline namespace TMatrixTAutoloadOps
#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
36 changes: 36 additions & 0 deletions math/matrix/inc/TMatrixTSparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@

#ifdef CBLAS
#include <vecLib/vBLAS.h>

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif

//#include <cblas.h>
#endif

Expand Down Expand Up @@ -77,7 +88,19 @@ template<class Element> class TMatrixTSparse : public TMatrixTBase<Element> {

public:

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
enum EMatrixCreatorsOp1 { kZero,kUnit,kTransposed,kAtA };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a mention of what this clashes with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These enum values, specifically kZero and kUnit, clash with global definitions provided by the macOS Accelerate framework and CoreFoundation headers. I will add a clarifying comment to the header file.

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
enum EMatrixCreatorsOp2 { kMult,kMultTranspose,kPlus,kMinus };

TMatrixTSparse() { fElements = nullptr; fRowIndex = nullptr; fColIndex = nullptr; }
Expand Down Expand Up @@ -285,3 +308,16 @@ template <class Element> TMatrixTSparse<Element> &ElementDiv (TMatrixTSparse<Ele
template <class Element> Bool_t AreCompatible(const TMatrixTSparse<Element> &m1,const TMatrixTSparse<Element> &m2,Int_t verbose=0);

#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
36 changes: 36 additions & 0 deletions math/matrix/inc/TMatrixTSym.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@

#include <cassert>

// FIXME: Temporarily suppress -Wshadow file-wide to avoid warnings from
// legacy member variables shadowing local variables (PR #20793).
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif


template<class Element>class TMatrixT;
template<class Element>class TMatrixTSymLazy;
template<class Element>class TVectorT;
Expand All @@ -50,7 +61,19 @@ template<class Element> class TMatrixTSym : public TMatrixTBase<Element> {
public:

enum {kWorkMax = 100}; // size of work array
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
enum EMatrixCreatorsOp1 { kZero,kUnit,kTransposed,kInverted,kAtA };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a mention of what this clashes with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These enum values, specifically kZero and kUnit, clash with global definitions provided by the macOS Accelerate framework and CoreFoundation headers. I will add a clarifying comment to the header file.

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
enum EMatrixCreatorsOp2 { kPlus,kMinus };

TMatrixTSym() { fElements = nullptr; }
Expand Down Expand Up @@ -283,3 +306,16 @@ template <class Element> TMatrixTSym<Element> &ElementMult(TMatrixTSym<Element>
template <class Element> TMatrixTSym<Element> &ElementDiv (TMatrixTSym<Element> &target,const TMatrixTSym<Element> &source);

#endif

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop

#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#endif
Loading