-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat(common): adds begin/end inline namespace macros #7456
Conversation
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
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.
I do not think we have every used inline-ns
as a component before.
Consider feat(common)
. Or simply feat:
Done. |
google/cloud/version.h
Outdated
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN \ | ||
inline namespace GOOGLE_CLOUD_CPP_NS { | ||
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } |
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.
Q. Did you decide against putting the compatibility namespace alias(es) here?
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.
No, just will do those in a separate PR.
google/cloud/version.h
Outdated
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN \ | ||
inline namespace GOOGLE_CLOUD_CPP_NS { | ||
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } |
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.
Even though the comment is on the macro and not the substituted curly brace, a // namespace GOOGLE_CLOUD_CPP_NS
here might make things even clearer.
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.
Done
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.
Nit: If/when you add the compatibility aliases, this will have to change to /* ... */
. Maybe it makes sense to do that now?
* are versioned, i.e., the symbol becomes `google::cloud::vXYZ::Foo`. | ||
*/ | ||
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN \ | ||
inline namespace GOOGLE_CLOUD_CPP_NS { |
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.
Now that we've limited use of GOOGLE_CLOUD_CPP_NS
, perhaps it is time to slip INLINE
(or something) in there. At the moment it sounds like it refers to google::cloud
.
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.
We could do that separately. To avoid breaking users, we'd need to keep the old macro name around for a while at least.
Codecov Report
@@ Coverage Diff @@
## main #7456 +/- ##
==========================================
- Coverage 93.64% 93.64% -0.01%
==========================================
Files 1364 1364
Lines 118359 118359
==========================================
- Hits 110841 110838 -3
- Misses 7518 7521 +3
Continue to review full report at Codecov.
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
"GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN=inline namespace omit_this_inline_ns {" | ||
"GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END=}" |
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.
It looks like these would work as (and be better as) EXPAND_AS_DEFINED
names.
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.
I prefer to keep them as they are because this is only temporary and the actual change I want to make in about 2 PRs is to change them to be defined as empty string, which should be done like this.
google/cloud/version.h
Outdated
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN \ | ||
inline namespace GOOGLE_CLOUD_CPP_NS { | ||
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } |
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.
Nit: If/when you add the compatibility aliases, this will have to change to /* ... */
. Maybe it makes sense to do that now?
We can talk about that later when adding the compat alias. I'd probably lean toward just removing the comment since the macro name is clearly named and the comment doesn't end up in the expanded code anyway. |
Part of: #5976
Part of: #7453
This change is