浏览代码

Merge pull request #138 from richardkchapman/formatcheck

WIP: #135 - Use g++ -Wformat option to detect errors

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 14 年之前
父节点
当前提交
4d730c15fc
共有 4 个文件被更改,包括 17 次插入17 次删除
  1. 1 1
      cmake_modules/commonSetup.cmake
  2. 1 1
      common/remote/rmtspawn.cpp
  3. 11 11
      common/thorhelper/thorsoapcall.cpp
  4. 4 4
      dali/sdsfix/sdsfix.cpp

+ 1 - 1
cmake_modules/commonSetup.cmake

@@ -101,7 +101,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     set ( EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin" )
     set ( LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libs" )
     if (${CMAKE_COMPILER_IS_GNUCXX})
-      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fPIC -fmessage-length=0 -Wformat -Werror")
+      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fPIC -fmessage-length=0 -Wformat")
       SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --export-dynamic")
       SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -fno-default-inline -fno-inline-functions")
     endif ()

+ 1 - 1
common/remote/rmtspawn.cpp

@@ -331,7 +331,7 @@ bool CRemoteParentInfo::sendReply(unsigned version)
                             //can remove when all .exes have new code.
                             if (connectKind != kind)
                             {
-                                LOG(MCdebugInfo(1000), unknownJob, "Connection for wrong slave kind (%d vs %d)- ignore", connectKind, kind);
+                                LOG(MCdebugInfo(1000), unknownJob, "Connection for wrong slave kind (%u vs %u)- ignore", connectKind, kind);
                                 replyVersion = connectVersion;
                             }
                         }

+ 11 - 11
common/thorhelper/thorsoapcall.cpp

@@ -735,7 +735,7 @@ public:
         if (timeLimit == 0  ||  timeLimit == (unsigned)-1)
             timeLimit = WAIT_FOREVER;   //default
         else
-            timeLimitMon.reset((unsigned int)timeLimit*1000);
+            timeLimitMon.reset(timeLimit*1000);
 
         if (wscType == STsoap)
         {
@@ -1026,8 +1026,8 @@ protected:
     unsigned numRowThreads;
     unsigned numUrlThreads;
     unsigned maxRetries;
-    time_t timeout;//seconds
-    time_t timeLimit;//seconds
+    unsigned timeout; //seconds
+    unsigned timeLimit; //seconds
     bool logXML, aborted;
     const IContextLogger &logctx;
     unsigned flags;
@@ -1413,7 +1413,7 @@ private:
         do {
             checkTimeLimitExceeded();
             checkRoxieAbortMonitor(master->roxieAbortMonitor);
-            socket->read(buffer+read, 0, WSCBUFFERSIZE-read, bytesRead, (unsigned)master->timeout);
+            socket->read(buffer+read, 0, WSCBUFFERSIZE-read, bytesRead, master->timeout);
             checkTimeLimitExceeded();
             checkRoxieAbortMonitor(master->roxieAbortMonitor);
 
@@ -1458,7 +1458,7 @@ private:
                             read chunk-size and CRLF
                         }
 */
-                        dataProvider.setown(new CSocketDataProvider(buffer, payloadofs, read, WSCBUFFERSIZE, socket, (unsigned)master->timeout));
+                        dataProvider.setown(new CSocketDataProvider(buffer, payloadofs, read, WSCBUFFERSIZE, socket, master->timeout));
                         dataProvider->getBytes(&ch, 1);
                         while (isalpha(ch) || isdigit(ch))
                         {   //get chunk-size
@@ -1519,7 +1519,7 @@ private:
                 while (read<payloadsize) {
                     checkTimeLimitExceeded();
                     checkRoxieAbortMonitor(master->roxieAbortMonitor);
-                    socket->read(response.reserve(payloadsize-read), 0, payloadsize-read, bytesRead, (unsigned)master->timeout);
+                    socket->read(response.reserve(payloadsize-read), 0, payloadsize-read, bytesRead, master->timeout);
                     checkTimeLimitExceeded();
                     checkRoxieAbortMonitor(master->roxieAbortMonitor);
 
@@ -1535,7 +1535,7 @@ private:
                 loop {
                     checkTimeLimitExceeded();
                     checkRoxieAbortMonitor(master->roxieAbortMonitor);
-                    socket->read(buffer, 0, WSCBUFFERSIZE, bytesRead, (unsigned)master->timeout);
+                    socket->read(buffer, 0, WSCBUFFERSIZE, bytesRead, master->timeout);
                     checkTimeLimitExceeded();
                     checkRoxieAbortMonitor(master->roxieAbortMonitor);
 
@@ -1666,7 +1666,7 @@ private:
     inline void checkTimeLimitExceeded()
     {
         if (master->isTimeLimitExceeded())
-            throw MakeStringException(TIMELIMIT_EXCEEDED, "%sCALL TIMELIMIT(%"I64F"u) exceeded", master->wscType == STsoap ? "SOAP" : "HTTP", (unsigned __int64) master->timeLimit);
+            throw MakeStringException(TIMELIMIT_EXCEEDED, "%sCALL TIMELIMIT(%u) exceeded", master->wscType == STsoap ? "SOAP" : "HTTP", master->timeLimit);
     }
 
 public:
@@ -1717,7 +1717,7 @@ public:
                 {
                     checkTimeLimitExceeded();
                     Url &connUrl = master->proxyUrlArray.empty() ? url : master->proxyUrlArray.item(0);
-                    socket.setown(blacklist->connect(connUrl.port, connUrl.host, master->logctx, (unsigned)master->maxRetries, (unsigned)master->timeout, master->roxieAbortMonitor));
+                    socket.setown(blacklist->connect(connUrl.port, connUrl.host, master->logctx, (unsigned)master->maxRetries, master->timeout, master->roxieAbortMonitor));
                     if (stricmp(url.method, "https") == 0)
                     {
                         Owned<ISecureSocket> ssock = master->createSecureSocket(socket.getClear());
@@ -1742,7 +1742,7 @@ public:
                 {
                     if (master->timeLimitExceeded)
                     {
-                        master->logctx.CTXLOG("%sCALL exiting: time limit (%"I64F"d) exceeded",master->wscType == STsoap ? "SOAP" : "HTTP", (unsigned __int64) master->timeLimit);
+                        master->logctx.CTXLOG("%sCALL exiting: time limit (%u) exceeded",master->wscType == STsoap ? "SOAP" : "HTTP", master->timeLimit);
                         processException(url, inputRows, e);
                         return;
                     }
@@ -1840,7 +1840,7 @@ public:
                 if (master->timeLimitExceeded)
                 {
                     processException(url, inputRows, e);
-                    master->logctx.CTXLOG("%sCALL exiting: time limit (%"I64F"d) exceeded", master->wscType == STsoap ? "SOAP" : "HTTP", (unsigned __int64) master->timeLimit);
+                    master->logctx.CTXLOG("%sCALL exiting: time limit (%u) exceeded", master->wscType == STsoap ? "SOAP" : "HTTP", master->timeLimit);
                     break;
                 }
 

+ 4 - 4
dali/sdsfix/sdsfix.cpp

@@ -1502,7 +1502,7 @@ void deleteBranch(const char *path,bool backup)
             if (bakname.charAt(i)==':')
                 bakname.setCharAt(i,'_');
         bakname.append(".bak");
-        DBGLOG("Saving backup of %s/%s to %s",head.str(),tail,bakname.str());
+        DBGLOG("Saving backup of %s to %s",path,bakname.str());
         Owned<IFile> f = createIFile(bakname.str());
         Owned<IFileIO> io = f->open(IFOcreate);
         Owned<IFileIOStream> fstream = createBufferedIOStream(io);
@@ -1822,7 +1822,7 @@ void import(const char *path,const char *src,bool add)
             Owned<IPropertyTree> broot = bconn->getRoot();
             StringBuffer bakname(src);
             bakname.append(".bak");
-            DBGLOG("Saving backup of %s%s to %s",path,tail,bakname.str());
+            DBGLOG("Saving backup of %s to %s",path,bakname.str());
             Owned<IFile> f = createIFile(bakname.str());
             Owned<IFileIO> io = f->open(IFOcreate);
             Owned<IFileIOStream> fstream = createBufferedIOStream(io);
@@ -1883,7 +1883,7 @@ void bimport(const char *path,const char *src,bool add)
             Owned<IPropertyTree> broot = bconn->getRoot();
             StringBuffer bakname(src);
             bakname.append(".bak");
-            DBGLOG("Saving backup of %s%s to %s",path,tail,bakname.str());
+            DBGLOG("Saving backup of %s to %s",path,bakname.str());
             Owned<IFile> f = createIFile(bakname.str());
             Owned<IFileIO> io = f->open(IFOcreate);
             Owned<IFileIOStream> fstream = createBufferedIOStream(io);
@@ -5635,7 +5635,7 @@ void XMLcheckfix(IPropertyTree &tree,StringBuffer &path,const char *name,const c
         return;
     StringBuffer compressedout;
     if (compressRepeatedEscape(value,compressedout)) {
-        PROGLOG("%s%s from %d to %d '%s'",path.str(),name,(int)strlen(value),compressedout.length(),compressedout.str());
+        PROGLOG("%s%s from %u to %u '%s'",path.str(),name,(unsigned)strlen(value),compressedout.length(),compressedout.str());
         if (fix||check) {
             try {
                 Owned<IRemoteConnection> conn = querySDS().connect(path.str(), myProcessSession(), 0, 5*60*1000);