-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Use enum class for TLVElementType and TLVTagControl. #3157
Use enum class for TLVElementType and TLVTagControl. #3157
Conversation
@@ -105,41 +105,41 @@ | |||
/* | |||
* @brief Specifies an anonymous TLV element, which doesn't have any tag | |||
*/ | |||
#define CHIP_TLV_TAG_ANONYMOUS chip::TLV::kTLVTagControl_Anonymous | |||
#define CHIP_TLV_TAG_ANONYMOUS chip::TLV::TLVTagControl::Anonymous |
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 departs from C++ towards Haskell :-)
@@ -58,6 +58,16 @@ class PacketBuffer; | |||
namespace chip { | |||
namespace TLV { | |||
|
|||
inline uint8_t operator|(TLVElementType lhs, TLVTagControl rhs) |
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.
Style nit: but strongly prefer white space around operator
the operation |
to improve readability.
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.
can we make .clang-format do that? if not, we're gonna have trouble enforcing
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.
Agreed. I can't seem to find anything in the clang-format documentation that indicates control over this specific behavior.
This makes it easy to give them as specific size spec, which will prevent issues with people adding out-of-range values and simplify -Wconversion work.
Some devices are configured to act as Thread router instead of sleepy-end device. This PR removes these incorrect or verbose comments.
…ject-chip#3175) * [nRF Connect] README updates on Docker for MacOS and NCS version * Restyled by prettier-markdown * Rephrase a sentence Co-authored-by: Restyled.io <commits@restyled.io>
…ude server init callbacks. (project-chip#3180) This allows the app to implement emberAfPluginOnOffClusterServerPostInitCallback to sync up the data model state with the state of the actual device when the data model initializes.
* Add a lot of pragma once changes. Now scripted! * update pragma once in setup payload * More pragma once * Pragma once within platform and more * pragma once in the crypto layer * pragma once in examples * Fix by restyle-diff
70e5c75
to
660a4df
Compare
Size increase report for "esp32-example-build"
Full report output
|
Size increase report for "nrfconnect-example-build"
Full report output
|
This makes it easy to give them as specific size spec, which will
prevent issues with people adding out-of-range values and simplify
-Wconversion work.
Problem
TLVElementType and TLVTagControl are raw enums, not enum classes, so proving that casts to 8-bit ints are safe is not trivial.
Summary of Changes
Make them 8-bit-backed enum classes, so the compiler will enforce things for us.