Skip to content

Commit

Permalink
tidy: enable misc-unused-parameters
Browse files Browse the repository at this point in the history
About half of this was done by hand, and about half with an automated
tool.
  • Loading branch information
Riolku committed Oct 24, 2023
1 parent 84018c4 commit ecf1dd2
Show file tree
Hide file tree
Showing 158 changed files with 452 additions and 398 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ Checks:

concurrency-*,

misc-unused-parameters,

HeaderFilterRegex: src/include|tools/benchmark/include|tools/nodejs_api/src_cpp/include|tools/python_api/src_cpp/include|tools/rust_api/include|tools/shell/include
WarningsAsErrors: "*"
22 changes: 11 additions & 11 deletions src/common/arrow/arrow_row_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ ArrowRowBatch::ArrowRowBatch(
// TODO(Ziyi): use physical type instead of logical type here.
template<LogicalTypeID DT>
void ArrowRowBatch::templateInitializeVector(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, std::int64_t capacity) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, std::int64_t capacity) {
initializeNullBits(vector->validity, capacity);
vector->data.reserve(storage::StorageUtils::getDataTypeSize(LogicalType{DT}) * capacity);
}

template<>
void ArrowRowBatch::templateInitializeVector<LogicalTypeID::BOOL>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, std::int64_t capacity) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, std::int64_t capacity) {
initializeNullBits(vector->validity, capacity);
vector->data.reserve(getNumBytesForBits(capacity));
}

