fix build fail with gcc --fix warnings without disabling some parameters

This commit is contained in:
zhanghuajie 2022-03-09 22:46:54 +08:00
parent 11dde7c127
commit 53a8987b3b
12 changed files with 32 additions and 27 deletions

View File

@ -145,14 +145,11 @@ elseif (COMPILER_GCC)
# Warn about anything that depends on the size of a function type or of void
add_cxx_compile_options(-Wpointer-arith)
# Warn if anything is declared more than once in the same scope
# add_cxx_compile_options(-Wredundant-decls)
add_cxx_compile_options(-Wredundant-decls)
# Member initialization reordering
add_cxx_compile_options(-Wreorder)
# Obvious
# add_cxx_compile_options(-Wshadow)
add_cxx_compile_options(-Wno-redundant-move)
add_cxx_compile_options(-Wshadow)
# Warn if left shifting a negative value
add_cxx_compile_options(-Wshift-negative-value)
# Warn about a definition of an unsized deallocation function

View File

@ -4,12 +4,21 @@
extern "C" {
#endif
#if !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
#include <jemalloc/jemalloc_defs.h>
#include <jemalloc/jemalloc_rename.h>
#include <jemalloc/jemalloc_macros.h>
#include <jemalloc/jemalloc_protos.h>
#include <jemalloc/jemalloc_typedefs.h>
#if !defined(__clang__)
#pragma GCC diagnostic pop
#endif
#ifdef __cplusplus
}
#endif

View File

@ -194,7 +194,7 @@ StoragePtr DatabasePostgreSQL::fetchTable(const String & table_name, ContextPtr,
if (cache_tables)
cached_tables[table_name] = storage;
return std::move(storage);
return storage;
}
if (table_checked || checkPostgresTable(table_name))
@ -414,7 +414,7 @@ ASTPtr DatabasePostgreSQL::getCreateTableQueryImpl(const String & table_name, Co
assert(storage_engine_arguments->children.size() >= 2);
storage_engine_arguments->children.insert(storage_engine_arguments->children.begin() + 2, std::make_shared<ASTLiteral>(table_id.table_name));
return std::move(create_table_query);
return create_table_query;
}

View File

@ -5,7 +5,7 @@ namespace DB
enum class MsgPackExtensionTypes
{
UUID = 0x02,
UUIDType = 0x02,
};
}

View File

