Skip to content

Commit 90eeb4a

Browse files
fsaintjacqueswesm
authored andcommitted
ARROW-4364: [C++] Fix CHECKIN warnings
Author: François Saint-Jacques <fsaintjacques@gmail.com> Closes apache#3478 from fsaintjacques/ARROW-4364-fix-everything-warnings and squashes the following commits: 9b4eee4 <François Saint-Jacques> Add missing includes 28dba78 <François Saint-Jacques> Make clang warning happy b94c98a <François Saint-Jacques> ARROW-4364: Fix -Wextra -Weverything warnings
1 parent 5043d1e commit 90eeb4a

14 files changed

Lines changed: 151 additions & 144 deletions

File tree

cpp/src/arrow/compute/kernels/cast.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,26 +1328,26 @@ class CastKernel : public UnaryKernel {
13281328
return nullptr; \
13291329
}
13301330

1331-
GET_CAST_FUNCTION(NULL_CASES, NullType);
1332-
GET_CAST_FUNCTION(NUMERIC_CASES, BooleanType);
1333-
GET_CAST_FUNCTION(NUMERIC_CASES, UInt8Type);
1334-
GET_CAST_FUNCTION(NUMERIC_CASES, Int8Type);
1335-
GET_CAST_FUNCTION(NUMERIC_CASES, UInt16Type);
1336-
GET_CAST_FUNCTION(NUMERIC_CASES, Int16Type);
1337-
GET_CAST_FUNCTION(NUMERIC_CASES, UInt32Type);
1338-
GET_CAST_FUNCTION(INT32_CASES, Int32Type);
1339-
GET_CAST_FUNCTION(NUMERIC_CASES, UInt64Type);
1340-
GET_CAST_FUNCTION(INT64_CASES, Int64Type);
1341-
GET_CAST_FUNCTION(NUMERIC_CASES, FloatType);
1342-
GET_CAST_FUNCTION(NUMERIC_CASES, DoubleType);
1343-
GET_CAST_FUNCTION(DATE32_CASES, Date32Type);
1344-
GET_CAST_FUNCTION(DATE64_CASES, Date64Type);
1345-
GET_CAST_FUNCTION(TIME32_CASES, Time32Type);
1346-
GET_CAST_FUNCTION(TIME64_CASES, Time64Type);
1347-
GET_CAST_FUNCTION(TIMESTAMP_CASES, TimestampType);
1348-
GET_CAST_FUNCTION(BINARY_CASES, BinaryType);
1349-
GET_CAST_FUNCTION(STRING_CASES, StringType);
1350-
GET_CAST_FUNCTION(DICTIONARY_CASES, DictionaryType);
1331+
GET_CAST_FUNCTION(NULL_CASES, NullType)
1332+
GET_CAST_FUNCTION(NUMERIC_CASES, BooleanType)
1333+
GET_CAST_FUNCTION(NUMERIC_CASES, UInt8Type)
1334+
GET_CAST_FUNCTION(NUMERIC_CASES, Int8Type)
1335+
GET_CAST_FUNCTION(NUMERIC_CASES, UInt16Type)
1336+
GET_CAST_FUNCTION(NUMERIC_CASES, Int16Type)
1337+
GET_CAST_FUNCTION(NUMERIC_CASES, UInt32Type)
1338+
GET_CAST_FUNCTION(INT32_CASES, Int32Type)
1339+
GET_CAST_FUNCTION(NUMERIC_CASES, UInt64Type)
1340+
GET_CAST_FUNCTION(INT64_CASES, Int64Type)
1341+
GET_CAST_FUNCTION(NUMERIC_CASES, FloatType)
1342+
GET_CAST_FUNCTION(NUMERIC_CASES, DoubleType)
1343+
GET_CAST_FUNCTION(DATE32_CASES, Date32Type)
1344+
GET_CAST_FUNCTION(DATE64_CASES, Date64Type)
1345+
GET_CAST_FUNCTION(TIME32_CASES, Time32Type)
1346+
GET_CAST_FUNCTION(TIME64_CASES, Time64Type)
1347+
GET_CAST_FUNCTION(TIMESTAMP_CASES, TimestampType)
1348+
GET_CAST_FUNCTION(BINARY_CASES, BinaryType)
1349+
GET_CAST_FUNCTION(STRING_CASES, StringType)
1350+
GET_CAST_FUNCTION(DICTIONARY_CASES, DictionaryType)
13511351

