Fixed warnings on clang [#METR-2807].

This commit is contained in:
Alexey Milovidov 2014-03-10 08:17:17 +04:00
parent 8149d2ced3
commit 8c87b14c7f
12 changed files with 23 additions and 25 deletions

View File

@ -18,7 +18,7 @@ public:
virtual ColumnPtr cloneDummy(size_t s_) const = 0;
ColumnPtr cloneResized(size_t s_) const { return cloneDummy(s_); }
bool isConst() { return true; }
bool isConst() const { return true; }
size_t size() const { return s; }
void insertDefault() { ++s; }
size_t byteSize() const { return 0; }

View File

@ -85,7 +85,7 @@ public:
removeOverflow();
}
void getStats(size_t & out_hits, size_t & out_misses) const volatile
void getStats(size_t & out_hits, size_t & out_misses) const
{
Poco::ScopedLock<Poco::FastMutex> lock(mutex);
/// Синхронизация не нужна.

View File

@ -73,7 +73,7 @@ namespace Protocol
inline const char * toString(UInt64 packet)
{
static const char * data[] = { "Hello", "Data", "Exception", "Progress", "Pong", "EndOfStream", "ProfileInfo", "Totals", "Extremes" };
return packet >= 0 && packet < 9
return packet < 9
? data[packet]
: "Unknown packet";
}
@ -97,7 +97,7 @@ namespace Protocol
inline const char * toString(UInt64 packet)
{
static const char * data[] = { "Hello", "Query", "Data", "Cancel", "Ping" };
return packet >= 0 && packet < 5
return packet < 5
? data[packet]
: "Unknown packet";
}

View File

@ -20,7 +20,7 @@ namespace QueryProcessingStage
inline const char * toString(UInt64 stage)
{
static const char * data[] = { "FetchColumns", "WithMergeableState", "Complete" };
return stage >= 0 && stage < 3
return stage < 3
? data[stage]
: "Unknown stage";
}

View File

@ -51,7 +51,7 @@ public:
session.setPort(port);
/// устанавливаем таймаут
session.setTimeout(Poco::Timespan(timeout_ || DEFAULT_REMOTE_READ_BUFFER_TIMEOUT, 0));
session.setTimeout(Poco::Timespan(timeout_ ? timeout_ : DEFAULT_REMOTE_READ_BUFFER_TIMEOUT, 0));
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uri.str());
Poco::Net::HTTPResponse response;
@ -100,7 +100,7 @@ public:
Poco::Net::HTTPClientSession session;
session.setHost(host);
session.setPort(port);
session.setTimeout(Poco::Timespan(timeout_ || DEFAULT_REMOTE_READ_BUFFER_TIMEOUT, 0));
session.setTimeout(Poco::Timespan(timeout_ ? timeout_ : DEFAULT_REMOTE_READ_BUFFER_TIMEOUT, 0));
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uri.str());
Poco::Net::HTTPResponse response;

View File

@ -417,7 +417,9 @@ public:
size_degree = new_size <= 1
? GrowthTraits::INITIAL_SIZE_DEGREE
: std::max(GrowthTraits::INITIAL_SIZE_DEGREE, static_cast<int>(log2(new_size - 1)) + 2);
: ((GrowthTraits::INITIAL_SIZE_DEGREE > static_cast<int>(log2(new_size - 1)) + 2)
? GrowthTraits::INITIAL_SIZE_DEGREE
: (static_cast<int>(log2(new_size - 1)) + 2));
alloc();
@ -436,7 +438,9 @@ public:
size_t new_size_degree = new_size <= 1
? GrowthTraits::INITIAL_SIZE_DEGREE
: std::max(GrowthTraits::INITIAL_SIZE_DEGREE, static_cast<int>(log2(new_size - 1)) + 2);
: ((GrowthTraits::INITIAL_SIZE_DEGREE > static_cast<int>(log2(new_size - 1)) + 2)
? GrowthTraits::INITIAL_SIZE_DEGREE
: (static_cast<int>(log2(new_size - 1)) + 2));
if (new_size_degree > size_degree)
resize(new_size_degree);

View File

@ -86,7 +86,6 @@ private:
Sizes key_sizes;
UInt128Hash hash_func_128;
StringRefHash hash_func_string;
/// Для более точного контроля max_rows_to_group_by.

View File

