1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-537 Enabled -Wno-unused-result for OAM code.

Fixed pragmas that disables compilation checks.

    DDLProc now returns an error if it couldn't cwd.

    Use either auto_ptr or unique_ptr depending on GCC version.
This commit is contained in:
Roman Nozdrin
2019-05-08 11:41:26 +03:00
parent 7e2cb05624
commit b2436502cb
18 changed files with 85 additions and 39 deletions

View File

@ -106,9 +106,17 @@ int main(int argc, char* argv[])
if ( setupCwd() < 0 )
{
std::cerr << "Could not set working directory" << std::endl;
LoggingID logid(23, 0, 0);
logging::Message::Args args1;
logging::Message msg(9);
args1.add("DDLProc could not set working directory ");
msg.format( args1 );
logging::Logger logger(logid.fSubsysID);
logger.logMessage(LOG_TYPE_CRITICAL, msg, logid);
return 1;
}
WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DDLPROC );
#ifdef _MSC_VER
// In windows, initializing the wrapper (A dll) does not set the static variables

View File

@ -10,6 +10,8 @@ add_library(oamcpp SHARED ${oamcpp_LIB_SRCS})
target_link_libraries(oamcpp )
target_compile_options(oamcpp PRIVATE -Wno-unused-result)
set_target_properties(oamcpp PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS oamcpp DESTINATION ${ENGINE_LIBDIR} COMPONENT libs)

View File

@ -486,8 +486,8 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st
ByteStream msg1;
// setup message
msg1 << (ByteStream::byte) alarmID;
// setup message
msg1 << (ByteStream::byte) alarmID;
msg1 << (std::string) componentID;
msg1 << (ByteStream::byte) state;
msg1 << (std::string) ModuleName;

View File