13521352
#define CAST_FUNCTION_CASE(InType) \
13531353
case InType::type_id: \

cpp/src/arrow/io/buffered-test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ TEST_F(TestBufferedOutputStream, TruncatesFile) {
302302
// ----------------------------------------------------------------------
303303
// BufferedInputStream tests
304304

305-
const char kExample1[] = ("informaticacrobaticsimmolation");
305+
const char kExample1[] = "informaticacrobaticsimmolation";
306306

307307
class TestBufferedInputStream : public FileTestFixture<BufferedInputStream> {
308308
public:

cpp/src/arrow/io/compressed-test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ std::shared_ptr<Buffer> CompressDataOneShot(Codec* codec,
7373
ABORT_NOT_OK(codec->Compress(data.size(), data.data(), max_compressed_len,
7474
compressed->mutable_data(), &compressed_len));
7575
ABORT_NOT_OK(compressed->Resize(compressed_len));
76-
return compressed;
76+
return std::move(compressed);
7777
}
7878

7979
Status RunCompressedInputStream(Codec* codec, std::shared_ptr<Buffer> compressed,

cpp/src/arrow/python/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#include <datetime.h>
2727

2828
// Work around C2528 error
29+
#ifdef _MSC_VER
2930
#if _MSC_VER >= 1900
3031
#undef timezone
3132
#endif
33+
#endif
3234

3335
#endif // ARROW_PYTHON_PLATFORM_H

cpp/src/arrow/status.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class ARROW_MUST_USE_RESULT ARROW_EXPORT Status;
118118
class ARROW_EXPORT Status {
119119
public:
120120
// Create a success status.
121-
Status() noexcept : state_(NULL) {}
121+
Status() noexcept : state_(NULLPTR) {}
122122
~Status() noexcept {
123123
// ARROW-2400: On certain compilers, splitting off the slow path improves
124124
// performance significantly.
@@ -263,7 +263,7 @@ class ARROW_EXPORT Status {
263263
}
264264

265265
/// Return true iff the status indicates success.
266-
bool ok() const { return (state_ == NULL); }
266+
bool ok() const { return (state_ == NULLPTR); }
267267

268268
/// Return true iff the status indicates an out-of-memory error.
269269
bool IsOutOfMemory() const { return code() == StatusCode::OutOfMemory; }
@@ -336,7 +336,7 @@ class ARROW_EXPORT Status {
336336

337337
void DeleteState() {
338338
delete state_;
339-
state_ = NULL;
339+
state_ = NULLPTR;
340340
}
341341
void CopyFrom(const Status& s);
342342
inline void MoveFrom(Status& s);
@@ -350,11 +350,11 @@ static inline std::ostream& operator<<(std::ostream& os, const Status& x) {
350350
void Status::MoveFrom(Status& s) {
351351
delete state_;
352352
state_ = s.state_;
353-
s.state_ = NULL;
353+
s.state_ = NULLPTR;
354354
}
355355

356356
Status::Status(const Status& s)
357-
: state_((s.state_ == NULL) ? NULL : new State(*s.state_)) {}
357+
: state_((s.state_ == NULLPTR) ? NULLPTR : new State(*s.state_)) {}
358358

359359
Status& Status::operator=(const Status& s) {
360360
// The following condition catches both aliasing (when this == &s),
@@ -365,7 +365,7 @@ Status& Status::operator=(const Status& s) {
365365
return *this;
366366
}
367367

368-
Status::Status(Status&& s) noexcept : state_(s.state_) { s.state_ = NULL; }
368+
Status::Status(Status&& s) noexcept : state_(s.state_) { s.state_ = NULLPTR; }
369369

370370
Status& Status::operator=(Status&& s) noexcept {
371371
MoveFrom(s);

cpp/src/arrow/type-test.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,19 @@ TEST_F(TestSchema, TestRemoveMetadata) {
262262
ASSERT_EQ(tp.ToString(), std::string(NAME)); \
263263
}
264264

265-
PRIMITIVE_TEST(Int8Type, INT8, "int8");
266-
PRIMITIVE_TEST(Int16Type, INT16, "int16");
267-
PRIMITIVE_TEST(Int32Type, INT32, "int32");
268-
PRIMITIVE_TEST(Int64Type, INT64, "int64");
269-
PRIMITIVE_TEST(UInt8Type, UINT8, "uint8");
270-
PRIMITIVE_TEST(UInt16Type, UINT16, "uint16");
271-
PRIMITIVE_TEST(UInt32Type, UINT32, "uint32");
272-
PRIMITIVE_TEST(UInt64Type, UINT64, "uint64");
273-
274-
PRIMITIVE_TEST(FloatType, FLOAT, "float");
275-
PRIMITIVE_TEST(DoubleType, DOUBLE, "double");
276-
277-
PRIMITIVE_TEST(BooleanType, BOOL, "bool");
265+
PRIMITIVE_TEST(Int8Type, INT8, "int8")
266+
PRIMITIVE_TEST(Int16Type, INT16, "int16")
267+
PRIMITIVE_TEST(Int32Type, INT32, "int32")
268+
PRIMITIVE_TEST(Int64Type, INT64, "int64")
269+
PRIMITIVE_TEST(UInt8Type, UINT8, "uint8")
270+
PRIMITIVE_TEST(UInt16Type, UINT16, "uint16")
271+
PRIMITIVE_TEST(UInt32Type, UINT32, "uint32")
272+
PRIMITIVE_TEST(UInt64Type, UINT64, "uint64")
273+
274+
PRIMITIVE_TEST(FloatType, FLOAT, "float")
275+
PRIMITIVE_TEST(DoubleType, DOUBLE, "double")
276+
277+
PRIMITIVE_TEST(BooleanType, BOOL, "bool")
278278

279279
TEST(TestBinaryType, ToString) {
280280
BinaryType t1;

cpp/src/arrow/type.cc

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -462,46 +462,46 @@ std::shared_ptr<Schema> schema(std::vector<std::shared_ptr<Field>>&& fields,
462462
#define ACCEPT_VISITOR(TYPE) \
463463
Status TYPE::Accept(TypeVisitor* visitor) const { return visitor->Visit(*this); }
464464

465-
ACCEPT_VISITOR(NullType);
466-
ACCEPT_VISITOR(BooleanType);
467-
ACCEPT_VISITOR(BinaryType);
468-
ACCEPT_VISITOR(FixedSizeBinaryType);
469-
ACCEPT_VISITOR(StringType);
470-
ACCEPT_VISITOR(ListType);
471-
ACCEPT_VISITOR(StructType);
472-
ACCEPT_VISITOR(Decimal128Type);
473-
ACCEPT_VISITOR(UnionType);
474-
ACCEPT_VISITOR(Date32Type);
475-
ACCEPT_VISITOR(Date64Type);
476-
ACCEPT_VISITOR(Time32Type);
477-
ACCEPT_VISITOR(Time64Type);
478-
ACCEPT_VISITOR(TimestampType);
479-
ACCEPT_VISITOR(IntervalType);
480-
ACCEPT_VISITOR(DictionaryType);
465+
ACCEPT_VISITOR(NullType)
466+
ACCEPT_VISITOR(BooleanType)
467+
ACCEPT_VISITOR(BinaryType)
468+
ACCEPT_VISITOR(FixedSizeBinaryType)
469+
ACCEPT_VISITOR(StringType)
470+
ACCEPT_VISITOR(ListType)
471+
ACCEPT_VISITOR(StructType)
472+
ACCEPT_VISITOR(Decimal128Type)
473+
ACCEPT_VISITOR(UnionType)
474+
ACCEPT_VISITOR(Date32Type)
475+
ACCEPT_VISITOR(Date64Type)
476+
ACCEPT_VISITOR(Time32Type)
477+
ACCEPT_VISITOR(Time64Type)
478+
ACCEPT_VISITOR(TimestampType)
479+
ACCEPT_VISITOR(IntervalType)
480+
ACCEPT_VISITOR(DictionaryType)
481481

482482
#define TYPE_FACTORY(NAME, KLASS) \
483483
std::shared_ptr<DataType> NAME() { \
484484
static std::shared_ptr<DataType> result = std::make_shared<KLASS>(); \
485485
return result; \
486486
}
487487

488-
TYPE_FACTORY(null, NullType);
489-
TYPE_FACTORY(boolean, BooleanType);
490-
TYPE_FACTORY(int8, Int8Type);
491-
TYPE_FACTORY(uint8, UInt8Type);
492-
TYPE_FACTORY(int16, Int16Type);
493-
TYPE_FACTORY(uint16, UInt16Type);
494-
TYPE_FACTORY(int32, Int32Type);
495-
TYPE_FACTORY(uint32, UInt32Type);
496-
TYPE_FACTORY(int64, Int64Type);
497-
TYPE_FACTORY(uint64, UInt64Type);
498-
TYPE_FACTORY(float16, HalfFloatType);
499-
TYPE_FACTORY(float32, FloatType);
500-
TYPE_FACTORY(float64, DoubleType);
501-
TYPE_FACTORY(utf8, StringType);
502-
TYPE_FACTORY(binary, BinaryType);
503-
TYPE_FACTORY(date64, Date64Type);
504-
TYPE_FACTORY(date32, Date32Type);
488+
TYPE_FACTORY(null, NullType)
489+
TYPE_FACTORY(boolean, BooleanType)
490+
TYPE_FACTORY(int8, Int8Type)
491+
TYPE_FACTORY(uint8, UInt8Type)
492+
TYPE_FACTORY(int16, Int16Type)
493+
TYPE_FACTORY(uint16, UInt16Type)
494+
TYPE_FACTORY(int32, Int32Type)
495+
TYPE_FACTORY(uint32, UInt32Type)
496+
TYPE_FACTORY(int64, Int64Type)
497+
TYPE_FACTORY(uint64, UInt64Type)
498+
TYPE_FACTORY(float16, HalfFloatType)
499+
TYPE_FACTORY(float32, FloatType)
500+
TYPE_FACTORY(float64, DoubleType)
501+
TYPE_FACTORY(utf8, StringType)
502+
TYPE_FACTORY(binary, BinaryType)
503+
TYPE_FACTORY(date64, Date64Type)
504+
TYPE_FACTORY(date32, Date32Type)
505505

506506
std::shared_ptr<DataType> fixed_size_binary(int32_t byte_width) {
507507
return std::make_shared<FixedSizeBinaryType>(byte_width);

cpp/src/arrow/type_fwd.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ class NumericTensor;
9696
using KLASS##Builder = NumericBuilder<KLASS##Type>; \
9797
using KLASS##Tensor = NumericTensor<KLASS##Type>;
9898

99-
_NUMERIC_TYPE_DECL(Int8);
100-
_NUMERIC_TYPE_DECL(Int16);
101-
_NUMERIC_TYPE_DECL(Int32);
102-
_NUMERIC_TYPE_DECL(Int64);
103-
_NUMERIC_TYPE_DECL(UInt8);
104-
_NUMERIC_TYPE_DECL(UInt16);
105-
_NUMERIC_TYPE_DECL(UInt32);
106-
_NUMERIC_TYPE_DECL(UInt64);
107-
_NUMERIC_TYPE_DECL(HalfFloat);
108-
_NUMERIC_TYPE_DECL(Float);
109-
_NUMERIC_TYPE_DECL(Double);
99+
_NUMERIC_TYPE_DECL(Int8)
100+
_NUMERIC_TYPE_DECL(Int16)
101+
_NUMERIC_TYPE_DECL(Int32)
102+
_NUMERIC_TYPE_DECL(Int64)
103+
_NUMERIC_TYPE_DECL(UInt8)
104+
_NUMERIC_TYPE_DECL(UInt16)
105+
_NUMERIC_TYPE_DECL(UInt32)
106+
_NUMERIC_TYPE_DECL(UInt64)
107+
_NUMERIC_TYPE_DECL(HalfFloat)
108+
_NUMERIC_TYPE_DECL(Float)
109+
_NUMERIC_TYPE_DECL(Double)
110110

111111
#undef _NUMERIC_TYPE_DECL
112112

cpp/src/arrow/type_traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ struct as_void {
406406
using type = typename T::ATTR_NAME; \
407407
};
408408

409-
GET_ATTR(c_type, void);
410-
GET_ATTR(TypeClass, void);
409+
GET_ATTR(c_type, void)
410+
GET_ATTR(TypeClass, void)
411411

412412
#undef GET_ATTR
413413

cpp/src/arrow/util/hash-util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,13 @@ class HashUtil {
134134
switch (nbytes) {
135135
case 3:
136136
h1 = HW_crc32_u8(h1, p[3]);
137+
// fallthrough
137138
case 2:
138139
h2 = HW_crc32_u8(h2, p[2]);
140+
// fallthrough
139141
case 1:
140142
h1 = HW_crc32_u8(h1, p[1]);
143+
// fallthrough
141144
case 0:
142145
break;
143146
default:

0 commit comments

Comments
 (0)