@ -25,7 +25,6 @@ public:
const String & remote_database_, /// БД на удалённых серверах.
const String & remote_table_, /// Имя таблицы на удалённых серверах.
const String & cluster_name,
const DataTypeFactory & data_type_factory_,
Context & context_,
const String & sign_column_name_ = "");
@ -35,7 +34,6 @@ public:
const String & remote_database_, /// БД на удалённых серверах.
const String & remote_table_, /// Имя таблицы на удалённых серверах.
SharedPtr<Cluster> & owned_cluster_,
const DataTypeFactory & data_type_factory_,
Context & context_,
const String & sign_column_name_ = "");
@ -75,7 +73,6 @@ private:
const String & remote_database_,
const String & remote_table_,
Cluster & cluster_,
const DataTypeFactory & data_type_factory_,
const Context & context_,
const String & sign_column_name_ = "");
@ -86,7 +83,6 @@ private:
NamesAndTypesListPtr columns;
String remote_database;
String remote_table;
const DataTypeFactory & data_type_factory;
String sign_column_name;
/// Имя виртуального столбца, куда записывается имя хоста (Например "_host").

View File

@ -62,7 +62,7 @@ public:
SharedPtr<Cluster> cluster = new Cluster(context.getSettings(), context.getDataTypeFactory(), names, username, password);
return StorageDistributed::create(getName(), chooseColumns(*cluster, remote_database, remote_table, context),
remote_database, remote_table, cluster, context.getDataTypeFactory(), context);
remote_database, remote_table, cluster, context);
}
private:

View File

@ -17,7 +17,9 @@
#include <statdaemons/Stopwatch.h>
const UInt32 decimal_table[10000] =
#if 0
static const UInt32 decimal_table[10000] =
{
0x30303030,0x31303030,0x32303030,0x33303030,0x34303030,0x35303030,0x36303030,0x37303030,0x38303030,0x39303030,
0x30313030,0x31313030,0x32313030,0x33313030,0x34313030,0x35313030,0x36313030,0x37313030,0x38313030,0x39313030,
@ -1022,7 +1024,7 @@ const UInt32 decimal_table[10000] =
};
const UInt8 length_table[10000] =
static const UInt8 length_table[10000] =
{
3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
@ -1095,7 +1097,6 @@ void writeUIntTextTable(T x, DB::WriteBuffer & buf)
buf.write(data.chars + length_table[x], len - length_table[x]);
}
template <typename T>
void writeIntTextTable(T x, DB::WriteBuffer & buf)
{
@ -1127,6 +1128,8 @@ void writeIntTextTable(T x, DB::WriteBuffer & buf)
writeUIntTextTable(static_cast<typename boost::make_unsigned<T>::type>(x), buf);
}
#endif
UInt64 rdtsc()
{

View File

@ -21,12 +21,10 @@ StorageDistributed::StorageDistributed(
const String & remote_database_,
const String & remote_table_,
Cluster & cluster_,
const DataTypeFactory & data_type_factory_,
const Context & context_,
const String & sign_column_name_)
: name(name_), columns(columns_),
remote_database(remote_database_), remote_table(remote_table_),
data_type_factory(data_type_factory_),
sign_column_name(sign_column_name_),
context(context_),
cluster(cluster_)
@ -45,12 +43,11 @@ StoragePtr StorageDistributed::create(
const String & remote_database_,
const String & remote_table_,
const String & cluster_name,
const DataTypeFactory & data_type_factory_,
Context & context_,
const String & sign_column_name_)
{
context_.initClusters();
return (new StorageDistributed(name_, columns_, remote_database_, remote_table_, context_.getCluster(cluster_name), data_type_factory_, context_, sign_column_name_))->thisPtr();
return (new StorageDistributed(name_, columns_, remote_database_, remote_table_, context_.getCluster(cluster_name), context_, sign_column_name_))->thisPtr();
}
@ -60,11 +57,10 @@ StoragePtr StorageDistributed::create(
const String & remote_database_,
const String & remote_table_,
SharedPtr<Cluster> & owned_cluster_,
const DataTypeFactory & data_type_factory_,
Context & context_,
const String & sign_column_name_)
{
auto res = new StorageDistributed(name_, columns_, remote_database_, remote_table_, *owned_cluster_, data_type_factory_, context_, sign_column_name_);
auto res = new StorageDistributed(name_, columns_, remote_database_, remote_table_, *owned_cluster_, context_, sign_column_name_);
/// Захватываем владение объектом-кластером.
res->owned_cluster = owned_cluster_;

View File

@ -149,7 +149,7 @@ StoragePtr StorageFactory::get(
String sign_column_name = args.size() == 4 ? dynamic_cast<ASTIdentifier &>(*args[3]).name : "";
return StorageDistributed::create(table_name, columns, remote_database, remote_table, cluster_name,
context.getDataTypeFactory(), context, sign_column_name);
context, sign_column_name);
}
else if (name == "MergeTree" || name == "SummingMergeTree")
{