You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
MCOL-537, cleanup compiler warnings. Checkpointing a bunch of fixes.
Work in progress...
This commit is contained in:
committed by
Roman Nozdrin
parent
f4f053dd8c
commit
cbbf267e88
@@ -90,6 +90,8 @@ namespace
|
||||
{
|
||||
short DSPort = 9199;
|
||||
|
||||
// this isn't currently used but could be in the future.
|
||||
#if 0
|
||||
void log(const string& s)
|
||||
{
|
||||
logging::MessageLog logger((logging::LoggingID()));
|
||||
@@ -100,6 +102,7 @@ void log(const string& s)
|
||||
message.format(args);
|
||||
logger.logErrorMessage(message);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ScopedCleaner
|
||||
{
|
||||
|
@@ -83,19 +83,6 @@ bool from_string(T& t, const std::string& s, std::ios_base & (*f)(std::ios_base&
|
||||
return !(iss >> f >> t).fail();
|
||||
}
|
||||
|
||||
uint64_t pow10_(int32_t scale)
|
||||
{
|
||||
if (scale <= 0) return 1;
|
||||
|
||||
idbassert(scale < 20);
|
||||
uint64_t res = 1;
|
||||
|
||||
for (int32_t i = 0; i < scale; i++)
|
||||
res *= 10;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool number_value ( const string& data )
|
||||
{
|
||||
for (unsigned int i = 0; i < strlen(data.c_str()); i++)
|
||||
@@ -872,7 +859,6 @@ bool mysql_str_to_datetime( const string& input, DateTime& output, bool& isDate
|
||||
|
||||
bool mysql_str_to_time( const string& input, Time& output, long decimals )
|
||||
{
|
||||
// int32_t datesepct = 0;
|
||||
uint32_t dtend = 0;
|
||||
bool isNeg = false;
|
||||
|
||||
@@ -2157,7 +2143,8 @@ std::string DataConvert::datetimeToString1( long long datetimevalue )
|
||||
{
|
||||
// @bug 4703 abandon multiple ostringstream's for conversion
|
||||
DateTime dt(datetimevalue);
|
||||
const int DATETIMETOSTRING1_LEN = 22; // YYYYMMDDHHMMSSmmmmmm\0
|
||||
// Interesting, gcc 7 says the sprintf below generates between 21 and 23 bytes of output.
|
||||
const int DATETIMETOSTRING1_LEN = 23; // YYYYMMDDHHMMSSmmmmmm\0
|
||||
char buf[DATETIMETOSTRING1_LEN];
|
||||
|
||||
sprintf(buf, "%04d%02d%02d%02d%02d%02d%06d", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.msecond);
|
||||
@@ -2422,11 +2409,10 @@ int64_t DataConvert::stringToDatetime(const string& data, bool* date)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This is really painful and expensive b/c it seems the input is not normalized or
|
||||
sanitized. That should really be done on ingestion. */
|
||||
int64_t DataConvert::intToDate(int64_t data)
|
||||
{
|
||||
//char buf[10] = {0};
|
||||
//snprintf( buf, 10, "%llu", (long long unsigned int)data);
|
||||
//string date = buf;
|
||||
char buf[21] = {0};
|
||||
Date aday;
|
||||
|
||||
@@ -2438,7 +2424,11 @@ int64_t DataConvert::intToDate(int64_t data)
|
||||
return *(reinterpret_cast<uint32_t*>(&aday));
|
||||
}
|
||||
|
||||
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
|
||||
// into 15 bytes, however, that appears to be intentional.
|
||||
#pragma GCC diagnostic ignored "-Wformat-truncation="
|
||||
snprintf( buf, 15, "%llu", (long long unsigned int)data);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
string year, month, day, hour, min, sec, msec;
|
||||
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
|
||||
@@ -2541,6 +2531,8 @@ int64_t DataConvert::intToDate(int64_t data)
|
||||
return *(reinterpret_cast<uint32_t*>(&aday));
|
||||
}
|
||||
|
||||
/* This is really painful and expensive b/c it seems the input is not normalized or
|
||||
sanitized. That should really be done on ingestion. */
|
||||
int64_t DataConvert::intToDatetime(int64_t data, bool* date)
|
||||
{
|
||||
bool isDate = false;
|
||||
@@ -2563,7 +2555,12 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
|
||||
return *(reinterpret_cast<uint64_t*>(&adaytime));
|
||||
}
|
||||
|
||||
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
|
||||
// into 15 bytes, however, that appears to be intentional.
|
||||
#pragma GCC diagnostic ignored "-Wformat-truncation="
|
||||
snprintf( buf, 15, "%llu", (long long unsigned int)data);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//string date = buf;
|
||||
string year, month, day, hour, min, sec, msec;
|
||||
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
|
||||
@@ -2671,6 +2668,8 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
|
||||
return *(reinterpret_cast<uint64_t*>(&adaytime));
|
||||
}
|
||||
|
||||
/* This is really painful and expensive b/c it seems the input is not normalized or
|
||||
sanitized. That should really be done on ingestion. */
|
||||
int64_t DataConvert::intToTime(int64_t data, bool fromString)
|
||||
{
|
||||
char buf[21] = {0};
|
||||
@@ -2689,7 +2688,12 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
|
||||
return *(reinterpret_cast<int64_t*>(&atime));
|
||||
}
|
||||
|
||||
// this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit #
|
||||
// into 15 bytes, however, that appears to be intentional.
|
||||
#pragma GCC diagnostic ignored "-Wformat-truncation="
|
||||
snprintf( buf, 15, "%llu", (long long unsigned int)data);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//string date = buf;
|
||||
string hour, min, sec, msec;
|
||||
int64_t h = 0, minute = 0, s = 0, ms = 0;
|
||||
|
@@ -89,11 +89,11 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
||||
execplan::CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
string tstr;
|
||||
string tnewstr;
|
||||
stringValue(fp[0], row, isNull, tstr);
|
||||
if (isNull)
|
||||
return "";
|
||||
|
||||
string tnewstr;
|
||||
stringValue(fp[3], row, isNull, tnewstr);
|
||||
if (isNull)
|
||||
return "";
|
||||
|
@@ -82,7 +82,7 @@ typedef unsigned char uchar;
|
||||
|
||||
char* PrintMD5(uchar md5Digest[16]);
|
||||
char* MD5String(const char* szString);
|
||||
char* MD5File(char* szFilename);
|
||||
//char* MD5File(char* szFilename);
|
||||
|
||||
class md5
|
||||
{
|
||||
@@ -263,7 +263,9 @@ char* MD5String(const char* szString)
|
||||
|
||||
}
|
||||
|
||||
// MD5File: Performs the MD5 algorithm on a file (binar or text),
|
||||
// this fcn isn't used, so commenting it
|
||||
#if 0
|
||||
// MD5File: Performs the MD5 algorithm on a file (binary or text),
|
||||
// returning the results as a char*. Returns NULL if it fails.
|
||||
char* MD5File(char* szFilename)
|
||||
{
|
||||
@@ -295,7 +297,7 @@ char* MD5File(char* szFilename)
|
||||
|
||||
return NULL; // failed
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// md5::Init
|
||||
// Initializes a new context.
|
||||
|
@@ -99,8 +99,7 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row,
|
||||
}
|
||||
else
|
||||
{
|
||||
count = count * -1;
|
||||
size_t end = strlen(str.c_str());
|
||||
count = -count;
|
||||
int pointer = end;
|
||||
int start = 0;
|
||||
|
||||
|
@@ -151,7 +151,7 @@ HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(const char* fname, const char* mode, unsi
|
||||
|
||||
// This constructor is for use by HdfsRdwrMemBuffer to create a file buffer when we
|
||||
// run out of memory.
|
||||
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception) :
|
||||
HdfsRdwrFileBuffer::HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) :
|
||||
IDBDataFile(pMemBuffer->name().c_str()),
|
||||
m_buffer(NULL),
|
||||
m_dirty(false)
|
||||
|
@@ -50,7 +50,7 @@ class HdfsRdwrFileBuffer: public IDBDataFile, boost::noncopyable
|
||||
{
|
||||
public:
|
||||
HdfsRdwrFileBuffer(const char* fname, const char* mode, unsigned opts);
|
||||
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer) throw (std::exception);
|
||||
HdfsRdwrFileBuffer(HdfsRdwrMemBuffer* pMemBuffer);
|
||||
/* virtual */ ~HdfsRdwrFileBuffer();
|
||||
|
||||
/* virtual */ ssize_t pread(void* ptr, off64_t offset, size_t count);
|
||||
|
@@ -180,21 +180,21 @@ const string MessageLog::format(const Message& msg, const char prefix)
|
||||
void MessageLog::logDebugMessage(const Message& msg)
|
||||
{
|
||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
||||
::syslog(LOG_DEBUG, format(msg, 'D').c_str());
|
||||
::syslog(LOG_DEBUG, "%s", format(msg, 'D').c_str());
|
||||
::closelog();
|
||||
}
|
||||
|
||||
void MessageLog::logInfoMessage(const Message& msg)
|
||||
{
|
||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
||||
::syslog(LOG_INFO, format(msg, 'I').c_str());
|
||||
::syslog(LOG_INFO, "%s", format(msg, 'I').c_str());
|
||||
::closelog();
|
||||
}
|
||||
|
||||
void MessageLog::logWarningMessage(const Message& msg)
|
||||
{
|
||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
||||
::syslog(LOG_WARNING, format(msg, 'W').c_str());
|
||||
::syslog(LOG_WARNING, "%s", format(msg, 'W').c_str());
|
||||
::closelog();
|
||||
}
|
||||
|
||||
@@ -202,14 +202,14 @@ void MessageLog::logErrorMessage(const Message& msg)
|
||||
{
|
||||
// @bug 24 use 'E' instead of 'S'
|
||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
||||
::syslog(LOG_ERR, format(msg, 'E').c_str());
|
||||
::syslog(LOG_ERR, "%s", format(msg, 'E').c_str());
|
||||
::closelog();
|
||||
}
|
||||
|
||||
void MessageLog::logCriticalMessage(const Message& msg)
|
||||
{
|
||||
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0 | LOG_PID, fFacility);
|
||||
::syslog(LOG_CRIT, format(msg, 'C').c_str());
|
||||
::syslog(LOG_CRIT, "%s", format(msg, 'C').c_str());
|
||||
::closelog();
|
||||
}
|
||||
//Bug 5218. comment out the following functions to alleviate issue where dml messages show up in crit.log. This
|
||||
|
@@ -966,7 +966,9 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
|
||||
#ifdef _MSC_VER
|
||||
(void)::recv(socketParms().sd(), &buf, 1, 0);
|
||||
#else
|
||||
(void)::read(socketParms().sd(), &buf, 1);
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@@ -94,6 +94,7 @@ string get_trace_file()
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
#ifdef QUERY_TELE_DEBUG
|
||||
void log_query(const querytele::QueryTele& qtdata)
|
||||
{
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
@@ -125,7 +126,9 @@ void log_query(const querytele::QueryTele& qtdata)
|
||||
trace << endl;
|
||||
trace.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QUERY_TELE_DEBUG
|
||||
const string st2str(enum querytele::StepType::type t)
|
||||
{
|
||||
switch (t)
|
||||
@@ -172,7 +175,9 @@ const string st2str(enum querytele::StepType::type t)
|
||||
|
||||
return "INV";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QUERY_TELE_DEBUG
|
||||
void log_step(const querytele::StepTele& stdata)
|
||||
{
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
@@ -207,6 +212,7 @@ void log_step(const querytele::StepTele& stdata)
|
||||
trace << endl;
|
||||
trace.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
void TeleConsumer()
|
||||
{
|
||||
|
@@ -32,7 +32,9 @@
|
||||
#include <tr1/unordered_map>
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG
|
||||
#endif
|
||||
#include <cassert>
|
||||
using namespace std;
|
||||
|
||||
|
@@ -139,8 +139,8 @@ PriorityThreadPool::Priority PriorityThreadPool::pickAQueue(Priority preference)
|
||||
|
||||
void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
|
||||
{
|
||||
Priority queue;
|
||||
uint32_t weight, i;
|
||||
Priority queue = LOW;
|
||||
uint32_t weight, i = 0;
|
||||
vector<Job> runList;
|
||||
vector<bool> reschedule;
|
||||
uint32_t rescheduleCount;
|
||||
|
@@ -75,7 +75,9 @@ public:
|
||||
boost::thread* create_thread(F threadfunc)
|
||||
{
|
||||
boost::lock_guard<boost::shared_mutex> guard(m);
|
||||
std::auto_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
|
||||
std::unique_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
|
||||
// auto_ptr was deprecated
|
||||
//std::auto_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
|
||||
threads.push_back(new_thread.get());
|
||||
return new_thread.release();
|
||||
}
|
||||
|
@@ -1029,6 +1029,10 @@ inline T mcsv1_UDAF::convertAnyTo(static_any::any& valIn)
|
||||
{
|
||||
val = valIn.cast<double>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw runtime_error("mcsv1_UDAF::convertAnyTo(): input param has unrecognized type");
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user