-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Fix build error with gcc in swift demangling code #75682
Conversation
Fixes: third_party/swift/include/swift/Demangling/Demangler.h:228:11: error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’ changes meaning of ‘Slab’ [-fpermissive] 228 | Slab *Slab; | ^~~~ third_party/swift/include/swift/Demangling/Demangler.h:47:10: note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’ 47 | struct Slab { | ^~~~ No intended behavior change.
Fixes: third_party/swift/include/swift/Demangling/Demangler.h:228:11: error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’ changes meaning of ‘Slab’ [-fpermissive] 228 | Slab *Slab; | ^~~~ third_party/swift/include/swift/Demangling/Demangler.h:47:10: note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’ 47 | struct Slab { | ^~~~ Cherry-picks swiftlang/swift#75682
Fixes: third_party/swift/include/swift/Demangling/Demangler.h:228:11: error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’ changes meaning of ‘Slab’ [-fpermissive] 228 | Slab *Slab; | ^~~~ third_party/swift/include/swift/Demangling/Demangler.h:47:10: note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’ 47 | struct Slab { | ^~~~ Cherry-picks swiftlang/swift#75682
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm not sure if I understand your suggest. Do you mean changing Could someone with commit permissions ask swift-ci to CI this? |
Sure, we can test the public side at the very least. |
@swift-ci please test |
Yes, it changes the meaning, but I think it does silence the GCC |
Huh, surprising. I confirmed that that also works. Thanks for mentioning it! The spec says "A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S.", and I suppose the name isn't used that way. alternative diffdiff --git a/third_party/swift/include/swift/Demangling/Demangler.h b/third_party/swift/include/swift/Demangling/Demangler.h
index 70646c3..424319c 100644
--- a/third_party/swift/include/swift/Demangling/Demangler.h
+++ b/third_party/swift/include/swift/Demangling/Demangler.h
@@ -225,7 +225,7 @@ public:
/// A checkpoint which captures the allocator's state at any given time. A
/// checkpoint can be popped to free all allocations made since it was made.
struct Checkpoint {
- Slab *Slab;
+ NodeFactory::Slab *Slab;
char *CurPtr;
char *End;
}; Let me know which one you prefer :) The patch as-is seems a bit clearer to me, but I'm happy either way. |
Fixes: third_party/swift/include/swift/Demangling/Demangler.h:228:11: error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’ changes meaning of ‘Slab’ [-fpermissive] 228 | Slab *Slab; | ^~~~ third_party/swift/include/swift/Demangling/Demangler.h:47:10: note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’ 47 | struct Slab { | ^~~~ Cherry-picks swiftlang/swift#75682
I think that I slightly prefer the alternative diff so that we can easily get this in. The renaming is obviously going to prevent the issue from cropping up, but would require more checks to ensure that no one is depending on the old name in a code base we cannot see. |
|
Ah, good point! Let's stick with the explicit name change to prevent the issue in the future. |
CC @mikeash, is this exposed in such a way that changing the type name here will break ABI somehow? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, asked Mike. None of this should be ABI.
If it builds and passes its tests, LGTM.
That said, this isn't ABI, so at your project level, depending on these functions to be stable is risky business and is really technically only going to work correctly on the runtime that matches it. We don't really guarantee the stability of the C++ bits so |
Fixes: third_party/swift/include/swift/Demangling/Demangler.h:228:11: error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’ changes meaning of ‘Slab’ [-fpermissive] 228 | Slab *Slab; | ^~~~ third_party/swift/include/swift/Demangling/Demangler.h:47:10: note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’ 47 | struct Slab { | ^~~~ Cherry-picks swiftlang/swift#75682
CI is done. Can someone hit the merge button, please? |
Fixes:
No intended behavior change.