arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-758: [C++] Build with /WX in Appveyor, fix MSVC compiler warnings
Date Fri, 07 Apr 2017 14:08:14 GMT
Repository: arrow
Updated Branches:
  refs/heads/master e53357cd6 -> 1c6609746


ARROW-758: [C++] Build with /WX in Appveyor, fix MSVC compiler warnings

This will help keep the build clean.

cc @MaxRis

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #502 from wesm/ARROW-758 and squashes the following commits:

054c185 [Wes McKinney] Build with /WX in Appveyor, fix MSVC compiler warnings


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/1c660974
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/1c660974
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/1c660974

Branch: refs/heads/master
Commit: 1c6609746aeb9584fc83284f2587fa97bdbac47a
Parents: e53357c
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Fri Apr 7 10:08:08 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Fri Apr 7 10:08:08 2017 -0400

----------------------------------------------------------------------
 appveyor.yml                          |  6 +-----
 cpp/cmake_modules/SetupCxxFlags.cmake |  4 ++++
 cpp/src/arrow/array-test.cc           | 14 +++++++-------
 cpp/src/arrow/builder.h               |  4 ++++
 cpp/src/arrow/io/file.cc              |  6 +++---
 cpp/src/arrow/io/io-hdfs-test.cc      |  2 +-
 cpp/src/arrow/ipc/json-internal.cc    |  2 +-
 cpp/src/arrow/ipc/test-common.h       |  2 +-
 cpp/src/arrow/tensor.cc               |  2 +-
 9 files changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 9f35949..b8c26e6 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -30,12 +30,8 @@ build_script:
  - cd cpp
  - mkdir build
  - cd build
- # A lot of features are still deactivated as they do not build on Windows
- #  * gbenchmark doesn't build with MSVC
- - cmake -G "%GENERATOR%" -DARROW_BOOST_USE_SHARED=OFF -DARROW_BUILD_BENCHMARKS=OFF -DARROW_JEMALLOC=OFF
-DCMAKE_BUILD_TYPE=Release ..
+ - cmake -G "%GENERATOR%" -DARROW_CXXFLAGS="/WX" -DARROW_BOOST_USE_SHARED=OFF -DCMAKE_BUILD_TYPE=Release
..
  - cmake --build . --config Release
 
 # test_script:
  - ctest -VV
-
-

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/cmake_modules/SetupCxxFlags.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index 09a662e..694e5a3 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -26,6 +26,10 @@ CHECK_CXX_COMPILER_FLAG("-maltivec" CXX_SUPPORTS_ALTIVEC)
 # compiler flags that are common across debug/release builds
 
 if (MSVC)
