Skip to content

Commit

Permalink
clang-tidy fixes part 2 (#16938)
Browse files Browse the repository at this point in the history
Subset of improvements to the code base proposed by the latest version of clang-tidy.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Vukasin Milovanovic (https://github.com/vuule)

URL: #16938
  • Loading branch information
vyasr authored Sep 27, 2024
1 parent 4018d31 commit afe9f92
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 35 deletions.
2 changes: 1 addition & 1 deletion cpp/src/datetime/timezone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::string const tzif_system_directory = "/usr/share/zoneinfo/";
struct timezone_file_header {
uint32_t magic; ///< "TZif"
uint8_t version; ///< 0:version1, '2':version2, '3':version3
uint8_t reserved15[15]; ///< unused, reserved for future use
uint8_t reserved15[15]; ///< unused, reserved for future use // NOLINT
uint32_t isutccnt; ///< number of UTC/local indicators contained in the body
uint32_t isstdcnt; ///< number of standard/wall indicators contained in the body
uint32_t leapcnt; ///< number of leap second records contained in the body
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/dictionary/dictionary_column_view.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,8 +36,7 @@ column_view dictionary_column_view::indices() const noexcept { return child(0);

column_view dictionary_column_view::get_indices_annotated() const noexcept
{
return column_view(
indices().type(), size(), indices().head(), null_mask(), null_count(), offset());
return {indices().type(), size(), indices().head(), null_mask(), null_count(), offset()};
}

column_view dictionary_column_view::keys() const noexcept { return child(1); }
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/interop/dlpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ DLDataType data_type_to_DLDataType(data_type type)

// Context object to own memory allocated for DLManagedTensor
struct dltensor_context {
int64_t shape[2];
int64_t strides[2];
int64_t shape[2]; // NOLINT
int64_t strides[2]; // NOLINT
rmm::device_buffer buffer;

static void deleter(DLManagedTensor* arg)
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/io/avro/avro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool container::parse(file_metadata* md, size_t max_num_rows, size_t first_row)
// Read the next sync markers and ensure they match the first ones we
// encountered. If they don't, we have to assume the data is corrupted,
// and thus, we terminate processing immediately.
uint64_t const sync_marker[] = {get_raw<uint64_t>(), get_raw<uint64_t>()};
std::array const sync_marker = {get_raw<uint64_t>(), get_raw<uint64_t>()};
bool valid_sync_markers =
((sync_marker[0] == md->sync_marker[0]) && (sync_marker[1] == md->sync_marker[1]));
if (!valid_sync_markers) { return false; }
Expand Down
21 changes: 11 additions & 10 deletions cpp/src/io/avro/avro.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
#include "avro_common.hpp"

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdio>
Expand Down Expand Up @@ -100,15 +101,15 @@ struct column_desc {
*/
struct file_metadata {
std::map<std::string, std::string> user_data;
std::string codec = "";
uint64_t sync_marker[2] = {0, 0};
size_t metadata_size = 0;
size_t total_data_size = 0;
size_t selected_data_size = 0;
size_type num_rows = 0;
size_type skip_rows = 0;
size_type total_num_rows = 0;
uint32_t max_block_size = 0;
std::string codec = "";
std::array<uint64_t, 2> sync_marker = {0, 0};
size_t metadata_size = 0;
size_t total_data_size = 0;
size_t selected_data_size = 0;
size_type num_rows = 0;
size_type skip_rows = 0;
size_type total_num_rows = 0;
uint32_t max_block_size = 0;
std::vector<schema_entry> schema;
std::vector<block_desc_s> block_list;
std::vector<column_desc> columns;
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/io/comp/uncomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct gz_file_header_s {
uint8_t id2; // 0x8b
uint8_t comp_mthd; // compression method (0-7=reserved, 8=deflate)
uint8_t flags; // flags (GZIPHeaderFlag)
uint8_t mtime[4]; // If non-zero: modification time (Unix format)
uint8_t mtime[4]; // If non-zero: modification time (Unix format) // NOLINT
uint8_t xflags; // Extra compressor-specific flags
uint8_t os; // OS id
};
Expand Down Expand Up @@ -103,7 +103,7 @@ struct zip_lfh_s {
};

struct bz2_file_header_s {
uint8_t sig[3]; // "BZh"
uint8_t sig[3]; // "BZh" // NOLINT
uint8_t blksz; // block size 1..9 in 100kB units (post-RLE)
};

Expand Down
21 changes: 11 additions & 10 deletions cpp/src/io/parquet/parquet_gpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ struct PageInfo {
int32_t uncompressed_page_size; // uncompressed data size in bytes
// for V2 pages, the def and rep level data is not compressed, and lacks the 4-byte length
// indicator. instead the lengths for these are stored in the header.
int32_t lvl_bytes[level_type::NUM_LEVEL_TYPES]; // length of the rep/def levels (V2 header)
int32_t // NOLINT
lvl_bytes[level_type::NUM_LEVEL_TYPES]; // length of the rep/def levels (V2 header)
// Number of values in this data page or dictionary.
// Important : the # of input values does not necessarily
// correspond to the number of rows in the output. It just reflects the number
Expand Down Expand Up @@ -345,7 +346,7 @@ struct PageInfo {
PageNestingDecodeInfo* nesting_decode;

// level decode buffers
uint8_t* lvl_decode_buf[level_type::NUM_LEVEL_TYPES];
uint8_t* lvl_decode_buf[level_type::NUM_LEVEL_TYPES]; // NOLINT

// temporary space for decoding DELTA_BYTE_ARRAY encoded strings
int64_t temp_string_size;
Expand Down Expand Up @@ -431,14 +432,14 @@ struct ColumnChunkDesc {
size_t num_values{}; // total number of values in this column
size_t start_row{}; // file-wide, absolute starting row of this chunk
uint32_t num_rows{}; // number of rows in this chunk
int16_t max_level[level_type::NUM_LEVEL_TYPES]{}; // max definition/repetition level
int16_t max_nesting_depth{}; // max nesting depth of the output
int32_t type_length{}; // type length from schema (for FLBA only)
Type physical_type{}; // parquet physical data type
uint8_t
level_bits[level_type::NUM_LEVEL_TYPES]{}; // bits to encode max definition/repetition levels
int32_t num_data_pages{}; // number of data pages
int32_t num_dict_pages{}; // number of dictionary pages
int16_t max_level[level_type::NUM_LEVEL_TYPES]{}; // max definition/repetition level // NOLINT
int16_t max_nesting_depth{}; // max nesting depth of the output
int32_t type_length{}; // type length from schema (for FLBA only)
Type physical_type{}; // parquet physical data type
uint8_t level_bits[level_type::NUM_LEVEL_TYPES]{}; // bits to encode max // NOLINT
// definition/repetition levels
int32_t num_data_pages{}; // number of data pages
int32_t num_dict_pages{}; // number of dictionary pages
PageInfo const* dict_page{};
string_index_pair* str_dict_index{}; // index for string dictionary
bitmask_type** valid_map_base{}; // base pointers of valid bit map for this column
Expand Down
4 changes: 1 addition & 3 deletions cpp/src/jit/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
#include <cudf/utilities/error.hpp>

#include <algorithm>
#include <cctype>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>

namespace cudf {
namespace jit {
constexpr char percent_escape[] = "_";
constexpr char percent_escape[] = "_"; // NOLINT

inline bool is_white(char const c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/strings/regex/regcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace strings {
namespace detail {
namespace {
// Bitmask of all operators
#define OPERATOR_MASK 0200
enum { OPERATOR_MASK = 0200 };
enum OperatorType : int32_t {
START = 0200, // Start, used for marker on stack
LBRA_NC = 0203, // non-capturing group
Expand All @@ -50,7 +50,7 @@ enum OperatorType : int32_t {
COUNTED_LAZY = 0215,
NOP = 0302, // No operation, internal use only
};
#define ITEM_MASK 0300
enum { ITEM_MASK = 0300 };

static reclass cclass_w(CCLASS_W); // \w
static reclass cclass_s(CCLASS_S); // \s
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/utilities/stream_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class rmm_cuda_stream_pool : public cuda_stream_pool {
return streams;
}

std::size_t get_stream_pool_size() const override { return STREAM_POOL_SIZE; }
[[nodiscard]] std::size_t get_stream_pool_size() const override { return STREAM_POOL_SIZE; }
};

/**
Expand Down

0 comments on commit afe9f92

Please sign in to comment.