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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new bd88309  [Refactor] fix warning in gcc8+, fix warning from brpc, s2 
(#5763)
bd88309 is described below

commit bd88309346e13fde9beae6cc6aaea4b62a0e8947
Author: stdpain <[email protected]>
AuthorDate: Wed May 12 10:38:46 2021 +0800

    [Refactor] fix warning in gcc8+, fix warning from brpc, s2 (#5763)
    
    Fix warning from brpc, S2
    Fix -Warray-bounds
---
 be/src/exprs/agg_fn_evaluator.cpp                 |  5 +++++
 be/src/runtime/decimal_value.h                    |  5 +++++
 be/src/util/coding.h                              | 10 +++-------
 be/src/util/types.h                               |  5 ++++-
 thirdparty/patches/incubator-brpc-0.9.7.patch     | 11 +++++++++++
 thirdparty/patches/s2geometry-0.9.0-warning.patch | 11 +++++++++++
 6 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/be/src/exprs/agg_fn_evaluator.cpp 
b/be/src/exprs/agg_fn_evaluator.cpp
index f91475c..67da8f3 100644
--- a/be/src/exprs/agg_fn_evaluator.cpp
+++ b/be/src/exprs/agg_fn_evaluator.cpp
@@ -14,6 +14,9 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#pragma GCC diagnostic ignored "-Wstringop-overflow="
 
 #include "exprs/agg_fn_evaluator.h"
 
@@ -981,3 +984,5 @@ std::string AggFnEvaluator::debug_string() const {
 }
 
 } // namespace doris
+
+#pragma GCC diagnostic pop
diff --git a/be/src/runtime/decimal_value.h b/be/src/runtime/decimal_value.h
index 6edca40..82404bc 100644
--- a/be/src/runtime/decimal_value.h
+++ b/be/src/runtime/decimal_value.h
@@ -316,6 +316,10 @@ public:
         return value;
     }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#pragma GCC diagnostic ignored "-Wstringop-overflow="
+
     static DecimalValue from_decimal_val(const doris_udf::DecimalVal& val) {
         DecimalValue result;
         result._int_length = val.int_len;
@@ -326,6 +330,7 @@ public:
         memcpy(result._buffer, val.buffer, sizeof(int32_t) * 
DECIMAL_BUFF_LENGTH);
         return result;
     }
+#pragma GCC diagnostic pop
 
     void to_decimal_val(doris_udf::DecimalVal* value) const {
         value->int_len = _int_length;
diff --git a/be/src/util/coding.h b/be/src/util/coding.h
index f7b7908..c47070d 100644
--- a/be/src/util/coding.h
+++ b/be/src/util/coding.h
@@ -168,19 +168,17 @@ inline const uint8_t* decode_varint32_ptr(const uint8_t* 
ptr, const uint8_t* lim
 }
 
 extern const uint8_t* decode_varint64_ptr(const uint8_t* p, const uint8_t* 
limit, uint64_t* value);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
 
 template <typename T>
 inline void put_varint32(T* dst, uint32_t v) {
-    uint8_t buf[5];
+    uint8_t buf[16];
     uint8_t* ptr = encode_varint32(buf, v);
     dst->append((char*)buf, static_cast<size_t>(ptr - buf));
 }
 
 template <typename T>
 inline void put_varint64(T* dst, uint64_t v) {
-    uint8_t buf[10];
+    uint8_t buf[16];
     uint8_t* ptr = encode_varint64(buf, v);
     dst->append((char*)buf, static_cast<size_t>(ptr - buf));
 }
@@ -193,14 +191,12 @@ inline void put_length_prefixed_slice(T* dst, const 
Slice& value) {
 
 template <typename T>
 inline void put_varint64_varint32(T* dst, uint64_t v1, uint32_t v2) {
-    uint8_t buf[15];
+    uint8_t buf[16];
     uint8_t* ptr = encode_varint64(buf, v1);
     ptr = encode_varint32(ptr, v2);
     dst->append((char*)buf, static_cast<size_t>(ptr - buf));
 }
 
-#pragma GCC diagnostic pop
-
 // parse a varint32 from the start of `input` into `val`.
 // on success, return true and advance `input` past the parsed value.
 // on failure, return false and `input` is not modified.
diff --git a/be/src/util/types.h b/be/src/util/types.h
index ee1ae2d..77410d0 100644
--- a/be/src/util/types.h
+++ b/be/src/util/types.h
@@ -25,7 +25,8 @@ struct PackedInt128 {
     PackedInt128() : value(0) {}
 
     PackedInt128(const __int128& value_) { value = value_; }
-
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
     PackedInt128& operator=(const __int128& value_) {
         value = value_;
         return *this;
@@ -34,6 +35,8 @@ struct PackedInt128 {
         value = rhs.value;
         return *this;
     }
+#pragma GCC diagnostic pop
+
     __int128 value;
 } __attribute__((packed));
 
diff --git a/thirdparty/patches/incubator-brpc-0.9.7.patch 
b/thirdparty/patches/incubator-brpc-0.9.7.patch
new file mode 100644
index 0000000..57e7c4f
--- /dev/null
+++ b/thirdparty/patches/incubator-brpc-0.9.7.patch
@@ -0,0 +1,11 @@
+--- src/bvar/detail/series.h
++++ src/bvar/detail/series.h
+@@ -128,7 +128,7 @@ private:
+             // is_pod does not work for gcc 3.4
+             if (butil::is_integral<T>::value ||
+                 butil::is_floating_point<T>::value) {
+-                memset(_array, 0, sizeof(_array));
++                memset(static_cast<void*>(_array), 0, sizeof(_array));
+             }
+         }
+         
diff --git a/thirdparty/patches/s2geometry-0.9.0-warning.patch 
b/thirdparty/patches/s2geometry-0.9.0-warning.patch
new file mode 100644
index 0000000..c28186b
--- /dev/null
+++ b/thirdparty/patches/s2geometry-0.9.0-warning.patch
@@ -0,0 +1,11 @@
+--- src/s2/util/coding/coder.h
++++ src/s2/util/coding/coder.h
+@@ -155,7 +155,7 @@ class Encoder {
+ class Decoder {
+  public:
+   // Empty constructor to create uninitialized decoder
+-  inline Decoder() { }
++  inline Decoder() = default;
+ 
+   // NOTE: for efficiency reasons, this is not virtual.  so don't add
+   // any members that really need to be destructed, and be careful about

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to