+  # TODO(wesm): Change usages of C runtime functions that MSVC says are
+  # insecure, like std::getenv
+  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+
   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     # clang-cl
     set(CXX_COMMON_FLAGS "-EHsc")

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/array-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc
index 68b9864..e50f4fd 100644
--- a/cpp/src/arrow/array-test.cc
+++ b/cpp/src/arrow/array-test.cc
@@ -124,10 +124,10 @@ TEST_F(TestArray, SliceRecomputeNullCount) {
 TEST_F(TestArray, TestIsNull) {
   // clang-format off
   vector<uint8_t> null_bitmap = {1, 0, 1, 1, 0, 1, 0, 0,
-                                      1, 0, 1, 1, 0, 1, 0, 0,
-                                      1, 0, 1, 1, 0, 1, 0, 0,
-                                      1, 0, 1, 1, 0, 1, 0, 0,
-                                      1, 0, 0, 1};
+                                 1, 0, 1, 1, 0, 1, 0, 0,
+                                 1, 0, 1, 1, 0, 1, 0, 0,
+                                 1, 0, 1, 1, 0, 1, 0, 0,
+                                 1, 0, 0, 1};
   // clang-format on
   int64_t null_count = 0;
   for (uint8_t x : null_bitmap) {
@@ -144,7 +144,7 @@ TEST_F(TestArray, TestIsNull) {
   ASSERT_TRUE(arr->null_bitmap()->Equals(*null_buf.get()));
 
   for (size_t i = 0; i < null_bitmap.size(); ++i) {
-    EXPECT_EQ(null_bitmap[i], !arr->IsNull(i)) << i;
+    EXPECT_EQ(null_bitmap[i] != 0, !arr->IsNull(i)) << i;
   }
 }
 
@@ -334,7 +334,7 @@ void TestPrimitiveBuilder<PBoolean>::Check(
   for (int64_t i = 0; i < result->length(); ++i) {
     if (nullable) { ASSERT_EQ(valid_bytes_[i] == 0, result->IsNull(i)) << i; }
     bool actual = BitUtil::GetBit(result->data()->data(), i);
-    ASSERT_EQ(static_cast<bool>(draws_[i]), actual) << i;
+    ASSERT_EQ(draws_[i] != 0, actual) << i;
   }
   ASSERT_TRUE(result->Equals(*expected));
 }
@@ -1379,7 +1379,7 @@ void ValidateBasicListArray(const ListArray* result, const vector<int32_t>&
valu
   }
 
   for (int i = 0; i < result->length(); ++i) {
-    ASSERT_EQ(!static_cast<bool>(is_valid[i]), result->IsNull(i));
+    ASSERT_EQ(is_valid[i] == 0, result->IsNull(i));
   }
 
   ASSERT_EQ(7, result->values()->length());

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/builder.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/builder.h b/cpp/src/arrow/builder.h
index 61207a3..60cdc4c 100644
--- a/cpp/src/arrow/builder.h
+++ b/cpp/src/arrow/builder.h
@@ -275,6 +275,10 @@ class ARROW_EXPORT BooleanBuilder : public ArrayBuilder {
     return Status::OK();
   }
 
+  Status Append(uint8_t val) {
+    return Append(val != 0);
+  }
+
   /// Vector append
   ///
   /// If passed, valid_bytes is of equal length to values, and any zero byte

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/io/file.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/io/file.cc b/cpp/src/arrow/io/file.cc
index 720be3d..eb4b9fc 100644
--- a/cpp/src/arrow/io/file.cc
+++ b/cpp/src/arrow/io/file.cc
@@ -250,9 +250,9 @@ static inline Status FileRead(
     int fd, uint8_t* buffer, int64_t nbytes, int64_t* bytes_read) {
 #if defined(_MSC_VER)
   if (nbytes > INT32_MAX) { return Status::IOError("Unable to read > 2GB blocks yet");
}
-  *bytes_read = _read(fd, buffer, static_cast<size_t>(nbytes));
+  *bytes_read = static_cast<int64_t>(_read(fd, buffer, static_cast<uint32_t>(nbytes)));
 #else
-  *bytes_read = read(fd, buffer, static_cast<size_t>(nbytes));
+  *bytes_read = static_cast<int64_t>(read(fd, buffer, static_cast<size_t>(nbytes)));
 #endif
 
   if (*bytes_read == -1) {
@@ -269,7 +269,7 @@ static inline Status FileWrite(int fd, const uint8_t* buffer, int64_t
nbytes) {
   if (nbytes > INT32_MAX) {
     return Status::IOError("Unable to write > 2GB blocks to file yet");
   }
-  ret = static_cast<int>(_write(fd, buffer, static_cast<size_t>(nbytes)));
+  ret = static_cast<int>(_write(fd, buffer, static_cast<uint32_t>(nbytes)));
 #else
   ret = static_cast<int>(write(fd, buffer, static_cast<size_t>(nbytes)));
 #endif

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/io/io-hdfs-test.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/io/io-hdfs-test.cc b/cpp/src/arrow/io/io-hdfs-test.cc
index f3140be..a2c9c52 100644
--- a/cpp/src/arrow/io/io-hdfs-test.cc
+++ b/cpp/src/arrow/io/io-hdfs-test.cc
@@ -107,7 +107,7 @@ class TestHdfsClient : public ::testing::Test {
     const char* port = std::getenv("ARROW_HDFS_TEST_PORT");
     const char* user = std::getenv("ARROW_HDFS_TEST_USER");
 
-    ASSERT_TRUE(user) << "Set ARROW_HDFS_TEST_USER";
+    ASSERT_TRUE(user != nullptr) << "Set ARROW_HDFS_TEST_USER";
 
     conf_.host = host == nullptr ? "localhost" : host;
     conf_.user = user;

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/ipc/json-internal.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/json-internal.cc b/cpp/src/arrow/ipc/json-internal.cc
index 124c21b..fe0a7c9 100644
--- a/cpp/src/arrow/ipc/json-internal.cc
+++ b/cpp/src/arrow/ipc/json-internal.cc
@@ -1102,7 +1102,7 @@ class JsonArrayReader {
     std::vector<bool> is_valid;
     for (const rj::Value& val : json_validity) {
       DCHECK(val.IsInt());
-      is_valid.push_back(static_cast<bool>(val.GetInt()));
+      is_valid.push_back(val.GetInt() != 0);
     }
 
 #define TYPE_CASE(TYPE) \

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/ipc/test-common.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/ipc/test-common.h b/cpp/src/arrow/ipc/test-common.h
index d113531..9e0480d 100644
--- a/cpp/src/arrow/ipc/test-common.h
+++ b/cpp/src/arrow/ipc/test-common.h
@@ -125,7 +125,7 @@ Status MakeRandomListArray(const std::shared_ptr<Array>& child_array,
int num_li
     std::partial_sum(list_sizes.begin(), list_sizes.end(), ++offsets.begin());
 
     // Force invariants
-    const int64_t child_length = child_array->length();
+    const int32_t child_length = static_cast<int32_t>(child_array->length());
     offsets[0] = 0;
     std::replace_if(offsets.begin(), offsets.end(),
         [child_length](int32_t offset) { return offset > child_length; }, child_length);

http://git-wip-us.apache.org/repos/asf/arrow/blob/1c660974/cpp/src/arrow/tensor.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/tensor.cc b/cpp/src/arrow/tensor.cc
index 8bbb97b..d1c4083 100644
--- a/cpp/src/arrow/tensor.cc
+++ b/cpp/src/arrow/tensor.cc
@@ -86,7 +86,7 @@ const std::string& Tensor::dim_name(int i) const {
 }
 
 int64_t Tensor::size() const {
-  return std::accumulate(shape_.begin(), shape_.end(), 1, std::multiplies<int64_t>());
+  return std::accumulate(shape_.begin(), shape_.end(), 1LL, std::multiplies<int64_t>());
 }
 
 bool Tensor::is_contiguous() const {


Mime
View raw message