mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
Fix some more compiler warnings
Change-Id: I942ece689faf641ca9988984f283e6660d9d896a
This commit is contained in:
1 parent
cae05fb542
commit
1bec4a76ea
12 files changed
+48
-35
No files matched your search
@@ -71,17 +71,16 @@ if ("${UPPERCASE_BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
|
||||
elseif ("${COMPILER_FAMILY}" STREQUAL "clang")
|
||||
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Weverything -Wno-c++98-compat \
|
||||
-Wno-c++98-compat-pedantic -Wno-deprecated -Wno-weak-vtables -Wno-padded \
|
||||
-Wno-missing-field-initializers \
|
||||
-Wno-unused-parameter -Wno-undef \
|
||||
-Wno-shadow -Wno-switch-enum -Wno-exit-time-destructors \
|
||||
-Wno-global-constructors -Wno-weak-template-vtables -Wno-undefined-reinterpret-cast \
|
||||
-Wno-implicit-fallthrough -Wno-old-style-cast -Wno-unreachable-code-return \
|
||||
-Wno-implicit-fallthrough -Wno-unreachable-code-return \
|
||||
-Wno-float-equal -Wno-missing-prototypes \
|
||||
-Wno-covered-switch-default \
|
||||
-Wno-old-style-cast -Wno-covered-switch-default \
|
||||
-Wno-cast-align -Wno-vla-extension -Wno-shift-sign-overflow \
|
||||
-Wno-used-but-marked-unused -Wno-missing-variable-declarations \
|
||||
-Wno-gnu-zero-variadic-macro-arguments -Wconversion -Wno-sign-conversion \
|
||||
-Wno-disabled-macro-expansion -Wc++11-narrowing -Wnarrowing -Wno-shorten-64-to-32")
|
||||
-Wno-disabled-macro-expansion -Wno-shorten-64-to-32")
|
||||
|
||||
# Version numbers where warnings are introduced
|
||||
if ("${COMPILER_VERSION}" VERSION_GREATER "3.3")
|
||||
|
||||
@@ -132,6 +132,8 @@ Status AllocateBuffer(MemoryPool* pool, const int64_t size,
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
#ifndef ARROW_NO_DEPRECATED_API
|
||||
|
||||
Status AllocateBuffer(MemoryPool* pool, const int64_t size,
|
||||
std::shared_ptr<MutableBuffer>* out) {
|
||||
std::shared_ptr<Buffer> buffer;
|
||||
@@ -140,6 +142,8 @@ Status AllocateBuffer(MemoryPool* pool, const int64_t size,
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Status AllocateResizableBuffer(MemoryPool* pool, const int64_t size,
|
||||
std::shared_ptr<ResizableBuffer>* out) {
|
||||
auto buffer = std::make_shared<PoolBuffer>(pool);
|
||||
|
||||
@@ -70,11 +70,14 @@ static inline Status PyTime_from_int(int64_t val, const TimeUnit::type unit,
|
||||
}
|
||||
|
||||
static inline int64_t PyDate_to_ms(PyDateTime_Date* pydate) {
|
||||
struct tm date = {0};
|
||||
struct tm date;
|
||||
memset(&date, 0, sizeof(struct tm));
|
||||
date.tm_year = PyDateTime_GET_YEAR(pydate) - 1900;
|
||||
date.tm_mon = PyDateTime_GET_MONTH(pydate) - 1;
|
||||
date.tm_mday = PyDateTime_GET_DAY(pydate);
|
||||
struct tm epoch = {0};
|
||||
struct tm epoch;
|
||||
memset(&epoch, 0, sizeof(struct tm));
|
||||
|
||||
epoch.tm_year = 70;
|
||||
epoch.tm_mday = 1;
|
||||
#ifdef _MSC_VER
|
||||
@@ -88,7 +91,8 @@ static inline int64_t PyDate_to_ms(PyDateTime_Date* pydate) {
|
||||
}
|
||||
|
||||
static inline int64_t PyDateTime_to_us(PyDateTime_DateTime* pydatetime) {
|
||||
struct tm datetime = {0};
|
||||
struct tm datetime;
|
||||
memset(&datetime, 0, sizeof(struct tm));
|
||||
datetime.tm_year = PyDateTime_GET_YEAR(pydatetime) - 1900;
|
||||
datetime.tm_mon = PyDateTime_GET_MONTH(pydatetime) - 1;
|
||||
datetime.tm_mday = PyDateTime_GET_DAY(pydatetime);
|
||||
@@ -96,7 +100,8 @@ static inline int64_t PyDateTime_to_us(PyDateTime_DateTime* pydatetime) {
|
||||
datetime.tm_min = PyDateTime_DATE_GET_MINUTE(pydatetime);
|
||||
datetime.tm_sec = PyDateTime_DATE_GET_SECOND(pydatetime);
|
||||
int us = PyDateTime_DATE_GET_MICROSECOND(pydatetime);
|
||||
struct tm epoch = {0};
|
||||
struct tm epoch;
|
||||
memset(&epoch, 0, sizeof(struct tm));
|
||||
epoch.tm_year = 70;
|
||||
epoch.tm_mday = 1;
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -153,13 +153,6 @@ Status Column::ValidateData() {
|
||||
// ----------------------------------------------------------------------
|
||||
// RecordBatch methods
|
||||
|
||||
void AssertBatchValid(const RecordBatch& batch) {
|
||||
Status s = batch.Validate();
|
||||
if (!s.ok()) {
|
||||
DCHECK(false) << s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
RecordBatch::RecordBatch(const std::shared_ptr<Schema>& schema, int64_t num_rows)
|
||||
: schema_(schema), num_rows_(num_rows) {
|
||||
boxed_columns_.resize(schema->num_fields());
|
||||
|
||||
@@ -76,6 +76,8 @@ static struct {
|
||||
};
|
||||
static const int64_t num_flags = sizeof(flag_mappings) / sizeof(flag_mappings[0]);
|
||||
|
||||
namespace {
|
||||
|
||||
// Helper function to parse for hardware flags.
|
||||
// values contains a list of space-seperated flags. check to see if the flags we
|
||||
// care about are present.
|
||||
@@ -90,6 +92,8 @@ int64_t ParseCPUFlags(const string& values) {
|
||||
return flags;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifdef _WIN32
|
||||
bool RetrieveCacheSize(int64_t* cache_sizes) {
|
||||
if (!cache_sizes) {
|
||||
|
||||
@@ -199,7 +199,7 @@ class HashUtil {
|
||||
static uint32_t FnvHash64to32(const void* data, int32_t bytes, uint32_t hash) {
|
||||
// IMPALA-2270: this function should never be used for zero-byte inputs.
|
||||
DCHECK_GT(bytes, 0);
|
||||
uint64_t hash_u64 = hash | ((uint64_t)hash << 32);
|
||||
uint64_t hash_u64 = hash | (static_cast<uint64_t>(hash) << 32);
|
||||
hash_u64 = FnvHash64(data, bytes, hash_u64);
|
||||
return static_cast<uint32_t>((hash_u64 >> 32) ^ (hash_u64 & 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang")
|
||||
PROPERTY COMPILE_FLAGS
|
||||
" -Wno-parentheses-equality \
|
||||
-Wno-shorten-64-to-32 \
|
||||
-Wno-unused-macros")
|
||||
-Wno-unused-macros ")
|
||||
|
||||
set_property(SOURCE thirdparty/xxhash.cc
|
||||
APPEND_STRING
|
||||
|
||||
@@ -400,7 +400,8 @@ static inline bool compute_object_hash_parallel(XXH64_state_t* hash_state,
|
||||
}
|
||||
}
|
||||
|
||||
XXH64_update(hash_state, (unsigned char*)threadhash, sizeof(threadhash));
|
||||
XXH64_update(hash_state, reinterpret_cast<unsigned char*>(threadhash),
|
||||
sizeof(threadhash));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -408,12 +409,14 @@ static uint64_t compute_object_hash(const ObjectBuffer& obj_buffer) {
|
||||
XXH64_state_t hash_state;
|
||||
XXH64_reset(&hash_state, XXH64_DEFAULT_SEED);
|
||||
if (obj_buffer.data_size >= kBytesInMB) {
|
||||
compute_object_hash_parallel(&hash_state, (unsigned char*)obj_buffer.data,
|
||||
compute_object_hash_parallel(&hash_state,
|
||||
reinterpret_cast<unsigned char*>(obj_buffer.data),
|
||||
obj_buffer.data_size);
|
||||
} else {
|
||||
XXH64_update(&hash_state, (unsigned char*)obj_buffer.data, obj_buffer.data_size);
|
||||
XXH64_update(&hash_state, reinterpret_cast<unsigned char*>(obj_buffer.data),
|
||||
obj_buffer.data_size);
|
||||
}
|
||||
XXH64_update(&hash_state, (unsigned char*)obj_buffer.metadata,
|
||||
XXH64_update(&hash_state, reinterpret_cast<unsigned char*>(obj_buffer.metadata),
|
||||
obj_buffer.metadata_size);
|
||||
return XXH64_digest(&hash_state);
|
||||
}
|
||||
|
||||
@@ -64,8 +64,9 @@ int recv_fd(int conn) {
|
||||
for (struct cmsghdr* header = CMSG_FIRSTHDR(&msg); header != NULL;
|
||||
header = CMSG_NXTHDR(&msg, header))
|
||||
if (header->cmsg_level == SOL_SOCKET && header->cmsg_type == SCM_RIGHTS) {
|
||||
ssize_t count =
|
||||
(header->cmsg_len - (CMSG_DATA(header) - (unsigned char*)header)) / sizeof(int);
|
||||
ssize_t count = (header->cmsg_len -
|
||||
(CMSG_DATA(header) - reinterpret_cast<unsigned char*>(header))) /
|
||||
sizeof(int);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
int fd = (reinterpret_cast<int*>(CMSG_DATA(header)))[i];
|
||||
if (found_fd == -1) {
|
||||
|
||||
@@ -130,7 +130,8 @@ int bind_ipc_sock(const std::string& pathname, bool shall_listen) {
|
||||
}
|
||||
strncpy(socket_address.sun_path, pathname.c_str(), pathname.size() + 1);
|
||||
|
||||
if (bind(socket_fd, (struct sockaddr*)&socket_address, sizeof(socket_address)) != 0) {
|
||||
if (bind(socket_fd, reinterpret_cast<struct sockaddr*>(&socket_address),
|
||||
sizeof(socket_address)) != 0) {
|
||||
ARROW_LOG(ERROR) << "Bind failed for pathname " << pathname;
|
||||
close(socket_fd);
|
||||
return -1;
|
||||
@@ -193,8 +194,8 @@ int connect_ipc_sock(const std::string& pathname) {
|
||||
}
|
||||
strncpy(socket_address.sun_path, pathname.c_str(), pathname.size() + 1);
|
||||
|
||||
if (connect(socket_fd, (struct sockaddr*)&socket_address, sizeof(socket_address)) !=
|
||||
0) {
|
||||
if (connect(socket_fd, reinterpret_cast<struct sockaddr*>(&socket_address),
|
||||
sizeof(socket_address)) != 0) {
|
||||
close(socket_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,9 @@ Status SendCreateReply(int sock, ObjectID object_id, PlasmaObject* object,
|
||||
PlasmaObjectSpec plasma_object(object->handle.store_fd, object->handle.mmap_size,
|
||||
object->data_offset, object->data_size,
|
||||
object->metadata_offset, object->metadata_size);
|
||||
auto message = CreatePlasmaCreateReply(fbb, fbb.CreateString(object_id.binary()),
|
||||
&plasma_object, (PlasmaError)error_code);
|
||||
auto message =
|
||||
CreatePlasmaCreateReply(fbb, fbb.CreateString(object_id.binary()), &plasma_object,
|
||||
static_cast<PlasmaError>(error_code));
|
||||
return PlasmaSend(sock, MessageType_PlasmaCreateReply, &fbb, message);
|
||||
}
|
||||
|
||||
@@ -123,7 +124,7 @@ Status ReadSealRequest(uint8_t* data, size_t size, ObjectID* object_id,
|
||||
Status SendSealReply(int sock, ObjectID object_id, int error) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
auto message = CreatePlasmaSealReply(fbb, fbb.CreateString(object_id.binary()),
|
||||
(PlasmaError)error);
|
||||
static_cast<PlasmaError>(error));
|
||||
return PlasmaSend(sock, MessageType_PlasmaSealReply, &fbb, message);
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ Status ReadReleaseRequest(uint8_t* data, size_t size, ObjectID* object_id) {
|
||||
Status SendReleaseReply(int sock, ObjectID object_id, int error) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
auto message = CreatePlasmaReleaseReply(fbb, fbb.CreateString(object_id.binary()),
|
||||
(PlasmaError)error);
|
||||
static_cast<PlasmaError>(error));
|
||||
return PlasmaSend(sock, MessageType_PlasmaReleaseReply, &fbb, message);
|
||||
}
|
||||
|
||||
@@ -185,7 +186,7 @@ Status ReadDeleteRequest(uint8_t* data, size_t size, ObjectID* object_id) {
|
||||
Status SendDeleteReply(int sock, ObjectID object_id, int error) {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
auto message = CreatePlasmaDeleteReply(fbb, fbb.CreateString(object_id.binary()),
|
||||
(PlasmaError)error);
|
||||
static_cast<PlasmaError>(error));
|
||||
return PlasmaSend(sock, MessageType_PlasmaDeleteReply, &fbb, message);
|
||||
}
|
||||
|
||||
@@ -526,8 +527,8 @@ Status ReadDataReply(uint8_t* data, size_t size, ObjectID* object_id,
|
||||
auto message = flatbuffers::GetRoot<PlasmaDataReply>(data);
|
||||
DCHECK(verify_flatbuffer(message, data, size));
|
||||
*object_id = ObjectID::from_binary(message->object_id()->str());
|
||||
*object_size = (int64_t)message->object_size();
|
||||
*metadata_size = (int64_t)message->metadata_size();
|
||||
*object_size = static_cast<int64_t>(message->object_size());
|
||||
*metadata_size = static_cast<int64_t>(message->metadata_size());
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -72,7 +72,8 @@ static void aeApiFree(aeEventLoop *eventLoop) {
|
||||
|
||||
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
|
||||
aeApiState *state = eventLoop->apidata;
|
||||
struct epoll_event ee = {0}; /* avoid valgrind warning */
|
||||
struct epoll_event ee;
|
||||
memset(&ee, 0, sizeof(struct epoll_event)); // avoid valgrind warning
|
||||
/* If the fd was already monitored for some event, we need a MOD
|
||||
* operation. Otherwise we need an ADD operation. */
|
||||
int op = eventLoop->events[fd].mask == AE_NONE ?
|
||||
@@ -89,7 +90,8 @@ static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
|
||||
|
||||
static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int delmask) {
|
||||
aeApiState *state = eventLoop->apidata;
|
||||
struct epoll_event ee = {0}; /* avoid valgrind warning */
|
||||
struct epoll_event ee;
|
||||
memset(&ee, 0, sizeof(struct epoll_event)); // avoid valgrind warning
|
||||
int mask = eventLoop->events[fd].mask & (~delmask);
|
||||
|
||||
ee.events = 0;
|
||||
|
||||
Reference in new issue
Block a user