This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit 863262dad7ee2719a6699d564a249dfea7480032
Author: cyy <cyye...@outlook.com>
AuthorDate: Sun Jan 6 10:40:58 2019 +0800

    add static_assert message
---
 lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc  | 8 ++++----
 lib/cpp/src/thrift/protocol/TCompactProtocol.tcc | 8 ++++----
 lib/cpp/src/thrift/protocol/TProtocol.h          | 2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc 
b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
index 902ef98..fe73992 100644
--- a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
@@ -165,8 +165,8 @@ uint32_t TBinaryProtocolT<Transport_, 
ByteOrder_>::writeI64(const int64_t i64) {
 
 template <class Transport_, class ByteOrder_>
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeDouble(const double 
dub) {
-  static_assert(sizeof(double) == sizeof(uint64_t));
-  static_assert(std::numeric_limits<double>::is_iec559);
+  static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == 
sizeof(uint64_t)");
+  static_assert(std::numeric_limits<double>::is_iec559, 
"std::numeric_limits<double>::is_iec559");
 
   uint64_t bits = bitwise_cast<uint64_t>(dub);
   bits = ByteOrder_::toWire64(bits);
@@ -388,8 +388,8 @@ uint32_t TBinaryProtocolT<Transport_, 
ByteOrder_>::readI64(int64_t& i64) {
 
 template <class Transport_, class ByteOrder_>
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::readDouble(double& dub) {
-  static_assert(sizeof(double) == sizeof(uint64_t));
-  static_assert(std::numeric_limits<double>::is_iec559);
+  static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == 
sizeof(uint64_t)");
+  static_assert(std::numeric_limits<double>::is_iec559, 
"std::numeric_limits<double>::is_iec559");
 
   union bytes {
     uint8_t b[8];
diff --git a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc 
b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
index 2b8207a..8efec6e 100644
--- a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
@@ -253,8 +253,8 @@ uint32_t TCompactProtocolT<Transport_>::writeI64(const 
int64_t i64) {
  */
 template <class Transport_>
 uint32_t TCompactProtocolT<Transport_>::writeDouble(const double dub) {
-  static_assert(sizeof(double) == sizeof(uint64_t));
-  static_assert(std::numeric_limits<double>::is_iec559);
+  static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == 
sizeof(uint64_t)");
+  static_assert(std::numeric_limits<double>::is_iec559, 
"std::numeric_limits<double>::is_iec559");
 
   uint64_t bits = bitwise_cast<uint64_t>(dub);
   bits = THRIFT_htolell(bits);
@@ -653,8 +653,8 @@ uint32_t TCompactProtocolT<Transport_>::readI64(int64_t& 
i64) {
  */
 template <class Transport_>
 uint32_t TCompactProtocolT<Transport_>::readDouble(double& dub) {
-  static_assert(sizeof(double) == sizeof(uint64_t));
-  static_assert(std::numeric_limits<double>::is_iec559);
+  static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == 
sizeof(uint64_t)");
+  static_assert(std::numeric_limits<double>::is_iec559, 
"std::numeric_limits<double>::is_iec559");
 
   union {
     uint64_t bits;
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h 
b/lib/cpp/src/thrift/protocol/TProtocol.h
index 746973d..bbc6816 100644
--- a/lib/cpp/src/thrift/protocol/TProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TProtocol.h
@@ -47,7 +47,7 @@
 // 
http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html
 template <typename To, typename From>
 static inline To bitwise_cast(From from) {
-  static_assert(sizeof(From) == sizeof(To));
+  static_assert(sizeof(From) == sizeof(To), "sizeof(From) == sizeof(To)");
 
   // BAD!!!  These are all broken with -O2.
   //return *reinterpret_cast<To*>(&from);  // BAD!!!

Reply via email to