This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new d42c143 Fix some gcc warnings
d42c143 is described below
commit d42c1439390bbf99a74e8ec046539bbd730e146c
Author: Todd Lipcon <[email protected]>
AuthorDate: Tue Mar 24 20:29:41 2020 -0700
Fix some gcc warnings
This addresses an unsupported loop unrolling pragma for GCC. It also
fixes another warning I found when compiling using devtoolset-9 (gcc 9).
Change-Id: I881d7cd078b79eabec40c85f8ec665483bd05b7c
Reviewed-on: http://gerrit.cloudera.org:8080/15553
Reviewed-by: Adar Dembo <[email protected]>
Tested-by: Adar Dembo <[email protected]>
---
src/kudu/util/bitmap.h | 6 +++++-
src/kudu/util/coding.cc | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/kudu/util/bitmap.h b/src/kudu/util/bitmap.h
index 0c67970..5a937c0 100644
--- a/src/kudu/util/bitmap.h
+++ b/src/kudu/util/bitmap.h
@@ -215,8 +215,12 @@ inline void ForEachBit(const uint8_t* bitmap,
// The 'tzcnt' instruction that's generated here has a latency of 3 so
unrolling
// and avoiding any cross-iteration dependencies is beneficial.
int tot_count = Bits::CountOnes64withPopcount(w);
+#ifdef __clang__
#pragma unroll(3)
- while (tot_count--) {
+#else
+#pragma GCC unroll 3
+#endif
+ for (int i = 0; i < tot_count; i++) {
func(base_idx + Bits::FindLSBSetNonZero64(w));
w &= w - 1;
}
diff --git a/src/kudu/util/coding.cc b/src/kudu/util/coding.cc
index 952af28..2449612 100644
--- a/src/kudu/util/coding.cc
+++ b/src/kudu/util/coding.cc
@@ -33,7 +33,9 @@ void PutFixed64(faststring *dst, uint64_t value) {
}
void PutVarint64(faststring *dst, uint64_t v) {
- uint8_t buf[10];
+ // NOTE: buf only needs 10 bytes, but gcc issues some warnings that seem
+ // hard to suppress, since it can't infer the bound on the length.
+ uint8_t buf[16];
uint8_t* ptr = EncodeVarint64(buf, v);
dst->append(buf, ptr - buf);
}