@ -8,6 +8,8 @@ set(columnstoreSupport_SRCS columnstoreSupport.cpp)
add_executable(columnstoreSupport ${columnstoreSupport_SRCS})
target_compile_options(columnstoreSupport PRIVATE -Wno-unused-result)
target_link_libraries(columnstoreSupport ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS columnstoreSupport DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(mcsadmin_SRCS mcsadmin.cpp)
add_executable(mcsadmin ${mcsadmin_SRCS})
target_compile_options(mcsadmin PRIVATE -Wno-unused-result)
target_link_libraries(mcsadmin ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS} ${ENGINE_WRITE_LIBS})
install(TARGETS mcsadmin DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(postConfigure_SRCS postConfigure.cpp helpers.cpp)
add_executable(postConfigure ${postConfigure_SRCS})
target_compile_options(postConfigure PRIVATE -Wno-unused-result)
target_link_libraries(postConfigure ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS postConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
@ -19,6 +21,8 @@ set(installer_SRCS installer.cpp helpers.cpp)
add_executable(installer ${installer_SRCS})
target_compile_options(installer PRIVATE -Wno-unused-result)
target_link_libraries(installer ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS installer DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
@ -52,6 +56,8 @@ set(mycnfUpgrade_SRCS mycnfUpgrade.cpp)
add_executable(mycnfUpgrade ${mycnfUpgrade_SRCS})
target_compile_options(mycnfUpgrade PRIVATE -Wno-unused-result)
target_link_libraries(mycnfUpgrade ${ENGINE_LDFLAGS} readline ncurses ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS mycnfUpgrade DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -18,6 +18,8 @@ set(ServerMonitor_SRCS
add_executable(ServerMonitor ${ServerMonitor_SRCS})
target_compile_options(ServerMonitor PRIVATE -Wno-unused-result)
target_link_libraries(ServerMonitor ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ServerMonitor DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(ProcMgr_SRCS main.cpp processmanager.cpp ../utils/common/crashtrace.cpp)
add_executable(ProcMgr ${ProcMgr_SRCS})
target_compile_options(ProcMgr PRIVATE -Wno-unused-result)
target_link_libraries(ProcMgr ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ProcMgr DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(ProcMon_SRCS main.cpp processmonitor.cpp ../utils/common/crashtrace.cpp)
add_executable(ProcMon ${ProcMon_SRCS})
target_compile_options(ProcMon PRIVATE -Wno-unused-result)
target_link_libraries(ProcMon ${ENGINE_LDFLAGS} cacheutils ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS ProcMon DESTINATION ${ENGINE_BINDIR} COMPONENT platform)

View File

@ -8,6 +8,8 @@ set(autoInstaller_SRCS autoInstaller.cpp)
add_executable(autoInstaller ${autoInstaller_SRCS})
target_compile_options(autoInstaller PRIVATE -Wno-unused-result)
target_link_libraries(autoInstaller ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS} readline ncurses)
install(TARGETS autoInstaller DESTINATION ${ENGINE_BINDIR})
@ -22,15 +24,3 @@ add_executable(autoConfigure ${autoConfigure_SRCS})
target_link_libraries(autoConfigure ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS autoConfigure DESTINATION ${ENGINE_BINDIR} COMPONENT platform)
########### next target ###############
set(svnQuery_SRCS svnQuery.cpp)
add_executable(svnQuery ${svnQuery_SRCS})
target_link_libraries(svnQuery ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${MARIADB_CLIENT_LIBS} ${ENGINE_EXEC_LIBS})
install(TARGETS svnQuery DESTINATION ${ENGINE_BINDIR})

View File

@ -43,14 +43,11 @@ using namespace bulkloadxml;
int main(int argc, char** argv)
{
const int DEBUG_LVL_TO_DUMP_SYSCAT_RPT = 4;
#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
// set effective ID to root
if( setuid( 0 ) < 0 )
{
std::cerr << " colxml: setuid failed " << std::endl;
}
setlocale(LC_ALL, "");
WriteEngine::Config::initConfigCache(); // load Columnstore.xml config settings

View File

@ -2429,9 +2429,12 @@ int64_t DataConvert::intToDate(int64_t data)
// 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="
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
string year, month, day, hour, min, sec, msec;
int64_t y = 0, m = 0, d = 0, h = 0, minute = 0, s = 0, ms = 0;
@ -2560,9 +2563,12 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
// 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="
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
//string date = buf;
string year, month, day, hour, min, sec, msec;
@ -2693,9 +2699,12 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString)
// 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="
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, 15, "%llu", (long long unsigned int)data);
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
//string date = buf;
string hour, min, sec, msec;

View File

@ -675,6 +675,8 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
}
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation="
snprintf( buf, buflen, "%02d%02d%02d",
hour,
@ -682,6 +684,7 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned
(unsigned)((timevalue >> 14) & 0xff)
);
#pragma GCC diagnostic pop
#endif
}
inline std::string DataConvert::decimalToString(int64_t value, uint8_t scale, execplan::CalpontSystemCatalog::ColDataType colDataType)

View File

@ -945,7 +945,6 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
/* read a byte to artificially synchronize with accept() on the remote */
int ret = -1;
int e = EBADF;
char buf = '\0';
struct pollfd pfd;
long msecs = fConnectionTimeout.tv_sec * 1000 + fConnectionTimeout.tv_nsec / 1000000;
@ -964,11 +963,16 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
if (ret == 1)
{
#ifdef _MSC_VER
char buf = '\0';
(void)::recv(socketParms().sd(), &buf, 1, 0);
#else
#pragma GCC diagnostic ignored "-Wunused-result"
::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#pragma GCC diagnostic pop
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
char buf = '\0';
ssize_t bytes = ::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer
#pragma GCC diagnostic pop
#endif // pragma
#endif
return;
}

View File

@ -77,7 +77,11 @@ public:
boost::thread* create_thread(F threadfunc)
{
boost::lock_guard<boost::shared_mutex> guard(m);
#if defined(__GNUC__) && __GNUC__ >= 5
std::unique_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
#else
std::auto_ptr<boost::thread> new_thread(new boost::thread(threadfunc));
#endif
threads.push_back(new_thread.get());
return new_thread.release();
}

View File

@ -1022,9 +1022,11 @@ 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
// set effective ID to root
if( setuid( 0 ) < 0 )
{
std::cerr << " cpimport: setuid failed " << std::endl;
}
#endif
setupSignalHandlers();

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2019 MariaDB Corporation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -1925,12 +1926,15 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#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
#endif
string dbgFileName(rlcFileName + tmText);
ostringstream oss;
@ -2112,12 +2116,15 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
char tmText[24];
// this snprintf call causes a compiler warning b/c buffer size is less
// then maximum string size.
#if defined(__GNUC__) && __GNUC__ >= 5
#pragma GCC diagnostic push
#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
#endif
string dbgFileName(rlcFileName + tmText);
ostringstream oss;

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2019 MariaDB Corporation.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -604,10 +605,13 @@ 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
// @BUG4343
if( setuid( 0 ) < 0 )
{
std::cerr << " we_splitterapp: setuid failed " << std::endl;
}
std::cin.sync_with_stdio(false);
try