-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix: Suppress -Wshadow warnings in headers on macOS (Fixes #20790) #20793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 40 commits
34a0eee
d6666b8
aefdf3f
4698a8c
b412441
691cdf1
4442723
696a0d1
c498219
7d9de29
69b37d7
b1debb2
35b15a4
c6d8bf3
18dd104
6fe8064
e24d74e
5075119
3c355c2
bad85c0
f56079d
3f3d0c9
eac1c2b
761e5cb
9da9c3d
424b7b6
0e3588e
32f720e
de93436
1c0fea7
de39f84
dc749f6
d8ca856
c743796
2271329
f553e4a
5031a21
206ad50
dad1300
cbdd1d8
7756fce
1aaf392
6a60d7d
16c795e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
are you using an AI chatbot to answer all queries?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,7 +263,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), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,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 }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,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 }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,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 }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,19 @@ class TBranchIMTHelper; ///< A helper class for managing IMT work during TTree:F | |
| const Int_t kDoNotProcess = BIT(10); // Active bit for branches | ||
| const Int_t kIsClone = BIT(11); // to indicate a TBranchClones | ||
| const Int_t kBranchObject = BIT(12); // branch is a TObject* | ||
| #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 | ||
| const Int_t kBranchAny = BIT(17); // branch is an object* | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a mention of what this clashes with.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This constant clashes with similar definitions in macOS system-level SDK headers for object handling. I will add a note identifying this clash. |
||
| #if defined(__clang__) | ||
| #pragma clang diagnostic pop | ||
| #elif defined(__GNUC__) | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
| const Int_t kMapObject = kBranchObject | kBranchAny; | ||
|
|
||
| namespace ROOT { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.