-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix build warning, ByteSize() is deprecated, use ByteSizeLong() instead #1723
Conversation
build was failed due to |
LGTM |
// use template to avoid include `google/protobuf/message.h` | ||
template<typename T> | ||
inline uint32_t GetProtobufByteSize(const T& message) { | ||
#if GOOGLE_PROTOBUF_VERSION >= 3010000 |
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.
在不包含 protobuf 相关头文件的情况下, 直接用 GOOGLE_PROTOBUF_VERSION
有问题吧? 虽然不影响编译, 但结果恐怕不符合预期, 除非源文件中先包含 protobuf 相关头文件再包含此头文件.
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.
目前看好像确实都是先包含的 protobuf 相关头文件.
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.
#include "brpc/options.pb.h"
这个应该包含了那个宏
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.
protoc 生成的文件也会定义,把这个文件看漏了…
Fix build warning, protobuf ByteSize() is deprecated, use ByteSizeLong() instead