Skip to content
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

ci: enable check for static non-POD #5602

Merged
merged 6 commits into from
Jan 27, 2019

Conversation

lizan
Copy link
Member

@lizan lizan commented Jan 15, 2019

Signed-off-by: Lizan Zhou lizan@tetrate.io

Description:
Check global static non-POD in clang-tidy to avoid static initialization fiasco.
https://clang.llvm.org/extra/clang-tidy/checks/fuchsia-statically-constructed-objects.html

Risk Level: Low
Testing:
Docs Changes:
Release Notes:

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@lizan lizan requested a review from htuch January 15, 2019 02:21
htuch
htuch previously approved these changes Jan 15, 2019
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Yes! Thanks!

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Having to NOLINT all of the factories is pretty annoying. Is there any way around this?

TBH I'm kind of blah on this, and I think our adherence to the static init fiasco rule is a bit draconian. Meaning, if something breaks, we can fix it, but I'm not sure we have to take it so seriously (I guess that's just me).

@lizan
Copy link
Member Author

lizan commented Jan 15, 2019

Having to NOLINT all of the factories is pretty annoying. Is there any way around this?

If we make the registration as macro, we might be able to put NOLINT in the macro. I'll give it a try.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@@ -45,7 +45,7 @@ template <const char* name_param> class RegistrationImpl : public Registration {
*/
#define SINGLETON_MANAGER_REGISTRATION(NAME) \
static constexpr char NAME##_singleton_name[] = #NAME "_singleton"; \
static Envoy::Registry::RegisterFactory< \
static Envoy::Registry::RegisterFactory< /* NOLINT(fuchsia-statically-constructed-objects) */ \
Copy link
Member Author

Choose a reason for hiding this comment

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

@mattklein123 we can do sth like this for extensions if we use macro to register, WDYT? cc @htuch

Copy link
Member

Choose a reason for hiding this comment

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

I guess? In general this strikes me as solving a problem that doesn't actually need solving, but I guess if we insist on not having any non-POD statics in the code base we have to do ithis?

Copy link
Member

Choose a reason for hiding this comment

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

I think let's switch to a macro here, we might find this useful in the future due to the increased freedom of implementation.

On the point of being too draconian, my main wish being fulfilled with this is to reduce review noise re: static init fiasco and to avoid having a human in the loop missing the bad static init fiasco cases. So, if we can do this without too much NOLINT noise I'm still in favor.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@stale
Copy link

stale bot commented Jan 23, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jan 23, 2019
@htuch
Copy link
Member

htuch commented Jan 23, 2019

@lizan where are we with this PR?

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jan 23, 2019
@lizan
Copy link
Member Author

lizan commented Jan 23, 2019

will update this shortly...

lizan added a commit that referenced this pull request Jan 25, 2019
*Description*:
From discussion in #5602.

*Risk Level*: Low
*Testing*: CI
*Docs Changes*:
*Release Notes*:

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@lizan
Copy link
Member Author

lizan commented Jan 25, 2019

@htuch PTAL, should be good to go.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Great, thanks.

@htuch htuch merged commit 3e5b286 into envoyproxy:master Jan 27, 2019
lizan added a commit that referenced this pull request Jan 27, 2019
This reverts commit 3e5b286.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
mattklein123 pushed a commit that referenced this pull request Jan 28, 2019
This reverts commit 3e5b286.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 31, 2019
*Description*:
From discussion in envoyproxy#5602.

*Risk Level*: Low
*Testing*: CI
*Docs Changes*:
*Release Notes*:

Signed-off-by: Lizan Zhou <lizan@tetrate.io>

Signed-off-by: Lizan Zhou <lizan.j@gmail.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 31, 2019
Check global static non-POD in clang-tidy to avoid static initialization fiasco.
https://clang.llvm.org/extra/clang-tidy/checks/fuchsia-statically-constructed-objects.html

Risk Level: Low

Signed-off-by: Lizan Zhou <lizan@tetrate.io>

Signed-off-by: Lizan Zhou <lizan.j@gmail.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 31, 2019
…proxy#5733)

This reverts commit 3e5b286.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>

Signed-off-by: Lizan Zhou <lizan.j@gmail.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
*Description*:
From discussion in envoyproxy#5602.

*Risk Level*: Low
*Testing*: CI
*Docs Changes*:
*Release Notes*:

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Fred Douglas <fredlas@google.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Check global static non-POD in clang-tidy to avoid static initialization fiasco.
https://clang.llvm.org/extra/clang-tidy/checks/fuchsia-statically-constructed-objects.html

Risk Level: Low

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Fred Douglas <fredlas@google.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
…proxy#5733)

This reverts commit 3e5b286.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Fred Douglas <fredlas@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants