-
Notifications
You must be signed in to change notification settings - Fork 110
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
cpplint: allow using-directive for user-defined literals namespaces #67
Conversation
Thanks, we'll see if we end up needing this or not. I removed the "Connects to" because this will not be needed for the other pr's since you added the nolint lines. |
Greetings! Thanks for this PR. Due to this gcc warning bug, we don't see any other way to allow use of the C++14 literals while also using cpplint. So we made this check somewhat more specific by ensuring the |
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.
The patch seems to change the access permissions of the file which is probably undesired.
For completeness I will repeat the comment we received from upstream about considering to propose this change to them:
|
Anyone following this should also read the follow up comment specifically about |
OK. Well, this leaves our transition to standard C++14 literals then kind of stuck at the moment, due to conflicting ideals:
item 1 happens because we're trying not to diverge (too far) from the Google style guide item 2 happens because, at least to my knowledge, there is no way to use the C++14 |
@dirk-thomas thanks for pointing that out. The file permission change is now reverted. |
if match: | ||
matched = match.group(1) | ||
match_contains_std_literals = \ | ||
matched.startswith('std::') and matched.endswith('literals') |
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.
If restricting to the STL is decided, then the comments should also be updated.
Thanks @Sarcasm for pointing out the inconsistency in the code and comment. The comment is updated now. |
Hello @codebot, TBH, I'm glad GCC has this warning bug because I don't consider the use of the using declaration elegant (personal taste). Regarding restricting the match to I haven't given extensive thoughts on the subject but I'm wondering if the Regarding the flexibility of the linting tool. |
Thanks @Sarcasm for the feedback. We just altered this so that it uses a whitelist that will be easier to change in the future if/when new STL or Boost other "standard-ish" libraries emerge that are well-behaved and convenient to use in this fashion. We also added |
👍 |
'std::literals::chrono_literals', | ||
'std::literals::complex_literals', | ||
'std::literals::string_literals', | ||
'std::placeholders', |
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.
Maybe order the list?
As much as I hate to have patches to cpplint in our project, I think this pr represents the most pragmatic compromise between using new features in the standard as they were intended versus avoiding the abuse of the @dirk-thomas didn't we have a place to keep track of the changes we have on top of cpplint? I saw the url at the top of the file to the originating commit on the cpplint repository, but not an abbreviated list of changes or anything. |
I don't think such a list exists anywhere beside the commit log (https://github.com/ament/ament_lint/commits/master/ament_cpplint/ament_cpplint/cpplint.py). All customizations are can be found in the commit after the last import from upstream (2324287#diff-b5c57d8cc3ce83e990089f94f5ab6e15). |
This will permit the use of std::chrono and other useful new literals in C++14, which are most conveniently brought in via "using namespace"
This will permit the use of std::chrono and other useful new literals in C++14, which are most conveniently brought in via "using namespace"
As proposed here:
Related to ros2/rclcpp#284.