From 7e2cb0562472a2d05316889b5cf175d735da93a4 Mon Sep 17 00:00:00 2001 From: Roman Nozdrin Date: Mon, 29 Apr 2019 12:26:12 +0300 Subject: [PATCH] MCOL-537 There are no CS-specific warnings building with gcc 8.2. --- dbcon/execplan/arithmeticoperator.cpp | 16 ---- dbcon/execplan/logicoperator.cpp | 16 ---- dbcon/joblist/joblistfactory.cpp | 30 -------- dbcon/mysql/ha_calpont_dml.cpp | 97 ------------------------- dbcon/mysql/ha_calpont_partition.cpp | 15 ---- ddlproc/ddlproc.cpp | 10 ++- exemgr/main.cpp | 16 ++-- primitives/blockcache/iomanager.cpp | 67 +---------------- primitives/primproc/columncommand.cpp | 11 --- primitives/primproc/primitiveserver.cpp | 27 ------- primitives/primproc/primproc.cpp | 18 +++-- tools/dbbuilder/dbbuilder.cpp | 40 +++++----- tools/dbloadxml/colxml.cpp | 3 + utils/dataconvert/dataconvert.h | 5 +- utils/querytele/queryteleprotoimpl.cpp | 2 +- versioning/BRM/slavecomm.cpp | 10 ++- writeengine/bulk/cpimport.cpp | 7 +- writeengine/bulk/we_tableinfo.cpp | 11 ++- writeengine/server/we_getfilesizes.cpp | 4 +- writeengine/shared/we_chunkmanager.cpp | 8 ++ writeengine/splitter/we_splitterapp.cpp | 3 + writeengine/xml/we_xmlgenproc.cpp | 10 +-- writeengine/xml/we_xmlgenproc.h | 2 +- 23 files changed, 94 insertions(+), 334 deletions(-) diff --git a/dbcon/execplan/arithmeticoperator.cpp b/dbcon/execplan/arithmeticoperator.cpp index 71857a8fa..57b77381a 100644 --- a/dbcon/execplan/arithmeticoperator.cpp +++ b/dbcon/execplan/arithmeticoperator.cpp @@ -40,22 +40,6 @@ struct to_lower } }; -//Trim any leading/trailing ws -const string lrtrim(const string& in) -{ - string::size_type p1; - p1 = in.find_first_not_of(" \t\n"); - - if (p1 == string::npos) p1 = 0; - - string::size_type p2; - p2 = in.find_last_not_of(" \t\n"); - - if (p2 == string::npos) p2 = in.size() - 1; - - return string(in, p1, (p2 - p1 + 1)); -} - } namespace execplan diff --git a/dbcon/execplan/logicoperator.cpp b/dbcon/execplan/logicoperator.cpp index a5353e472..a466017da 100644 --- a/dbcon/execplan/logicoperator.cpp +++ b/dbcon/execplan/logicoperator.cpp @@ -40,22 +40,6 @@ struct to_lower } }; -//Trim any leading/trailing ws -const string lrtrim(const string& in) -{ - string::size_type p1; - p1 = in.find_first_not_of(" \t\n"); - - if (p1 == string::npos) p1 = 0; - - string::size_type p2; - p2 = in.find_last_not_of(" \t\n"); - - if (p2 == string::npos) p2 = in.size() - 1; - - return string(in, p1, (p2 - p1 + 1)); -} - } namespace execplan diff --git a/dbcon/joblist/joblistfactory.cpp b/dbcon/joblist/joblistfactory.cpp index 32c7a0836..21df156a7 100644 --- a/dbcon/joblist/joblistfactory.cpp +++ b/dbcon/joblist/joblistfactory.cpp @@ -94,36 +94,6 @@ namespace using namespace joblist; -bool checkCombinable(JobStep* jobStepPtr) -{ - if (typeid(*(jobStepPtr)) == typeid(pColScanStep)) - { - return true; - } - else if (typeid(*(jobStepPtr)) == typeid(PseudoColStep)) - { - return true; - } - else if (typeid(*(jobStepPtr)) == typeid(pColStep)) - { - return true; - } - else if (typeid(*(jobStepPtr)) == typeid(pDictionaryStep)) - { - return true; - } - else if (typeid(*(jobStepPtr)) == typeid(PassThruStep)) - { - return true; - } - else if (typeid(*(jobStepPtr)) == typeid(FilterStep)) - { - return true; - } - - return false; -} - void projectSimpleColumn(const SimpleColumn* sc, JobStepVector& jsv, JobInfo& jobInfo) { if (sc == NULL) diff --git a/dbcon/mysql/ha_calpont_dml.cpp b/dbcon/mysql/ha_calpont_dml.cpp index 0e2bce76c..f6393a09f 100644 --- a/dbcon/mysql/ha_calpont_dml.cpp +++ b/dbcon/mysql/ha_calpont_dml.cpp @@ -88,103 +88,6 @@ inline uint32_t tid2sid(const uint32_t tid) } //StopWatch timer; -int buildBuffer(uchar* buf, string& buffer, int& columns, TABLE* table) -{ - char attribute_buffer[1024]; - String attribute(attribute_buffer, sizeof(attribute_buffer), - &my_charset_bin); - - std::string cols = " ("; - std::string vals = " values ("; - columns = 0; - - for (Field** field = table->field; *field; field++) - { - const char* ptr; - const char* end_ptr; - - if ((*field)->is_null()) - ptr = end_ptr = 0; - else - { - bitmap_set_bit(table->read_set, (*field)->field_index); - (*field)->val_str(&attribute, &attribute); - ptr = attribute.ptr(); - end_ptr = attribute.length() + ptr; - } - - if (columns > 0) - { - cols.append(","); - vals.append(","); - } - - columns++; - - cols.append((*field)->field_name.str); - - if (ptr == end_ptr) - { - vals.append ("NULL"); - } - else - { - - if ( (*field)->type() == MYSQL_TYPE_VARCHAR || - /*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */ - (*field)->type() == MYSQL_TYPE_VAR_STRING || - (*field)->type() == MYSQL_TYPE_STRING || - (*field)->type() == MYSQL_TYPE_DATE || - (*field)->type() == MYSQL_TYPE_DATETIME || - (*field)->type() == MYSQL_TYPE_DATETIME2 || - (*field)->type() == MYSQL_TYPE_TIME ) - vals.append("'"); - - while (ptr < end_ptr) - { - - if (*ptr == '\r') - { - ptr++; - } - else if (*ptr == '\n') - { - ptr++; - } - else if (*ptr == '\'' ) - { - //@Bug 1820. Replace apostrophe with strange character to pass parser. - vals += '\252'; - ptr++; - } - else - vals += *ptr++; - } - - if ( (*field)->type() == MYSQL_TYPE_VARCHAR || - /*FIXME: (*field)->type() == MYSQL_TYPE_VARBINARY || */ - (*field)->type() == MYSQL_TYPE_VAR_STRING || - (*field)->type() == MYSQL_TYPE_STRING || - (*field)->type() == MYSQL_TYPE_DATE || - (*field)->type() == MYSQL_TYPE_DATETIME || - (*field)->type() == MYSQL_TYPE_DATETIME2 || - (*field)->type() == MYSQL_TYPE_TIME ) - vals.append("'"); - } - } - - if (columns) - { - cols.append(") "); - vals.append(") "); - buffer = "INSERT INTO "; - buffer.append(table->s->table_name.str); - buffer.append(cols); - buffer.append(vals); - } - - return columns; -} uint32_t buildValueList (TABLE* table, cal_connection_info& ci ) { diff --git a/dbcon/mysql/ha_calpont_partition.cpp b/dbcon/mysql/ha_calpont_partition.cpp index 61063f2f6..7d2317661 100644 --- a/dbcon/mysql/ha_calpont_partition.cpp +++ b/dbcon/mysql/ha_calpont_partition.cpp @@ -239,21 +239,6 @@ struct PartitionInfo typedef map PartitionMap; -const string charcolToString(int64_t v) -{ - ostringstream oss; - char c; - - for (int i = 0; i < 8; i++) - { - c = v & 0xff; - oss << c; - v >>= 8; - } - - return oss.str(); -} - const string format(int64_t v, CalpontSystemCatalog::ColType& ct) { ostringstream oss; diff --git a/ddlproc/ddlproc.cpp b/ddlproc/ddlproc.cpp index 6f827f8fd..bb3020deb 100644 --- a/ddlproc/ddlproc.cpp +++ b/ddlproc/ddlproc.cpp @@ -71,14 +71,15 @@ namespace { DistributedEngineComm* Dec; -void setupCwd() +int8_t setupCwd() { string workdir = startup::StartUp::tmpDir(); if (workdir.length() == 0) workdir = "."; - (void)chdir(workdir.c_str()); + int8_t rc = chdir(workdir.c_str()); + return rc; } void added_a_pm(int) @@ -103,7 +104,10 @@ int main(int argc, char* argv[]) // This is unset due to the way we start it program_invocation_short_name = const_cast("DDLProc"); - setupCwd(); + if ( setupCwd() < 0 ) + { + std::cerr << "Could not set working directory" << std::endl; + } WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC ); #ifdef _MSC_VER diff --git a/exemgr/main.cpp b/exemgr/main.cpp index 259d1443e..252f8fbf5 100644 --- a/exemgr/main.cpp +++ b/exemgr/main.cpp @@ -1325,13 +1325,15 @@ void setupSignalHandlers() #endif } -void setupCwd(ResourceManager* rm) +int8_t setupCwd(ResourceManager* rm) { string workdir = rm->getScWorkingDir(); - (void)chdir(workdir.c_str()); + int8_t rc = chdir(workdir.c_str()); - if (access(".", W_OK) != 0) - (void)chdir("/tmp"); + if (rc < 0 || access(".", W_OK) != 0) + rc = chdir("/tmp"); + + return (rc < 0) ? -5 : rc; } void startRssMon(size_t maxPct, int pauseSeconds) @@ -1497,9 +1499,12 @@ int main(int argc, char* argv[]) break; default: + errMsg = "Couldn't change working directory or unknown error"; break; } + err = setupCwd(rm); + if (err < 0) { Oam oam; @@ -1523,9 +1528,6 @@ int main(int argc, char* argv[]) return 2; } - - setupCwd(rm); - cleanTempDir(); MsgMap msgMap; diff --git a/primitives/blockcache/iomanager.cpp b/primitives/blockcache/iomanager.cpp index 8e5e063cd..2bf4526e5 100644 --- a/primitives/blockcache/iomanager.cpp +++ b/primitives/blockcache/iomanager.cpp @@ -283,71 +283,6 @@ FdCacheType_t fdcache; boost::mutex fdMapMutex; rwlock::RWLock_local localLock; -void pause_(unsigned secs) -{ - struct timespec req; - struct timespec rem; - - req.tv_sec = secs; - req.tv_nsec = 0; - - rem.tv_sec = 0; - rem.tv_nsec = 0; - -#ifdef _MSC_VER - Sleep(req.tv_sec * 1000); -#else -again: - - if (nanosleep(&req, &rem) != 0) - if (rem.tv_sec > 0 || rem.tv_nsec > 0) - { - req = rem; - goto again; - } - -#endif -} - -const vector > getDBRootList() -{ - vector > ret; - Config* config; - uint32_t dbrootCount, i; - string stmp, devname, mountpoint; - char devkey[80], mountkey[80]; - - config = Config::makeConfig(); - - stmp = config->getConfig("SystemConfig", "DBRootCount"); - - if (stmp.empty()) - { - Message::Args args; - args.add("getDBRootList: Configuration error. No DBRootCount"); - primitiveprocessor::mlp->logMessage(logging::M0006, args, true); - throw runtime_error("getDBRootList: Configuration error. No DBRootCount"); - } - - dbrootCount = config->uFromText(stmp); - - for (i = 1; i <= dbrootCount; i++) - { - snprintf(mountkey, 80, "DBRoot%d", i); - snprintf(devkey, 80, "DBRootStorageLoc%d", i); - mountpoint = config->getConfig("SystemConfig", string(mountkey)); - devname = config->getConfig("Installation", string(devkey)); - - if (mountpoint == "" || devname == "") - throw runtime_error("getDBRootList: Configuration error. Don't know where DBRoots are mounted"); - - ret.push_back(pair(devname, mountpoint)); -// cout << "I see " << devname << " should be mounted at " << mountpoint << endl; - } - - return ret; -} - char* alignTo(const char* in, int av) { ptrdiff_t inx = reinterpret_cast(in); @@ -769,7 +704,7 @@ void* thr_popper(ioManager* arg) int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0; fp = NULL; uint32_t openRetries = 0; - int saveErrno; + int saveErrno = 0; while (fp == NULL && openRetries++ < 5) { diff --git a/primitives/primproc/columncommand.cpp b/primitives/primproc/columncommand.cpp index ed4b26a44..f5db52a2d 100644 --- a/primitives/primproc/columncommand.cpp +++ b/primitives/primproc/columncommand.cpp @@ -51,17 +51,6 @@ using namespace logging; #define llabs labs #endif -namespace -{ -using namespace primitiveprocessor; - -double cotangent(double in) -{ - return (1.0 / tan(in)); -} - -} - namespace primitiveprocessor { diff --git a/primitives/primproc/primitiveserver.cpp b/primitives/primproc/primitiveserver.cpp index 9359556e9..54f4b7fb6 100644 --- a/primitives/primproc/primitiveserver.cpp +++ b/primitives/primproc/primitiveserver.cpp @@ -1097,33 +1097,6 @@ namespace { using namespace primitiveprocessor; -void pause_(unsigned delay) -{ - struct timespec req; - struct timespec rem; - - req.tv_sec = delay; - req.tv_nsec = 0; - - rem.tv_sec = 0; - rem.tv_nsec = 0; -#ifdef _MSC_VER - Sleep(req.tv_sec * 1000); -#else -again: - - if (nanosleep(&req, &rem) != 0) - { - if (rem.tv_sec > 0 || rem.tv_nsec > 0) - { - req = rem; - goto again; - } - } - -#endif -} - /** @brief The job type to process a dictionary scan (pDictionaryScan class on the UM) * TODO: Move this & the impl into different files */ diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index 2e88493a0..a8ceb1451 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -146,17 +146,19 @@ void setupSignalHandlers() #endif } -void setupCwd(Config* cf) +int8_t setupCwd(Config* cf) { string workdir = startup::StartUp::tmpDir(); if (workdir.length() == 0) workdir = "."; - (void)chdir(workdir.c_str()); + int8_t rc = chdir(workdir.c_str()); - if (access(".", W_OK) != 0) - (void)chdir("/tmp"); + if (rc < 0 || access(".", W_OK) != 0) + rc = chdir("/tmp"); + + return rc; } int setupResources() @@ -342,11 +344,11 @@ int main(int argc, char* argv[]) setupSignalHandlers(); - setupCwd(cf); + int err = 0; + err = setupCwd(cf); mlp = new primitiveprocessor::Logger(); - int err = 0; if (!gDebug) err = setupResources(); string errMsg; @@ -366,6 +368,10 @@ int main(int argc, char* argv[]) errMsg = "Could not install file limits to required value, please see non-root install documentation"; break; + case -5: + errMsg = "Could not change into working directory"; + break; + default: break; } diff --git a/tools/dbbuilder/dbbuilder.cpp b/tools/dbbuilder/dbbuilder.cpp index aec094b89..634a78ebd 100644 --- a/tools/dbbuilder/dbbuilder.cpp +++ b/tools/dbbuilder/dbbuilder.cpp @@ -58,11 +58,11 @@ int setUp() { #ifndef _MSC_VER string cmd = "/bin/rm -f " + logFile + " >/dev/null 2>&1"; - (void)system(cmd.c_str()); + int rc = system(cmd.c_str()); cmd = "/bin/touch -f " + logFile + " >/dev/null 2>&1"; - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); #endif - return 0; + return rc; } int checkNotThere(WriteEngine::FID fid) @@ -72,12 +72,6 @@ int checkNotThere(WriteEngine::FID fid) return (fileOp.existsOIDDir(fid) ? -1 : 0); } -void tearDown() -{ - string file = tmpDir + "/oidbitmap"; - unlink(file.c_str()); -} - void usage() { cerr << "Usage: dbbuilder [-h|f] function" << endl @@ -130,6 +124,7 @@ int main(int argc, char* argv[]) std::string schema("tpch"); Oam oam; bool fFlg = false; + int rc = 0; opterr = 0; @@ -193,7 +188,10 @@ int main(int argc, char* argv[]) if ( buildOption == SYSCATALOG_ONLY ) { - setUp(); + if ( setUp() ) + { + cerr << "setUp() call error " << endl; + } bool canWrite = true; @@ -209,9 +207,13 @@ int main(int argc, char* argv[]) "' > " + logFile; if (canWrite) - (void)system(cmd.c_str()); + { + rc = system(cmd.c_str()); + } else + { cerr << cmd << endl; + } errorHandler(sysCatalogErr, "Build system catalog", @@ -243,7 +245,7 @@ int main(int argc, char* argv[]) string cmd(string("echo 'FAILED: ") + ex.what() + "' > " + logFile); if (canWrite) - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); else cerr << cmd << endl; @@ -255,7 +257,7 @@ int main(int argc, char* argv[]) string cmd = "echo 'FAILED: HDFS checking.' > " + logFile; if (canWrite) - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); else cerr << cmd << endl; @@ -274,7 +276,7 @@ int main(int argc, char* argv[]) std::string cmd = "echo 'OK: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; if (canWrite) - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); else #ifdef _MSC_VER (void)0; @@ -287,11 +289,9 @@ int main(int argc, char* argv[]) if (canWrite) { - int err; + rc = system(cmd.c_str()); - err = system(cmd.c_str()); - - if (err != 0) + if (rc != 0) { ostringstream os; os << "Warning: running " << cmd << " failed. This is usually non-fatal."; @@ -309,7 +309,7 @@ int main(int argc, char* argv[]) string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; if (canWrite) - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); else cerr << cmd << endl; @@ -320,7 +320,7 @@ int main(int argc, char* argv[]) string cmd = "echo 'FAILED: buildOption=" + oam.itoa(buildOption) + "' > " + logFile; if (canWrite) - (void)system(cmd.c_str()); + rc = system(cmd.c_str()); else cerr << cmd << endl; diff --git a/tools/dbloadxml/colxml.cpp b/tools/dbloadxml/colxml.cpp index 00171ffc0..9c28b232d 100644 --- a/tools/dbloadxml/colxml.cpp +++ b/tools/dbloadxml/colxml.cpp @@ -46,7 +46,10 @@ int main(int argc, char** argv) #ifdef _MSC_VER //FIXME #else +#pragma GCC diagnostic ignored "-Wunused-result" setuid( 0 ); // set effective ID to root; ignore return status + // Why should we raise privileges if we don't care? +#pragma GCC diagnostic pop #endif setlocale(LC_ALL, ""); WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index a6ce20198..2e0d225fe 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -673,12 +673,15 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned buf++; buflen--; } - + // this snprintf call causes a compiler warning b/c buffer size is less + // then maximum string size. +#pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf( buf, buflen, "%02d%02d%02d", hour, (unsigned)((timevalue >> 32) & 0xff), (unsigned)((timevalue >> 14) & 0xff) ); +#pragma GCC diagnostic pop } inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType) diff --git a/utils/querytele/queryteleprotoimpl.cpp b/utils/querytele/queryteleprotoimpl.cpp index e1ad7025a..fa54a0adf 100644 --- a/utils/querytele/queryteleprotoimpl.cpp +++ b/utils/querytele/queryteleprotoimpl.cpp @@ -80,6 +80,7 @@ struct QStats QStats fQStats; +#ifdef QUERY_TELE_DEBUG string get_trace_file() { ostringstream oss; @@ -94,7 +95,6 @@ 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); diff --git a/versioning/BRM/slavecomm.cpp b/versioning/BRM/slavecomm.cpp index 55fe3a15b..d72138e49 100644 --- a/versioning/BRM/slavecomm.cpp +++ b/versioning/BRM/slavecomm.cpp @@ -51,12 +51,14 @@ using namespace idbdatafile; namespace { +#ifdef USE_VERY_COMPLEX_DROP_CACHES void timespec_sub(const struct timespec& tv1, const struct timespec& tv2, double& tm) { tm = (double)(tv2.tv_sec - tv1.tv_sec) + 1.e-9 * (tv2.tv_nsec - tv1.tv_nsec); } +#endif } namespace BRM @@ -2176,8 +2178,12 @@ void SlaveComm::do_flushInodeCache() if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) >= 0) { - write(fd, "3\n", 2); - close(fd); + ssize_t written = write(fd, "3\n", 2); + int rc = close(fd); + if ( !written || rc ) + { + std::cerr << "Could not write into or close /proc/sys/vm/drop_caches" << std::endl; + } } #endif diff --git a/writeengine/bulk/cpimport.cpp b/writeengine/bulk/cpimport.cpp index 94dc5ae1d..c23b3170d 100644 --- a/writeengine/bulk/cpimport.cpp +++ b/writeengine/bulk/cpimport.cpp @@ -830,10 +830,11 @@ void printInputSource( if (alternateImportDir == IMPORT_PATH_CWD) { char cwdBuf[4096]; - ::getcwd(cwdBuf, sizeof(cwdBuf)); + char *bufPtr = &cwdBuf[0]; + bufPtr = ::getcwd(cwdBuf, sizeof(cwdBuf)); if (!(BulkLoad::disableConsoleOutput())) - cout << "Input file(s) will be read from : " << cwdBuf << endl; + cout << "Input file(s) will be read from : " << bufPtr << endl; } else { @@ -1021,7 +1022,9 @@ int main(int argc, char** argv) #ifdef _MSC_VER _setmaxstdio(2048); #else +#pragma GCC diagnostic ignored "-Wunused-result" setuid( 0 ); // set effective ID to root; ignore return status +#pragma GCC diagnostic pop #endif setupSignalHandlers(); diff --git a/writeengine/bulk/we_tableinfo.cpp b/writeengine/bulk/we_tableinfo.cpp index 2885d1462..593b68647 100644 --- a/writeengine/bulk/we_tableinfo.cpp +++ b/writeengine/bulk/we_tableinfo.cpp @@ -1462,9 +1462,11 @@ void TableInfo::writeBadRows( const std::vector* errorDatRows, if (!p.has_root_path()) { + // We could fail here having fixed size buffer char cwdPath[4096]; - getcwd(cwdPath, sizeof(cwdPath)); - boost::filesystem::path rejectFileName2( cwdPath ); + char* buffPtr = &cwdPath[0]; + buffPtr = getcwd(cwdPath, sizeof(cwdPath)); + boost::filesystem::path rejectFileName2( buffPtr ); rejectFileName2 /= fRejectDataFileName; fBadFiles.push_back( rejectFileName2.string() ); @@ -1569,8 +1571,9 @@ void TableInfo::writeErrReason( const std::vector< std::pair(&tv.tv_sec), <m); char tmText[24]; + // this snprintf call causes a compiler warning b/c buffer size is less + // then maximum string size. +#pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, tv.tv_usec); +#pragma GCC diagnostic pop string dbgFileName(rlcFileName + tmText); ostringstream oss; @@ -2106,10 +2110,14 @@ int ChunkManager::reallocateChunks(CompFileData* fileData) struct tm ltm; localtime_r(reinterpret_cast(&tv.tv_sec), <m); char tmText[24]; + // this snprintf call causes a compiler warning b/c buffer size is less + // then maximum string size. +#pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", ltm.tm_year + 1900, ltm.tm_mon + 1, ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, tv.tv_usec); +#pragma GCC diagnostic pop string dbgFileName(rlcFileName + tmText); ostringstream oss; diff --git a/writeengine/splitter/we_splitterapp.cpp b/writeengine/splitter/we_splitterapp.cpp index dac0c7387..12e3f2389 100644 --- a/writeengine/splitter/we_splitterapp.cpp +++ b/writeengine/splitter/we_splitterapp.cpp @@ -604,7 +604,10 @@ void WESplitterApp::updateWithJobFile(int aIdx) int main(int argc, char** argv) { std::string err; +#pragma GCC diagnostic ignored "-Wunused-result" + // Why do we need this if we don't care about f()'s rc ? setuid(0); //@BUG 4343 set effective userid to root. +#pragma GCC diagnostic pop std::cin.sync_with_stdio(false); try diff --git a/writeengine/xml/we_xmlgenproc.cpp b/writeengine/xml/we_xmlgenproc.cpp index d5a787769..5789dca15 100644 --- a/writeengine/xml/we_xmlgenproc.cpp +++ b/writeengine/xml/we_xmlgenproc.cpp @@ -38,9 +38,9 @@ namespace { const char* DICT_TYPE("D"); const char* ENCODING("UTF-8"); -const char* JOBNAME("Job_"); const char* LOGNAME("Jobxml_"); const std::string LOGDIR("/log/"); +const char* JOBNAME("Job_"); } namespace WriteEngine @@ -438,13 +438,11 @@ void XMLGenProc::getColumnsForTable( throw std::runtime_error( oss.str() ); } } - + //------------------------------------------------------------------------------ // Generate Job XML File Name //------------------------------------------------------------------------------ -// This isn't used currently, commenting it out -#if 0 std::string XMLGenProc::genJobXMLFileName( ) const { std::string xmlFileName; @@ -471,7 +469,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const char *buf; buf = getcwd(cwdPath, sizeof(cwdPath)); if (buf == NULL) - throw runtime_error("Failed to get the current working directory!"); + throw std::runtime_error("Failed to get the current working directory!"); boost::filesystem::path p2(cwdPath); p2 /= p; xmlFileName = p2.string(); @@ -485,9 +483,7 @@ std::string XMLGenProc::genJobXMLFileName( ) const return xmlFileName; } -#endif - //------------------------------------------------------------------------------ // writeXMLFile //------------------------------------------------------------------------------ diff --git a/writeengine/xml/we_xmlgenproc.h b/writeengine/xml/we_xmlgenproc.h index adce2d75f..4b7ec4ed5 100644 --- a/writeengine/xml/we_xmlgenproc.h +++ b/writeengine/xml/we_xmlgenproc.h @@ -90,7 +90,7 @@ public: /** @brief Generate Job XML file name */ - //EXPORT std::string genJobXMLFileName( ) const; + EXPORT std::string genJobXMLFileName( ) const; /** @brief Write xml file document to the destination Job XML file. *