@ -55,9 +55,9 @@ void JSONCompactEachRowRowOutputFormat::writeRowEndDelimiter()
void JSONCompactEachRowRowOutputFormat::writeTotals(const Columns & columns, size_t row_num)
{
writeChar('\n', out);
size_t num_columns = columns.size();
size_t columns_size = columns.size();
writeRowStartDelimiter();
for (size_t i = 0; i < num_columns; ++i)
for (size_t i = 0; i < columns_size; ++i)
{
if (i != 0)
writeFieldDelimiter();

View File

@ -154,9 +154,9 @@ void JSONRowOutputFormat::writeBeforeTotals()
void JSONRowOutputFormat::writeTotals(const Columns & columns, size_t row_num)
{
size_t num_columns = columns.size();
size_t columns_size = columns.size()
for (size_t i = 0; i < num_columns; ++i)
for (size_t i = 0; i < columns_size; ++i)
{
if (i != 0)
writeTotalsFieldDelimiter();

View File

@ -353,7 +353,7 @@ bool MsgPackVisitor::visit_nil()
bool MsgPackVisitor::visit_ext(const char * value, uint32_t size)
{
int8_t type = *value;
if (*value == int8_t(MsgPackExtensionTypes::UUID))
if (*value == int8_t(MsgPackExtensionTypes::UUIDType))
{
insertUUID(info_stack.top().column, info_stack.top().type, value + 1, size - 1);
return true;
@ -496,13 +496,12 @@ DataTypePtr MsgPackSchemaReader::getDataType(const msgpack::object & object)
case msgpack::type::object_type::EXT:
{
msgpack::object_ext object_ext = object.via.ext;
if (object_ext.type() == int8_t(MsgPackExtensionTypes::UUID))
if (object_ext.type() == int8_t(MsgPackExtensionTypes::UUIDType))
return std::make_shared<DataTypeUUID>();
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Msgpack extension type {%x} is not supported", object_ext.type());
}
default:
return nullptr;
}
__builtin_unreachable();
}
DataTypes MsgPackSchemaReader::readRowAndGetDataTypes()

View File

@ -199,7 +199,7 @@ void MsgPackRowOutputFormat::serializeField(const IColumn & column, DataTypePtr
writeBinaryBigEndian(value.toUnderType().items[0], buf);
writeBinaryBigEndian(value.toUnderType().items[1], buf);
StringRef uuid_ext = buf.stringRef();
packer.pack_ext(sizeof(UUID), int8_t(MsgPackExtensionTypes::UUID));
packer.pack_ext(sizeof(UUID), int8_t(MsgPackExtensionTypes::UUIDType));
packer.pack_ext_body(uuid_ext.data, uuid_ext.size);
return;
}
@ -213,8 +213,8 @@ void MsgPackRowOutputFormat::serializeField(const IColumn & column, DataTypePtr
void MsgPackRowOutputFormat::write(const Columns & columns, size_t row_num)
{
size_t num_columns = columns.size();
for (size_t i = 0; i < num_columns; ++i)
size_t columns_size = columns.size();
for (size_t i = 0; i < columns_size; ++i)
{
serializeField(*columns[i], types[i], row_num);
}

View File

@ -141,7 +141,7 @@ void VerticalRowOutputFormat::writeSpecialRow(const Columns & columns, size_t ro
row_number = 0;
field_number = 0;
size_t num_columns = columns.size();
size_t columns_size = columns.size();
writeCString(title, out);
writeCString(":\n", out);
@ -151,7 +151,7 @@ void VerticalRowOutputFormat::writeSpecialRow(const Columns & columns, size_t ro
writeCString("", out);
writeChar('\n', out);
for (size_t i = 0; i < num_columns; ++i)
for (size_t i = 0; i < columns_size; ++i)
writeField(*columns[i], *serializations[i], row_num);
}

View File

@ -352,7 +352,7 @@ ASTPtr StorageMaterializedPostgreSQL::getColumnDeclaration(const DataTypePtr & d
ast_expression->name = "DateTime64";
ast_expression->arguments = std::make_shared<ASTExpressionList>();
ast_expression->arguments->children.emplace_back(std::make_shared<ASTLiteral>(UInt32(6)));
return std::move(ast_expression);
return ast_expression;
}
return std::make_shared<ASTIdentifier>(data_type->getName());
@ -511,7 +511,7 @@ ASTPtr StorageMaterializedPostgreSQL::getCreateNestedTableQuery(
storage_metadata.setConstraints(constraints);
setInMemoryMetadata(storage_metadata);
return std::move(create_table_query);
return create_table_query;
}

View File

@ -7149,9 +7149,9 @@ void StorageReplicatedMergeTree::createTableSharedID()
if (!zookeeper->tryGet(zookeeper_table_id_path, id))
{
UUID table_id_candidate;
auto storage_id = getStorageID();
if (storage_id.uuid != UUIDHelpers::Nil)
table_id_candidate = storage_id.uuid;
auto local_storage_id = getStorageID();
if (local_storage_id.uuid != UUIDHelpers::Nil)
table_id_candidate = local_storage_id.uuid;
else
table_id_candidate = UUIDHelpers::generateV4();

View File

@ -17,7 +17,7 @@ target_include_directories(
${ClickHouse_SOURCE_DIR}/contrib/double-conversion ${ClickHouse_SOURCE_DIR}/contrib/dragonbox/include
${ClickHouse_SOURCE_DIR}/contrib/fmtlib/include
${ClickHouse_SOURCE_DIR}/contrib/cityhash102/include
${RE2_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/contrib/re2-cmake/re2_st
${RE2_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/contrib/re2-cmake
)
target_compile_definitions(graphite-rollup-bench PRIVATE RULES_DIR="${CMAKE_CURRENT_SOURCE_DIR}")