-
Notifications
You must be signed in to change notification settings - Fork 407
Remove global constructor for Traversal constants #2639
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
Remove global constructor for Traversal constants #2639
Conversation
jstone-lucasfilm
left a comment
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.
This looks good to me, thanks @ld-kerley, and I had just one minor note.
| MATERIALX_NAMESPACE_BEGIN | ||
|
|
||
| const Edge NULL_EDGE(nullptr, nullptr, nullptr); | ||
| const Edge& getNullEdge() { |
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.
Just adding a reminder to run clang-format on your new code, so that it inherits the Allman braces style of the project.
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 for the reminder - if only we were running clang-format in the CI... :) Then I wouldn't forget.
source/MaterialXCore/Element.cpp
Outdated
| ValueElement::UI_MIN_ATTRIBUTE, ValueElement::UI_MAX_ATTRIBUTE, | ||
| ValueElement::UI_SOFT_MIN_ATTRIBUTE, ValueElement::UI_SOFT_MAX_ATTRIBUTE, | ||
| ValueElement::UI_STEP_ATTRIBUTE | ||
| const StringSet uiAttributes = { |
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.
Not related to your PR, but does anyone know how to get clang-format to maintain Allman braces consistently in data initializers as well as functions?
The MaterialX code style expects Allman braces everywhere, but clang-format seems to treat data initializers as a special case.
|
This looks good to me, @ld-kerley, though I'd recommend reverting the style changes that don't relate to your work on Traversal constants, so that we're not interleaving functional and style changes in a single PR. I'm still curious as to whether |
|
Thats pretty frustrating... Being asked to run I think we really need to improve that aspect of the developer experience. It would save a lot of time if we could just decide on a |
e80c8f4 to
64758d7
Compare
|
I reverted the clang-format changes. |
jstone-lucasfilm
left a comment
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.
This looks good to me, thanks @ld-kerley!
In case it's helpful for future changes, clang-format can be applied to just the new code that you're adding to a codebase, as originally requested in this PR. That's the approach that I use when contributing code to a repository, so that I'm not accidentally changing unrelated lines of code that may simply need a refresh for a new version of Clang.
I like the idea of steering our codebase in the direction of full clang-format automation in the future, and one step in this direction will be to resolve the unusual interpretation of Allman braces for initializer lists in Clang.
I had a chance to look this up recently, and it could be that the Cpp11BracedListStyle option will bring clang-format closer to the universal interpretation of Allman braces that we expect in MaterialX.
|
Thanks for merging this - I'll likely have some more changes in this vein to help us manage future MaterialX upgrades internally. Full I was poking around the internet and couldn't find a formal definition of Allman braces written down anywhere. Is it perhaps possible that Either way, I really don't have any strong preference as to what formatting style is used, if it's enforced by the tools and I don't have to think about it. I would propose that its beneficial to the community to morph the MaterialX coding standards to meet |
When we ship MaterialX in apple ecosystem we maintain a number of patches to avoid global constructors and destructors on exit. (
-Wglobal-constructors -Wexit-time-destructor)This PR proposed one of these patches, if this is merged, I'll propose some others moving forwards. This will help us lower the burden of ongoing maintenance for MaterialX integration in the apple ecosystem.