Fix build with clang-19

This commit is contained in:
Konstantin Bogdanov 2024-10-05 14:47:23 +02:00
parent 69a0c123c2
commit f0ae77edb0
No known key found for this signature in database
34 changed files with 34 additions and 36 deletions

2
contrib/grpc vendored

@ -1 +1 @@
Subproject commit 7bc3abe952aba1dc7bce7f2f790dc781cb51a41e
Subproject commit 62e871c36fa93c0af939bd31762845265214fe3d

2
contrib/libdivide vendored

@ -1 +1 @@
Subproject commit 3bd34388573681ce563348cdf04fe15d24770d04
Subproject commit cbb7b3f4270707df17bfa1d03e32644020307322

2
contrib/simdjson vendored

@ -1 +1 @@
Subproject commit 6060be2fdf62edf4a8f51a8b0883d57d09397b30
Subproject commit e341c8b43861b43de29c48ab65f292d997096953

View File

@ -774,7 +774,7 @@ bool Client::processWithFuzzing(const String & full_query)
else
this_query_runs = 1;
}
else if (const auto * insert = orig_ast->as<ASTInsertQuery>())
else if (const auto * /*insert*/ _ = orig_ast->as<ASTInsertQuery>())
{
this_query_runs = 1;
queries_for_fuzzed_tables = fuzzer.getInsertQueriesForFuzzedTables(full_query);

View File

@ -336,7 +336,7 @@ ASTPtr IQueryTreeNode::toAST(const ConvertToASTOptions & options) const
{
auto converted_node = toASTImpl(options);
if (auto * ast_with_alias = dynamic_cast<ASTWithAlias *>(converted_node.get()))
if (auto * /*ast_with_alias*/ _ = dynamic_cast<ASTWithAlias *>(converted_node.get()))
converted_node->setAlias(alias);
return converted_node;

View File

@ -285,7 +285,7 @@ public:
return;
}
if (const auto * join_node = node->as<JoinNode>())
if (const auto * /*join_node*/ _ = node->as<JoinNode>())
{
can_wrap_result_columns_with_nullable |= getContext()->getSettingsRef()[Setting::join_use_nulls];
return;

View File

@ -77,7 +77,7 @@ public:
for (size_t i = 0; i < function->getArguments().getNodes().size(); i++)
{
if (const auto * func = function->getArguments().getNodes()[i]->as<FunctionNode>())
if (const auto * /*func*/ _ = function->getArguments().getNodes()[i]->as<FunctionNode>())
{
func_id = i;
break;

View File

@ -676,7 +676,7 @@ QueryTreeNodePtr QueryTreeBuilder::buildExpression(const ASTPtr & expression, co
result = std::move(query_node);
}
else if (const auto * select_with_union_query = expression->as<ASTSelectWithUnionQuery>())
else if (const auto * /*select_with_union_query*/ _ = expression->as<ASTSelectWithUnionQuery>())
{
auto query_node = buildSelectWithUnionExpression(expression, false /*is_subquery*/, {} /*cte_name*/, context);
result = std::move(query_node);

View File

@ -1949,7 +1949,7 @@ QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::resolveUnqualifiedMatcher(
{
bool table_expression_in_resolve_process = nearest_query_scope->table_expressions_in_resolve_process.contains(table_expression.get());
if (auto * array_join_node = table_expression->as<ArrayJoinNode>())
if (auto * /*array_join_node*/ _ = table_expression->as<ArrayJoinNode>())
{
if (table_expressions_column_nodes_with_names_stack.empty())
throw Exception(ErrorCodes::LOGICAL_ERROR,

View File

@ -45,7 +45,7 @@ public:
bool needChildVisit(const QueryTreeNodePtr &, const QueryTreeNodePtr & child)
{
if (auto * lambda_node = child->as<LambdaNode>())
if (auto * /*lambda_node*/ _ = child->as<LambdaNode>())
{
updateAliasesIfNeeded(child, true /*is_lambda_node*/);
return false;

View File

@ -1005,7 +1005,7 @@ void QueryFuzzer::fuzzExpressionList(ASTExpressionList & expr_list)
{
for (auto & child : expr_list.children)
{
if (auto * literal = typeid_cast<ASTLiteral *>(child.get()))
if (auto * /*literal*/ _ = typeid_cast<ASTLiteral *>(child.get()))
{
if (fuzz_rand() % 13 == 0)
child = fuzzLiteralUnderExpressionList(child);

View File

@ -52,7 +52,7 @@ public:
{
if (!ISchedulerNode::equals(other))
return false;
if (auto * o = dynamic_cast<FairPolicy *>(other))
if (auto * _ = dynamic_cast<FairPolicy *>(other))
return true;
return false;
}

View File

@ -34,7 +34,7 @@ public:
{
if (!ISchedulerNode::equals(other))
return false;
if (auto * o = dynamic_cast<FifoQueue *>(other))
if (auto * _ = dynamic_cast<FifoQueue *>(other))
return true;
return false;
}

View File

@ -43,7 +43,7 @@ public:
{
if (!ISchedulerNode::equals(other))
return false;
if (auto * o = dynamic_cast<PriorityPolicy *>(other))
if (auto * _ = dynamic_cast<PriorityPolicy *>(other))
return true;
return false;
}

View File

@ -99,7 +99,7 @@ public:
{
if (!ISchedulerNode::equals(other))
return false;
if (auto * o = dynamic_cast<SchedulerRoot *>(other))
if (auto * _ = dynamic_cast<SchedulerRoot *>(other))
return true;
return false;
}

View File

@ -294,7 +294,7 @@ void SerializationObjectDeprecated<Parser>::serializeBinaryBulkWithMultipleStrea
}
settings.path.push_back(Substream::DeprecatedObjectData);
if (auto * stream = settings.getter(settings.path))
if (auto * /*stream*/ _ = settings.getter(settings.path))
{
state_object->nested_serialization->serializeBinaryBulkWithMultipleStreams(
*tuple_column, offset, limit, settings, state_object->nested_state);

View File

@ -585,7 +585,7 @@ private:
template <typename GetContainerFunc>
void getAttributeContainer(size_t attribute_index, GetContainerFunc && func) const
{
return const_cast<std::decay_t<decltype(*this)> *>(this)->template getAttributeContainer(attribute_index, std::forward<GetContainerFunc>(func));
return const_cast<std::decay_t<decltype(*this)> *>(this)->getAttributeContainer(attribute_index, std::forward<GetContainerFunc>(func));
}
template<typename ValueType>

View File

@ -978,7 +978,7 @@ namespace
if (settings.try_infer_integers)
{
/// If we read from String, we can do it in a more efficient way.
if (auto * string_buf = dynamic_cast<ReadBufferFromString *>(&buf))
if (auto * /*string_buf*/ _ = dynamic_cast<ReadBufferFromString *>(&buf))
{
/// Remember the pointer to the start of the number to rollback to it.
/// We can safely get back to the start of the number, because we read from a string and we didn't reach eof.

View File

@ -141,7 +141,7 @@ public:
ColumnString::Offsets & res_offsets = col_res->getOffsets();
ColumnString::Chars & res_chars = col_res->getChars();
if (const ColumnConst * col_num_const = checkAndGetColumn<ColumnConst>(col_num.get()))
if (const ColumnConst * /*col_num_const*/ _ = checkAndGetColumn<ColumnConst>(col_num.get()))
{
if ((executeConstant<DataTypeUInt8>(col_num, res_offsets, res_chars, input_rows_count))
|| (executeConstant<DataTypeUInt16>(col_num, res_offsets, res_chars, input_rows_count))

View File

@ -37,7 +37,7 @@ struct WindowExpressionsCollectorMatcher
}
// We process every expression manually
if (auto * func = node->as<ASTFunction>())
if (auto * /*func*/ _ = node->as<ASTFunction>())
return false;
return true;

View File

@ -127,7 +127,7 @@ void OptimizeDateOrDateTimeConverterWithPreimageMatcher::visit(const ASTFunction
size_t func_id = function.arguments->children.size();
for (size_t i = 0; i < function.arguments->children.size(); i++)
if (const auto * func = function.arguments->children[i]->as<ASTFunction>())
if (const auto * /*func*/ _ = function.arguments->children[i]->as<ASTFunction>())
func_id = i;
if (func_id == function.arguments->children.size())

View File

@ -102,7 +102,7 @@ void RewriteArrayExistsFunctionMatcher::visit(const ASTFunction & func, ASTPtr &
bool RewriteArrayExistsFunctionMatcher::needChildVisit(const ASTPtr & ast, const ASTPtr &)
{
/// Children of ASTTableJoin are handled separately in visit() function
if (auto * join = ast->as<ASTTableJoin>())
if (auto * /*join*/ _ = ast->as<ASTTableJoin>())
return false;
return true;

View File

@ -603,7 +603,7 @@ void TransactionLog::assertTIDIsNotOutdated(const TransactionID & tid, const std
/// If the second case takes place transaction's commit csn has to be set.
/// We should load CSN again to distinguish the second case.
if (failback_with_strict_load_csn)
if (CSN maybe_csn = failback_with_strict_load_csn->load())
if (CSN _ = failback_with_strict_load_csn->load())
return;
throw Exception(ErrorCodes::LOGICAL_ERROR, "Trying to get CSN for too old TID {}, current tail_ptr is {}, probably it's a bug", tid, tail);

View File

@ -61,7 +61,7 @@ void ASTSelectWithUnionQuery::formatQueryImpl(const FormatSettings & settings, F
<< mode_to_str((is_normalized) ? union_mode : list_of_modes[it - list_of_selects->children.begin() - 1])
<< (settings.hilite ? hilite_none : "");
if (auto * node = (*it)->as<ASTSelectWithUnionQuery>())
if (auto * /*node*/ _ = (*it)->as<ASTSelectWithUnionQuery>())
{
if (it != list_of_selects->children.begin())
settings.ostr << settings.nl_or_ws;

View File

@ -825,7 +825,7 @@ void addWithFillStepIfNeeded(QueryPlan & query_plan,
///
/// However, INPUT `s` does not exist. Instead, we have a constant with execution name 'Hello'_String.
/// To fix this, we prepend a rename : 'Hello'_String -> s
if (const auto * constant_node = interpolate_node_typed.getExpression()->as<const ConstantNode>())
if (const auto * /*constant_node*/ _ = interpolate_node_typed.getExpression()->as<const ConstantNode>())
{
const auto * node = &rename_dag.addInput(alias_node->result_name, alias_node->result_type);
node = &rename_dag.addAlias(*node, interpolate_node_typed.getExpressionName());

View File

@ -144,7 +144,7 @@ ASTPtr queryNodeToSelectQuery(const QueryTreeNodePtr & query_node)
while (true)
{
if (auto * select_query = result_ast->as<ASTSelectQuery>())
if (auto * /*select_query*/ _ = result_ast->as<ASTSelectQuery>())
break;
else if (auto * select_with_union = result_ast->as<ASTSelectWithUnionQuery>())
result_ast = select_with_union->list_of_selects->children.at(0);

View File

@ -137,7 +137,7 @@ SortingProperty applyOrder(QueryPlan::Node * parent, SortingProperty * propertie
return std::move(*properties);
}
if (auto * union_step = typeid_cast<UnionStep *>(parent->step.get()))
if (auto * /*union_step*/ _ = typeid_cast<UnionStep *>(parent->step.get()))
{
SortDescription common_sort_description = std::move(properties->sort_description);
auto sort_scope = properties->sort_scope;

View File

@ -91,7 +91,7 @@ using StepStack = std::vector<IQueryPlanStep*>;
QueryPlan::Node * findReadingStep(QueryPlan::Node & node, bool allow_existing_order)
{
IQueryPlanStep * step = node.step.get();
if (auto * reading = checkSupportedReadingStep(step, allow_existing_order))
if (auto * /*reading*/ _ = checkSupportedReadingStep(step, allow_existing_order))
return &node;
if (node.children.size() != 1)

View File

@ -552,7 +552,7 @@ AggregateProjectionCandidates getAggregateProjectionCandidates(
static QueryPlan::Node * findReadingStep(QueryPlan::Node & node)
{
IQueryPlanStep * step = node.step.get();
if (auto * reading = typeid_cast<ReadFromMergeTree *>(step))
if (auto * /*reading*/ _ = typeid_cast<ReadFromMergeTree *>(step))
return &node;
if (node.children.size() != 1)

View File

@ -194,7 +194,7 @@ size_t tryAggregatePartitionsIndependently(QueryPlan::Node * node, QueryPlan::No
auto * maybe_reading_step = expression_node->children.front()->step.get();
if (const auto * filter = typeid_cast<const FilterStep *>(maybe_reading_step))
if (const auto * /*filter*/ _ = typeid_cast<const FilterStep *>(maybe_reading_step))
{
const auto * filter_node = expression_node->children.front();
if (filter_node->children.size() != 1 || !filter_node->children.front()->step)

View File

@ -607,7 +607,7 @@ bool ColumnsDescription::hasSubcolumn(const String & column_name) const
auto it = columns.get<1>().find(ordinary_column_name);
if (it != columns.get<1>().end() && it->type->hasDynamicSubcolumns())
{
if (auto dynamic_subcolumn_type = it->type->tryGetSubcolumnType(dynamic_subcolumn_name))
if (auto /*dynamic_subcolumn_type*/ _ = it->type->tryGetSubcolumnType(dynamic_subcolumn_name))
return true;
}
@ -811,7 +811,7 @@ bool ColumnsDescription::hasColumnOrSubcolumn(GetColumnsOptions::Kind kind, cons
it = columns.get<1>().find(ordinary_column_name);
if (it != columns.get<1>().end() && it->type->hasDynamicSubcolumns())
{
if (auto dynamic_subcolumn_type = it->type->hasSubcolumn(dynamic_subcolumn_name))
if (auto /*dynamic_subcolumn_type*/ _ = it->type->hasSubcolumn(dynamic_subcolumn_name))
return true;
}

View File

@ -7047,7 +7047,7 @@ Block MergeTreeData::getMinMaxCountProjectionBlock(
size_t align_of_state = func->alignOfData();
auto * place = arena.alignedAlloc(size_of_state, align_of_state);
func->create(place);
if (const AggregateFunctionCount * agg_count = typeid_cast<const AggregateFunctionCount *>(func.get()))
if (const AggregateFunctionCount * /*agg_count*/ _ = typeid_cast<const AggregateFunctionCount *>(func.get()))
AggregateFunctionCount::set(place, value.safeGet<UInt64>());
else
{

View File

@ -51,5 +51,3 @@ target_link_libraries(clickhouse_storages_system PRIVATE
clickhouse_parsers
Poco::JSON
)
target_include_directories(clickhouse_storages_system PRIVATE InformationSchema)

View File

@ -71,7 +71,7 @@ namespace DB
loop_table_name = id_name;
}
}
else if (const auto * func = args[0]->as<ASTFunction>())
else if (const auto * /*func*/ _ = args[0]->as<ASTFunction>())
{
inner_table_function_ast = args[0];
}