template<>
void ArrowRowBatch::templateInitializeVector<LogicalTypeID::STRING>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, std::int64_t capacity) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, std::int64_t capacity) {
initializeNullBits(vector->validity, capacity);
// Initialize offsets and string values buffer.
vector->data.reserve((capacity + 1) * sizeof(std::uint32_t));
Expand Down Expand Up @@ -164,14 +164,14 @@ void ArrowRowBatch::appendValue(

template<LogicalTypeID DT>
void ArrowRowBatch::templateCopyNonNullValue(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, Value* value, std::int64_t pos) {
auto valSize = storage::StorageUtils::getDataTypeSize(LogicalType{DT});
std::memcpy(vector->data.data() + pos * valSize, &value->val, valSize);
}

template<>
void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::BOOL>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, Value* value, std::int64_t pos) {
if (value->val.booleanVal) {
setBitToOne(vector->data.data(), pos);
} else {
Expand All @@ -181,7 +181,7 @@ void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::BOOL>(

template<>
void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::STRING>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& /*typeInfo*/, Value* value, std::int64_t pos) {
auto offsets = (std::uint32_t*)vector->data.data();
auto strLength = value->strVal.length();
offsets[pos + 1] = offsets[pos] + strLength;
Expand Down Expand Up @@ -217,7 +217,7 @@ void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::VAR_LIST>(

template<>
void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::INTERNAL_ID>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t /*pos*/) {
auto nodeID = value->getValue<nodeID_t>();
Value offsetVal((std::int64_t)nodeID.offset);
Value tableIDVal((std::int64_t)nodeID.tableID);
Expand All @@ -227,7 +227,7 @@ void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::INTERNAL_ID>(

template<>
void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::NODE>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t /*pos*/) {
appendValue(
vector->childData[0].get(), *typeInfo.childrenTypesInfo[0], NodeVal::getNodeIDVal(value));
appendValue(
Expand All @@ -245,7 +245,7 @@ void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::NODE>(

template<>
void ArrowRowBatch::templateCopyNonNullValue<LogicalTypeID::REL>(
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t pos) {
ArrowVector* vector, const main::DataTypeInfo& typeInfo, Value* value, std::int64_t /*pos*/) {
appendValue(
vector->childData[0].get(), *typeInfo.childrenTypesInfo[0], RelVal::getSrcNodeIDVal(value));
appendValue(
Expand Down Expand Up @@ -412,15 +412,15 @@ static std::unique_ptr<ArrowArray> createArrayFromVector(ArrowVector& vector) {

template<LogicalTypeID DT>
ArrowArray* ArrowRowBatch::templateCreateArray(
ArrowVector& vector, const main::DataTypeInfo& typeInfo) {
ArrowVector& vector, const main::DataTypeInfo& /*typeInfo*/) {
auto result = createArrayFromVector(vector);
vector.array = std::move(result);
return vector.array.get();
}

template<>
ArrowArray* ArrowRowBatch::templateCreateArray<LogicalTypeID::STRING>(
ArrowVector& vector, const main::DataTypeInfo& typeInfo) {
ArrowVector& vector, const main::DataTypeInfo& /*typeInfo*/) {
auto result = createArrayFromVector(vector);
result->n_buffers = 3;
result->buffers[2] = vector.overflow.data();
Expand Down
3 changes: 1 addition & 2 deletions src/common/string_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
namespace kuzu {
namespace common {

std::vector<std::string> StringUtils::splitComma(
const std::string& input, bool ignoreEmptyStringParts) {
std::vector<std::string> StringUtils::splitComma(const std::string& input) {
auto result = std::vector<std::string>();
auto currentPos = 0u;
auto lvl = 0u;
Expand Down
12 changes: 6 additions & 6 deletions src/common/type_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,32 @@ std::string TypeUtils::castValueToString(
}

template<>
std::string TypeUtils::toString(const bool& val, void* valueVector) {
std::string TypeUtils::toString(const bool& val, void* /*valueVector*/) {
return val ? "True" : "False";
}

template<>
std::string TypeUtils::toString(const internalID_t& val, void* valueVector) {
std::string TypeUtils::toString(const internalID_t& val, void* /*valueVector*/) {
return std::to_string(val.tableID) + ":" + std::to_string(val.offset);
}

template<>
std::string TypeUtils::toString(const date_t& val, void* valueVector) {
std::string TypeUtils::toString(const date_t& val, void* /*valueVector*/) {
return Date::toString(val);
}

template<>
std::string TypeUtils::toString(const timestamp_t& val, void* valueVector) {
std::string TypeUtils::toString(const timestamp_t& val, void* /*valueVector*/) {
return Timestamp::toString(val);
}

template<>
std::string TypeUtils::toString(const interval_t& val, void* valueVector) {
std::string TypeUtils::toString(const interval_t& val, void* /*valueVector*/) {
return Interval::toString(val);
}

template<>
std::string TypeUtils::toString(const ku_string_t& val, void* valueVector) {
std::string TypeUtils::toString(const ku_string_t& val, void* /*valueVector*/) {
return val.getAsString();
}

Expand Down
2 changes: 1 addition & 1 deletion src/expression_evaluator/case_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ std::unique_ptr<ExpressionEvaluator> CaseExpressionEvaluator::clone() {
}

void CaseExpressionEvaluator::resolveResultVector(
const ResultSet& resultSet, MemoryManager* memoryManager) {
const ResultSet& /*resultSet*/, MemoryManager* memoryManager) {
resultVector = std::make_shared<ValueVector>(expression->dataType, memoryManager);
std::vector<ExpressionEvaluator*> inputEvaluators;
for (auto& alternative : alternativeEvaluators) {
Expand Down
2 changes: 1 addition & 1 deletion src/expression_evaluator/function_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::unique_ptr<ExpressionEvaluator> FunctionExpressionEvaluator::clone() {
}

void FunctionExpressionEvaluator::resolveResultVector(
const ResultSet& resultSet, MemoryManager* memoryManager) {
const ResultSet& /*resultSet*/, MemoryManager* memoryManager) {
resultVector = std::make_shared<ValueVector>(expression->dataType, memoryManager);
std::vector<ExpressionEvaluator*> inputEvaluators;
inputEvaluators.reserve(children.size());
Expand Down
4 changes: 2 additions & 2 deletions src/expression_evaluator/literal_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ using namespace kuzu::storage;
namespace kuzu {
namespace evaluator {

bool LiteralExpressionEvaluator::select(SelectionVector& selVector) {
bool LiteralExpressionEvaluator::select(SelectionVector& /*selVector*/) {
assert(resultVector->dataType.getLogicalTypeID() == LogicalTypeID::BOOL);
auto pos = resultVector->state->selVector->selectedPositions[0];
assert(pos == 0u);
return resultVector->getValue<bool>(pos) && (!resultVector->isNull(pos));
}

void LiteralExpressionEvaluator::resolveResultVector(
const processor::ResultSet& resultSet, MemoryManager* memoryManager) {
const processor::ResultSet& /*resultSet*/, MemoryManager* memoryManager) {
resultVector = std::make_shared<ValueVector>(*value->getDataType(), memoryManager);
resultVector->setState(DataChunkState::getSingleValueDataChunkState());
if (value->isNull()) {
Expand Down
2 changes: 1 addition & 1 deletion src/expression_evaluator/node_rel_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void NodeRelExpressionEvaluator::evaluate() {
}

void NodeRelExpressionEvaluator::resolveResultVector(
const processor::ResultSet& resultSet, storage::MemoryManager* memoryManager) {
const processor::ResultSet& /*resultSet*/, storage::MemoryManager* memoryManager) {
resultVector = std::make_shared<ValueVector>(nodeOrRel->getDataType(), memoryManager);
std::vector<ExpressionEvaluator*> inputEvaluators;
inputEvaluators.reserve(children.size());
Expand Down
2 changes: 1 addition & 1 deletion src/expression_evaluator/path_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void PathExpressionEvaluator::copyFieldVectors(offset_t inputVectorPos,
}

void PathExpressionEvaluator::resolveResultVector(
const processor::ResultSet& resultSet, storage::MemoryManager* memoryManager) {
const processor::ResultSet& /*resultSet*/, storage::MemoryManager* memoryManager) {
resultVector = std::make_shared<ValueVector>(expression->getDataType(), memoryManager);
std::vector<ExpressionEvaluator*> inputEvaluators;
inputEvaluators.reserve(children.size());
Expand Down
2 changes: 1 addition & 1 deletion src/function/aggregate/count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace kuzu {
namespace function {

void CountFunction::updateAll(
uint8_t* state_, ValueVector* input, uint64_t multiplicity, MemoryManager* memoryManager) {
uint8_t* state_, ValueVector* input, uint64_t multiplicity, MemoryManager* /*memoryManager*/) {
auto state = reinterpret_cast<CountState*>(state_);
if (input->hasNoNullsGuarantee()) {
for (auto i = 0u; i < input->state->selVector->selectedSize; ++i) {
Expand Down
26 changes: 13 additions & 13 deletions src/function/built_in_table_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct CurrentSettingFunction {
return std::make_unique<TableFunctionDefinition>("current_setting", tableFunc, bindFunc);
}

static void tableFunc(std::pair<offset_t, offset_t> morsel, TableFuncBindData* bindData,
static void tableFunc(std::pair<offset_t, offset_t> /*morsel*/, TableFuncBindData* bindData,
std::vector<ValueVector*> outputVectors) {
auto currentSettingBindData = reinterpret_cast<CurrentSettingBindData*>(bindData);
auto outputVector = outputVectors[0];
Expand All @@ -45,8 +45,8 @@ struct CurrentSettingFunction {
outputVector->state->selVector->selectedSize = 1;
}

static std::unique_ptr<TableFuncBindData> bindFunc(
main::ClientContext* context, TableFuncBindInput input, catalog::CatalogContent* catalog) {
static std::unique_ptr<TableFuncBindData> bindFunc(main::ClientContext* context,
TableFuncBindInput input, catalog::CatalogContent* /*catalog*/) {
auto optionName = input.inputs[0].getValue<std::string>();
std::vector<std::string> returnColumnNames;
std::vector<LogicalType> returnTypes;
Expand All @@ -62,17 +62,17 @@ struct DBVersionFunction {
return std::make_unique<TableFunctionDefinition>("db_version", tableFunc, bindFunc);
}

static void tableFunc(std::pair<offset_t, offset_t> morsel,
function::TableFuncBindData* bindData, std::vector<ValueVector*> outputVectors) {
static void tableFunc(std::pair<offset_t, offset_t> /*morsel*/,
function::TableFuncBindData* /*bindData*/, std::vector<ValueVector*> outputVectors) {
auto outputVector = outputVectors[0];
auto pos = outputVector->state->selVector->selectedPositions[0];
outputVectors[0]->setValue(pos, std::string(KUZU_VERSION));
outputVectors[0]->setNull(pos, false);
outputVector->state->selVector->selectedSize = 1;
}

static std::unique_ptr<TableFuncBindData> bindFunc(
main::ClientContext* context, TableFuncBindInput input, catalog::CatalogContent* catalog) {
static std::unique_ptr<TableFuncBindData> bindFunc(main::ClientContext* /*context*/,
TableFuncBindInput /*input*/, catalog::CatalogContent* /*catalog*/) {
std::vector<std::string> returnColumnNames;
std::vector<LogicalType> returnTypes;
returnColumnNames.emplace_back("version");
Expand Down Expand Up @@ -116,8 +116,8 @@ struct ShowTablesFunction {
outputVectors[0]->state->selVector->selectedSize = numTablesToOutput;
}

static std::unique_ptr<TableFuncBindData> bindFunc(
main::ClientContext* context, TableFuncBindInput input, catalog::CatalogContent* catalog) {
static std::unique_ptr<TableFuncBindData> bindFunc(main::ClientContext* /*context*/,
TableFuncBindInput /*input*/, catalog::CatalogContent* catalog) {
std::vector<std::string> returnColumnNames;
std::vector<LogicalType> returnTypes;
returnColumnNames.emplace_back("name");
Expand Down Expand Up @@ -178,8 +178,8 @@ struct TableInfoFunction {
}
}

static std::unique_ptr<TableFuncBindData> bindFunc(
main::ClientContext* context, TableFuncBindInput input, catalog::CatalogContent* catalog) {
static std::unique_ptr<TableFuncBindData> bindFunc(main::ClientContext* /*context*/,
TableFuncBindInput input, catalog::CatalogContent* catalog) {
std::vector<std::string> returnColumnNames;
std::vector<LogicalType> returnTypes;
auto tableName = input.inputs[0].getValue<std::string>();
Expand Down Expand Up @@ -260,8 +260,8 @@ struct ShowConnectionFunction {
}
}

static std::unique_ptr<ShowConnectionBindData> bindFunc(
main::ClientContext* context, TableFuncBindInput input, catalog::CatalogContent* catalog) {
static std::unique_ptr<ShowConnectionBindData> bindFunc(main::ClientContext* /*context*/,
TableFuncBindInput input, catalog::CatalogContent* catalog) {
std::vector<std::string> returnColumnNames;
std::vector<LogicalType> returnTypes;
auto tableName = input.inputs[0].getValue<std::string>();
Expand Down
4 changes: 2 additions & 2 deletions src/function/built_in_vector_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ uint32_t BuiltInVectorFunctions::getFunctionCost(const std::vector<LogicalType>&
}

uint32_t BuiltInVectorFunctions::matchParameters(const std::vector<LogicalType>& inputTypes,
const std::vector<LogicalTypeID>& targetTypeIDs, bool isOverload) {
const std::vector<LogicalTypeID>& targetTypeIDs, bool /*isOverload*/) {
if (inputTypes.size() != targetTypeIDs.size()) {
return UINT32_MAX;
}
Expand All @@ -337,7 +337,7 @@ uint32_t BuiltInVectorFunctions::matchParameters(const std::vector<LogicalType>&
}

uint32_t BuiltInVectorFunctions::matchVarLengthParameters(
const std::vector<LogicalType>& inputTypes, LogicalTypeID targetTypeID, bool isOverload) {
const std::vector<LogicalType>& inputTypes, LogicalTypeID targetTypeID, bool /*isOverload*/) {
auto cost = 0u;
for (auto& inputType : inputTypes) {
auto castCost = getCastCost(inputType.getLogicalTypeID(), targetTypeID);
Expand Down
2 changes: 2 additions & 0 deletions src/function/vector_boolean_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void VectorBooleanFunction::bindBinarySelectFunction(ExpressionType expressionTy
void VectorBooleanFunction::bindUnaryExecFunction(ExpressionType expressionType,
const binder::expression_vector& children, scalar_exec_func& func) {
assert(children.size() == 1 && children[0]->dataType.getLogicalTypeID() == LogicalTypeID::BOOL);
(void)children;
switch (expressionType) {
case NOT: {
func = &UnaryBooleanExecFunction<Not>;
Expand All @@ -96,6 +97,7 @@ void VectorBooleanFunction::bindUnaryExecFunction(ExpressionType expressionType,
void VectorBooleanFunction::bindUnarySelectFunction(ExpressionType expressionType,
const binder::expression_vector& children, scalar_select_func& func) {
assert(children.size() == 1 && children[0]->dataType.getLogicalTypeID() == LogicalTypeID::BOOL);
(void)children;
switch (expressionType) {
case NOT: {
func = &UnaryBooleanSelectFunction<Not>;
Expand Down
8 changes: 4 additions & 4 deletions src/function/vector_list_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void ListCreationVectorFunction::execFunc(
}

std::unique_ptr<FunctionBindData> ListCreationVectorFunction::bindFunc(
const binder::expression_vector& arguments, FunctionDefinition* definition) {
const binder::expression_vector& arguments, FunctionDefinition* /*definition*/) {
// ListCreation requires all parameters to have the same type or be ANY type. The result type of
// listCreation can be determined by the first non-ANY type parameter. If all parameters have
// dataType ANY, then the resultType will be INT64[] (default type).
Expand Down Expand Up @@ -97,7 +97,7 @@ vector_function_definitions ListCreationVectorFunction::getDefinitions() {
}

std::unique_ptr<FunctionBindData> ListRangeVectorFunction::bindFunc(
const binder::expression_vector& arguments, kuzu::function::FunctionDefinition* definition) {
const binder::expression_vector& arguments, FunctionDefinition* /*definition*/) {
assert(arguments[0]->dataType == arguments[1]->dataType);
auto varListTypeInfo = std::make_unique<VarListTypeInfo>(
std::make_unique<LogicalType>(arguments[0]->dataType.getLogicalTypeID()));
Expand Down Expand Up @@ -239,7 +239,7 @@ vector_function_definitions ListConcatVectorFunction::getDefinitions() {
}

std::unique_ptr<FunctionBindData> ListConcatVectorFunction::bindFunc(
const binder::expression_vector& arguments, kuzu::function::FunctionDefinition* definition) {
const binder::expression_vector& arguments, FunctionDefinition* /*definition*/) {
if (arguments[0]->getDataType() != arguments[1]->getDataType()) {
throw BinderException(getListFunctionIncompatibleChildrenTypeErrorMsg(
LIST_CONCAT_FUNC_NAME, arguments[0]->getDataType(), arguments[1]->getDataType()));
Expand Down Expand Up @@ -340,7 +340,7 @@ vector_function_definitions ListSliceVectorFunction::getDefinitions() {
}

std::unique_ptr<FunctionBindData> ListSliceVectorFunction::bindFunc(
const binder::expression_vector& arguments, FunctionDefinition* definition) {
const binder::expression_vector& arguments, FunctionDefinition* /*definition*/) {
return std::make_unique<FunctionBindData>(arguments[0]->getDataType());
}

Expand Down
9 changes: 6 additions & 3 deletions src/function/vector_map_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ vector_function_definitions MapCreationVectorFunctions::getDefinitions() {
}

std::unique_ptr<FunctionBindData> MapCreationVectorFunctions::bindFunc(
const binder::expression_vector& arguments, kuzu::function::FunctionDefinition* definition) {
const binder::expression_vector& arguments,
kuzu::function::FunctionDefinition* /*definition*/) {
auto keyType = VarListType::getChildType(&arguments[0]->dataType);
auto valueType = VarListType::getChildType(&arguments[1]->dataType);
std::vector<std::unique_ptr<StructField>> structFields;
Expand Down Expand Up @@ -77,7 +78,8 @@ vector_function_definitions MapKeysVectorFunctions::getDefinitions() {
}

std::unique_ptr<FunctionBindData> MapKeysVectorFunctions::bindFunc(
const binder::expression_vector& arguments, kuzu::function::FunctionDefinition* definition) {
const binder::expression_vector& arguments,
kuzu::function::FunctionDefinition* /*definition*/) {
auto returnListInfo = std::make_unique<VarListTypeInfo>(
std::make_unique<LogicalType>(*MapType::getKeyType(&arguments[0]->dataType)));
return std::make_unique<FunctionBindData>(
Expand All @@ -95,7 +97,8 @@ vector_function_definitions MapValuesVectorFunctions::getDefinitions() {
}

std::unique_ptr<FunctionBindData> MapValuesVectorFunctions::bindFunc(
const binder::expression_vector& arguments, kuzu::function::FunctionDefinition* definition) {
const binder::expression_vector& arguments,
kuzu::function::FunctionDefinition* /*definition*/) {
auto returnListInfo = std::make_unique<VarListTypeInfo>(
std::make_unique<LogicalType>(*MapType::getValueType(&arguments[0]->dataType)));
return std::make_unique<FunctionBindData>(
Expand Down
Loading

0 comments on commit ecf1dd2

Please sign in to comment.