You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2018/04/23 17:25:48 UTC
orc git commit: ORC-331. Initial support of MSVC
Repository: orc
Updated Branches:
refs/heads/master c0f3bcfe9 -> 6c67bc8cc
ORC-331. Initial support of MSVC
Fixes #240
Signed-off-by: Owen O'Malley <om...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/6c67bc8c
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/6c67bc8c
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/6c67bc8c
Branch: refs/heads/master
Commit: 6c67bc8ccbec3b01f4d4b0445a98334091afc20b
Parents: c0f3bcf
Author: rip-nsk <ri...@gmail.com>
Authored: Sat Apr 7 15:42:20 2018 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Mon Apr 23 10:25:29 2018 -0700
----------------------------------------------------------------------
CMakeLists.txt | 21 ++++++++-------------
c++/src/Adaptor.hh.in | 5 +++++
c++/src/CMakeLists.txt | 4 ++++
c++/src/Compression.cc | 10 ++++++++--
c++/src/wrap/coded-stream-wrapper.h | 4 +++-
c++/src/wrap/gmock.h | 15 +++++++++------
c++/src/wrap/gtest-wrapper.h | 21 +++++++++++++++------
c++/src/wrap/orc-proto-wrapper.cc | 21 ++++++++++++++-------
c++/src/wrap/orc-proto-wrapper.hh | 16 ++++++++++++----
c++/src/wrap/zero-copy-stream-wrapper.h | 8 +++++---
10 files changed, 83 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fee242f..812d07f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,9 +64,11 @@ INCLUDE(ExternalProject)
#
# Compiler specific flags
#
-set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+if (NOT MSVC)
+ set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+endif ()
message(STATUS "compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CXX11_FLAGS "-std=c++11")
@@ -87,16 +89,9 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
elseif (MSVC)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
- # TODO: We assume MSVC debug mode. In the future, set these flags
- # appropriately for all build mode.
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib")
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt.lib")
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcd.lib")
-
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrtd.lib")
+ add_definitions (-D_CRT_NONSTDC_NO_DEPRECATE) # The POSIX name for this item is deprecated
+ set (WARN_FLAGS "${WARN_FLAGS} -wd4521") # multiple copy constructors specified
+ set (WARN_FLAGS "${WARN_FLAGS} -wd4146") # unary minus operator applied to unsigned type, result still unsigned
endif ()
enable_testing()
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/Adaptor.hh.in
----------------------------------------------------------------------
diff --git a/c++/src/Adaptor.hh.in b/c++/src/Adaptor.hh.in
index c09fa02..5d9ea15 100644
--- a/c++/src/Adaptor.hh.in
+++ b/c++/src/Adaptor.hh.in
@@ -65,6 +65,9 @@
#elif defined(__GNUC__)
#define DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
#define DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
+ #elif defined(_MSC_VER)
+ #define DIAGNOSTIC_PUSH __pragma(warning(push))
+ #define DIAGNOSTIC_POP __pragma(warning(pop))
#else
#error("Unknown compiler")
#endif
@@ -79,6 +82,8 @@
#define DIAGNOSTIC_IGNORE(XXX) PRAGMA(clang diagnostic ignored XXX)
#elif defined(__GNUC__)
#define DIAGNOSTIC_IGNORE(XXX) PRAGMA(GCC diagnostic ignored XXX)
+#elif defined(_MSC_VER)
+ #define DIAGNOSTIC_IGNORE(XXX) __pragma(warning(disable : XXX))
#else
#define DIAGNOSTIC_IGNORE(XXX)
#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index c76f793..8254574 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -51,6 +51,10 @@ CHECK_CXX_SOURCE_COMPILES("
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored \"-Wdeprecated\"
#pragma GCC diagnostic pop
+ #elif defined(_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4996 )
+ #pragma warning( pop )
#else
unknownCompiler!
#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/Compression.cc
----------------------------------------------------------------------
diff --git a/c++/src/Compression.cc b/c++/src/Compression.cc
index 2f81c5d..cb4bcdd 100644
--- a/c++/src/Compression.cc
+++ b/c++/src/Compression.cc
@@ -266,7 +266,10 @@ namespace orc {
}
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wold-style-cast")
+
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wold-style-cast")
+#endif
void ZlibCompressionStream::init() {
strm.zalloc = nullptr;
@@ -370,7 +373,10 @@ DIAGNOSTIC_PUSH
};
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wold-style-cast")
+
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wold-style-cast")
+#endif
ZlibDecompressionStream::ZlibDecompressionStream
(std::unique_ptr<SeekableInputStream> inStream,
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/coded-stream-wrapper.h
----------------------------------------------------------------------
diff --git a/c++/src/wrap/coded-stream-wrapper.h b/c++/src/wrap/coded-stream-wrapper.h
index 07af410..605fbf8 100644
--- a/c++/src/wrap/coded-stream-wrapper.h
+++ b/c++/src/wrap/coded-stream-wrapper.h
@@ -24,7 +24,9 @@ DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE("-Wreserved-id-macro")
#endif
-DIAGNOSTIC_IGNORE("-Wconversion")
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wconversion")
+#endif
#include <google/protobuf/io/coded_stream.h>
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/gmock.h
----------------------------------------------------------------------
diff --git a/c++/src/wrap/gmock.h b/c++/src/wrap/gmock.h
index cca2a8a..a130a84 100644
--- a/c++/src/wrap/gmock.h
+++ b/c++/src/wrap/gmock.h
@@ -21,12 +21,15 @@
#include "Adaptor.hh"
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wdeprecated")
-DIAGNOSTIC_IGNORE("-Wmissing-noreturn")
-DIAGNOSTIC_IGNORE("-Wpadded")
-DIAGNOSTIC_IGNORE("-Wsign-compare")
-DIAGNOSTIC_IGNORE("-Wsign-conversion")
-DIAGNOSTIC_IGNORE("-Wundef")
+
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wdeprecated")
+ DIAGNOSTIC_IGNORE("-Wmissing-noreturn")
+ DIAGNOSTIC_IGNORE("-Wpadded")
+ DIAGNOSTIC_IGNORE("-Wsign-compare")
+ DIAGNOSTIC_IGNORE("-Wsign-conversion")
+ DIAGNOSTIC_IGNORE("-Wundef")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wnull-dereference")
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/gtest-wrapper.h
----------------------------------------------------------------------
diff --git a/c++/src/wrap/gtest-wrapper.h b/c++/src/wrap/gtest-wrapper.h
index a14f6c3..b1bdcc7 100644
--- a/c++/src/wrap/gtest-wrapper.h
+++ b/c++/src/wrap/gtest-wrapper.h
@@ -20,7 +20,9 @@
// we need to disable a whole set of warnings as we include gtest.h
// restore most of the warnings after the file is loaded.
-DIAGNOSTIC_IGNORE("-Wsign-compare")
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wsign-compare")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wconversion-null")
@@ -33,11 +35,13 @@ DIAGNOSTIC_IGNORE("-Wsign-compare")
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wdeprecated")
-DIAGNOSTIC_IGNORE("-Wmissing-noreturn")
-DIAGNOSTIC_IGNORE("-Wpadded")
-DIAGNOSTIC_IGNORE("-Wsign-compare")
-DIAGNOSTIC_IGNORE("-Wundef")
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wdeprecated")
+ DIAGNOSTIC_IGNORE("-Wmissing-noreturn")
+ DIAGNOSTIC_IGNORE("-Wpadded")
+ DIAGNOSTIC_IGNORE("-Wsign-compare")
+ DIAGNOSTIC_IGNORE("-Wundef")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wshift-sign-overflow")
@@ -45,6 +49,11 @@ DIAGNOSTIC_IGNORE("-Wundef")
DIAGNOSTIC_IGNORE("-Wweak-vtables")
#endif
+#ifdef _MSC_VER
+ DIAGNOSTIC_IGNORE(4146) // unary minus operator applied to unsigned type, result still unsigned
+ DIAGNOSTIC_IGNORE(4805) // '==': unsafe mix of type 'const bool' and type 'const int64_t' in operation
+#endif
+
#include "gtest/gtest.h"
DIAGNOSTIC_POP
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/orc-proto-wrapper.cc
----------------------------------------------------------------------
diff --git a/c++/src/wrap/orc-proto-wrapper.cc b/c++/src/wrap/orc-proto-wrapper.cc
index 8b10cae..dd00c9f 100644
--- a/c++/src/wrap/orc-proto-wrapper.cc
+++ b/c++/src/wrap/orc-proto-wrapper.cc
@@ -14,13 +14,15 @@
#include "Adaptor.hh"
-DIAGNOSTIC_IGNORE("-Wconversion")
-DIAGNOSTIC_IGNORE("-Wdeprecated")
-DIAGNOSTIC_IGNORE("-Wignored-qualifiers")
-DIAGNOSTIC_IGNORE("-Wpadded")
-DIAGNOSTIC_IGNORE("-Wsign-compare")
-DIAGNOSTIC_IGNORE("-Wsign-conversion")
-DIAGNOSTIC_IGNORE("-Wunused-parameter")
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wconversion")
+ DIAGNOSTIC_IGNORE("-Wdeprecated")
+ DIAGNOSTIC_IGNORE("-Wignored-qualifiers")
+ DIAGNOSTIC_IGNORE("-Wpadded")
+ DIAGNOSTIC_IGNORE("-Wsign-compare")
+ DIAGNOSTIC_IGNORE("-Wsign-conversion")
+ DIAGNOSTIC_IGNORE("-Wunused-parameter")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wdisabled-macro-expansion")
@@ -34,4 +36,9 @@ DIAGNOSTIC_IGNORE("-Wunused-parameter")
DIAGNOSTIC_IGNORE("-Wzero-as-null-pointer-constant")
#endif
+#if defined(_MSC_VER)
+ DIAGNOSTIC_IGNORE(4146) // unary minus operator applied to unsigned type, result still unsigned
+ DIAGNOSTIC_IGNORE(4800) // forcing value to bool 'true' or 'false'
+#endif
+
#include "orc_proto.pb.cc"
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/orc-proto-wrapper.hh
----------------------------------------------------------------------
diff --git a/c++/src/wrap/orc-proto-wrapper.hh b/c++/src/wrap/orc-proto-wrapper.hh
index 5fc9558..f902ffd 100644
--- a/c++/src/wrap/orc-proto-wrapper.hh
+++ b/c++/src/wrap/orc-proto-wrapper.hh
@@ -18,10 +18,13 @@
#include "Adaptor.hh"
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wconversion")
-DIAGNOSTIC_IGNORE("-Wdeprecated")
-DIAGNOSTIC_IGNORE("-Wsign-conversion")
-DIAGNOSTIC_IGNORE("-Wunused-parameter")
+
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wconversion")
+ DIAGNOSTIC_IGNORE("-Wdeprecated")
+ DIAGNOSTIC_IGNORE("-Wsign-conversion")
+ DIAGNOSTIC_IGNORE("-Wunused-parameter")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wnested-anon-types")
@@ -32,6 +35,11 @@ DIAGNOSTIC_IGNORE("-Wunused-parameter")
DIAGNOSTIC_IGNORE("-Wzero-as-null-pointer-constant")
#endif
+#if defined(_MSC_VER)
+ DIAGNOSTIC_IGNORE(4146) // unary minus operator applied to unsigned type, result still unsigned
+ DIAGNOSTIC_IGNORE(4800) // forcing value to bool 'true' or 'false'
+#endif
+
#include "orc_proto.pb.h"
DIAGNOSTIC_POP
http://git-wip-us.apache.org/repos/asf/orc/blob/6c67bc8c/c++/src/wrap/zero-copy-stream-wrapper.h
----------------------------------------------------------------------
diff --git a/c++/src/wrap/zero-copy-stream-wrapper.h b/c++/src/wrap/zero-copy-stream-wrapper.h
index 6f03113..1af0bd0 100644
--- a/c++/src/wrap/zero-copy-stream-wrapper.h
+++ b/c++/src/wrap/zero-copy-stream-wrapper.h
@@ -19,9 +19,11 @@
DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE("-Wdeprecated")
-DIAGNOSTIC_IGNORE("-Wpadded")
-DIAGNOSTIC_IGNORE("-Wunused-parameter")
+#if defined(__GNUC__) || defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wdeprecated")
+ DIAGNOSTIC_IGNORE("-Wpadded")
+ DIAGNOSTIC_IGNORE("-Wunused-parameter")
+#endif
#ifdef __clang__
DIAGNOSTIC_IGNORE("-Wreserved-id-macro")