浏览代码

HPCC-14578 Fix jlib warnings

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 年之前
父节点
当前提交
914e034741

+ 2 - 0
cmake_modules/commonSetup.cmake

@@ -285,6 +285,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses -Werror=bool-conversions -Werror=return-type -Werror=comment")
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Werror=bitwise-op-parentheses -Werror=tautological-compare")
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Wno-switch-enum -Wno-format-zero-length -Wno-switch")
+      SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Qunused-arguments")  # Silence messages about pthread not being used when linking...
+      
       if (CLANG_VERSION VERSION_GREATER 3.6 OR CLANG_VERSION VERSION_EQUAL 3.6 OR APPLE_CLANG_VERSION VERSION_GREATER 6.0)
         SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pointer-bool-conversion")
       endif()

+ 9 - 2
system/jlib/CMakeLists.txt

@@ -30,6 +30,10 @@ CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
 CHECK_LIBRARY_EXISTS(crypt crypt "" HAVE_LIBCRYPT) 
 endif ()
 
+if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
+  SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-switch -Wno-unused-parameter -Werror")
+endif()
+
 set (    SRCS 
     ${SCM_GENERATED_INCLUDES}
          jargv.cpp 
@@ -152,8 +156,11 @@ set (    INCLUDES
         )
 
 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
-    set_source_files_properties (jmalloc.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
-    set_source_files_properties (jencrypt.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
+    set_property (SOURCE jmalloc.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-strict-aliasing")
+    set_property (SOURCE jencrypt.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-strict-aliasing")
+endif ()
+if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0)
+    set_property (SOURCE jencrypt.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-array-bounds")   # Compiler erroneously reports array bounds errors in some cases
 endif ()
 
 include_directories ( 

+ 1 - 1
system/jlib/jargv.hpp

@@ -33,7 +33,7 @@ class jlib_decl ArgvIterator
 {
 public:
     ArgvIterator(int _argc, const char* _argv[]) :
-      argc(_argc), argv(_argv)
+        argv(_argv), argc(_argc)
     {
         cur = 1;
     }

+ 1 - 2
system/jlib/jarray.hpp

@@ -278,7 +278,6 @@ public:
     void popn(aindex_t n, bool nodestruct = false)
     {
         assertex(SELF::used>=n);
-        MEMBER * head= (MEMBER *)SELF::_head;
         while (n--)
         {
             --SELF::used;
@@ -440,7 +439,7 @@ public:
     {
         member = &newValue;
     }
-    static inline void destruct(ITEM * & member)
+    static inline void destruct(ITEM * & member __attribute__((unused)))
     {
     }
     static inline bool matches(ITEM * const & member, ITEM & param)

+ 1 - 1
system/jlib/javahash.hpp

@@ -52,7 +52,7 @@ private:
         return static_cast<const ELEMENT *>(et)->getHash(); 
     }
     inline const void * getFindParam(const void * et) const { return et; }
-    inline bool matchesFindParam(const void * et, const void * key, unsigned fphash) const
+    inline bool matchesFindParam(const void * et, const void * key, unsigned fphash __attribute__((unused))) const
     { 
         return static_cast<const ELEMENT *>(et)->equals(*static_cast<const ELEMENT *>(key)); 
     }

+ 1 - 1
system/jlib/jbuff.cpp

@@ -444,7 +444,7 @@ MemoryBuffer::MemoryBuffer(size_t initial)
     _realloc((size32_t)initial);
 }
 
-MemoryBuffer::MemoryBuffer(MemoryBuffer & value)
+MemoryBuffer::MemoryBuffer(MemoryBuffer & value __attribute__((unused)))
 {
     assertex(!"This should never be used");
 }

+ 1 - 1
system/jlib/jbuff.hpp

@@ -182,7 +182,7 @@ public:
     MemoryBuffer &  readFile(StringAttr &fileName);
     MemoryBuffer &  readSwap(size32_t len, void * value);
     const byte *    readDirect(size32_t len);                                       // for efficiency
-    inline MemoryBuffer &  readMemSize(memsize_t & value) { __int64 val; read(val); value = (memsize_t)val; assertex(val == (memsize_t)value); return *this; }
+    inline MemoryBuffer &  readMemSize(memsize_t & value) { __int64 val; read(val); value = (memsize_t)val; assertex(val == (__int64) value); return *this; }
     MemoryBuffer &  skip(unsigned len);
     void            writeDirect(size32_t pos,size32_t len,const void *buf);         // NB does not extend buffer
     void            writeEndianDirect(size32_t pos,size32_t len,const void *buf);   // NB does not extend buffer

+ 1 - 1
system/jlib/jcomp.cpp

@@ -226,7 +226,7 @@ class CCompilerThreadParam : CInterface
 {
 public:
     IMPLEMENT_IINTERFACE;
-    CCompilerThreadParam(const StringBuffer & _cmdline, Semaphore & _finishedCompiling, const StringBuffer & _logfile) : cmdline(_cmdline), finishedCompiling(_finishedCompiling), logfile(_logfile) {};
+    CCompilerThreadParam(const StringBuffer & _cmdline, Semaphore & _finishedCompiling, const StringBuffer & _logfile) : cmdline(_cmdline), logfile(_logfile), finishedCompiling(_finishedCompiling) {};
 
     StringBuffer        cmdline;
     StringBuffer        logfile;

+ 0 - 1
system/jlib/jcrc.cpp

@@ -159,7 +159,6 @@ unsigned crc32(const char *buf, unsigned len, unsigned crc)
 # include <stdint.h>
 #endif
 
-const uint32_t Polynomial = 0xEDB88320;
 
 const static uint32_t Crc32Lookup[8][256] =
 {

+ 25 - 21
system/jlib/jdebug.cpp

@@ -299,7 +299,9 @@ double getCycleToNanoScale()
 
 #else
 
+#if defined(CLOCK_MONOTONIC) && !defined(__APPLE__)
 static bool use_gettimeofday=false;
+#endif
 #if defined(_ARCH_X86_) || defined(_ARCH_X86_64_)
 static bool useRDTSC = _USE_RDTSC;
 #endif
@@ -461,9 +463,9 @@ MTimeSection::~MTimeSection()
 class TimeSectionInfo : public MappingBase 
 {
 public:
-    TimeSectionInfo(const char * _scope, const char *_description, __int64 _cycles) : scope(_scope), description(_description), totalcycles(_cycles), count(1), maxcycles(_cycles) {};
+    TimeSectionInfo(const char * _scope, const char *_description, __int64 _cycles) : scope(_scope), description(_description), totalcycles(_cycles), maxcycles(_cycles), count(1) {};
     TimeSectionInfo(const char * _scope, const char *_description, __int64 _cycles, __int64 _maxcycles, unsigned _count)
-    : scope(_scope), description(_description), totalcycles(_cycles), count(_count), maxcycles(_maxcycles) {};
+    : scope(_scope), description(_description), totalcycles(_cycles), maxcycles(_maxcycles), count(_count) {};
     TimeSectionInfo(MemoryBuffer &mb)
     {
         mb.read(scope).read(description).read(totalcycles).read(maxcycles).read(count);
@@ -548,11 +550,11 @@ public:
         CriticalBlock b(c);
         return sections->count();
     }
-    virtual StatisticKind getTimerType(unsigned idx)
+    virtual StatisticKind getTimerType(unsigned idx __attribute__((unused)))
     {
         return StTimeElapsed;
     }
-    virtual StatisticScopeType getScopeType(unsigned idx)
+    virtual StatisticScopeType getScopeType(unsigned idx __attribute__((unused)))
     {
         return SSTsection;
     }
@@ -1115,7 +1117,6 @@ void getMemStats(StringBuffer &out, unsigned &memused, unsigned &memtot)
         muval = 100; // !
 
 
-    unsigned sum = (unsigned)((arena+mmapmem)/1024); 
     out.appendf("MU=%3u%% MAL=%" I64F "d MMP=%" I64F "d SBK=%" I64F "d TOT=%uK RAM=%uK SWP=%uK", 
         muval, total, mmapmem, sbrkmem, (unsigned)(proctot/1024), mu, su);
 #ifdef _USE_MALLOC_HOOK
@@ -1289,17 +1290,15 @@ public:
         unsigned i = 0;
         while (*s&&(*s!=')')&&(i<15))
             cmd[i++] = *(s++);
-        if (!*s)
+        if (*s != ')')
             return false;
         cmd[i] = 0;
-        s+=2;
-
-        char state = *(s++);
+        s+=3; // Skip ") X" where X is the state
 
         //The PID of the parent process
         const char *num;
         s = skipnumfld(s,num);
-        int ppid = atoi(num);
+        //int ppid = atoi(num);
 
         // skip pgrp, session, tty_num, tpgid, flags, min_flt, cmin_flt, maj_flt, cmaj_flt
         for (i=0;i<9;i++)
@@ -2033,8 +2032,10 @@ static class CMemoryUsageReporter: public Thread
     PerfMonMode traceMode;
     IPerfMonHook * hook;
     unsigned latestCPU;
+#if defined(USE_OLD_PU) || defined(_WIN32)
     double                         dbIdleTime;
     double                         dbSystemTime;
+#endif
 #ifdef _WIN32
     LONG                           status;
     LARGE_INTEGER                  liOldIdleTime;
@@ -2367,6 +2368,7 @@ public:
 } *MemoryUsageReporter=NULL;
 
 
+#ifdef _WIN32
 static inline unsigned scaleFileTimeToMilli(unsigned __int64 nano100)
 {
     return (unsigned)(nano100 / 10000);
@@ -2374,19 +2376,21 @@ static inline unsigned scaleFileTimeToMilli(unsigned __int64 nano100)
 
 void getProcessTime(UserSystemTime_t & result)
 {
-#ifdef _WIN32
     LARGE_INTEGER startTime, exitTime, kernelTime, userTime;
     if (GetProcessTimes(GetCurrentProcess(), (FILETIME *)&startTime, (FILETIME *)&exitTime, (FILETIME *)&kernelTime, (FILETIME *)&userTime))
     {
         result.user = scaleFileTimeToMilli(userTime.QuadPart);
         result.system = scaleFileTimeToMilli(kernelTime.QuadPart);
     }
+}
 #else
+void getProcessTime(UserSystemTime_t & result)
+{
     UserStatusInfo info(GetCurrentProcessId());
     if (info.update())
         result = info.time;
-#endif
 }
+#endif
 
 
 
@@ -2632,14 +2636,14 @@ void printProcMap(const char *fn, bool printbody, bool printsummary, StringBuffe
                         dev[i++] = *(ln++);
                 dev[i] = 0;
                 skipSp(ln);
-                unsigned inode = (unsigned)readDecNum(ln);
+                unsigned inode __attribute__((unused)) = (unsigned) readDecNum(ln);
                 skipSp(ln);
                 const char *path = ln;
                 if (printbody) {
                     if (useprintf)
-                        printf("%08" I64F "x,%08" I64F "x,%" I64F "d,%08" I64F "x,%s,%s\n",start,end,(offset_t)(end-start),offset,perms,path);
+                        printf("%08" I64F "x,%08" I64F "x,%" I64F "d,%08" I64F "x,%s,%s,%s\n",start,end,(offset_t)(end-start),offset,perms,dev,path);
                     else
-                        PROGLOG("%08" I64F "x,%08" I64F "x,%" I64F "d,%08" I64F "x,%s,%s",start,end,(offset_t)(end-start),offset,perms,path);
+                        PROGLOG("%08" I64F "x,%08" I64F "x,%" I64F "d,%08" I64F "x,%s,%s,%s",start,end,(offset_t)(end-start),offset,perms,dev,path);
                 }
                 SegTypes t = segtype_data;
                 if (strcmp(perms,"---p")==0)
@@ -3383,12 +3387,12 @@ __int64 getTotalMem()
 
 #else // release
 
-unsigned jlib_decl setAllocHook(bool on)
+unsigned jlib_decl setAllocHook(bool on __attribute__((unused)))
 {
     return 0;
 }
 
-__int64 jlib_decl setAllocHook(bool on,bool clear)
+__int64 jlib_decl setAllocHook(bool on __attribute__((unused)), bool clear __attribute__((unused)))
 {
     return 0;
 }
@@ -3430,16 +3434,16 @@ public:
     }
 
     // interface ILogMsgHandler
-    virtual void handleMessage(const LogMsg & msg) const {  counter++; }
+    virtual void handleMessage(const LogMsg & msg __attribute__((unused))) const {  counter++; }
     virtual bool needsPrep() const { return false; }
     virtual void prep() {}
     virtual unsigned queryMessageFields() const { return MSGFIELD_detail; }
-    virtual void setMessageFields(unsigned _fields = MSGFIELD_all) {}
-    virtual void addToPTree(IPropertyTree * parent) const {}
+    virtual void setMessageFields(unsigned _fields __attribute__((unused)) = MSGFIELD_all) {}
+    virtual void addToPTree(IPropertyTree * parent __attribute__((unused))) const {}
     virtual int flush() { return 0; }
     virtual char const *disable() { return 0; }
     virtual void enable() {}
-    virtual bool getLogName(StringBuffer &name) const { return false; }
+    virtual bool getLogName(StringBuffer &name __attribute__((unused))) const { return false; }
 
     // interface IUserMetric
     virtual unsigned __int64 queryCount() const { return counter; }

+ 1 - 2
system/jlib/jdebug.hpp

@@ -42,9 +42,8 @@ void jlib_decl display_time(const char * title, cycle_t diff);
 inline cycle_t getTSC() { __asm { __asm _emit 0x0f __asm _emit 0x31 } }
 #pragma warning(pop)
 #elif !defined(_WIN32)
-inline volatile __int64 getTSC()
+inline __int64 getTSC()
 {
-   cycle_t x;
    unsigned a, d;
    __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
    return ((cycle_t)a)|(((cycle_t)d) << 32);

文件差异内容过多而无法显示
+ 768 - 768
system/jlib/jencrypt.cpp


+ 5 - 1
system/jlib/jexcept.cpp

@@ -941,7 +941,9 @@ protected:
 #endif
 #else
 #ifdef LINUX_SIGNAL_EXCEPTION
+#ifndef NO_LINUX_SEH
 static IException *sigsegv_exc;
+#endif
 static int excsignal;
 
 class jlib_thrown_decl CSEHException: public CInterface, public ISEH_Exception
@@ -961,6 +963,7 @@ protected:
     StringAttr msg;
 };  
 
+#ifndef NO_LINUX_SEH
 static void throwSigSegV()
 {
     int childpid = fork();
@@ -976,6 +979,7 @@ static void throwSigSegV()
         return;
     throw sigsegv_exc;
 }
+#endif
 
 void excsighandler(int signum, siginfo_t *info, void *extra) 
 {
@@ -1394,7 +1398,7 @@ protected:
 };
 
 CError::CError(WarnErrorCategory _category, ErrorSeverity _severity, int _no, const char* _msg, const char* _filename, int _lineno, int _column, int _position):
-  category(_category),severity(_severity), msg(_msg), filename(_filename)
+  severity(_severity), category(_category), msg(_msg), filename(_filename)
 {
     no = _no;
     lineno = _lineno;

+ 3 - 15
system/jlib/jfile.cpp

@@ -137,7 +137,7 @@ StringBuffer &swapPathDrive(StringBuffer &filename,unsigned fromdrvnum,unsigned
     }
     if (isPathSepChar(c))
         s++;
-    if (*s&&((fromdrvnum==(unsigned)-1)||(*s==(fromdrvnum+'c')))&&((s[1]==':')||(isShareChar(s[1])))) 
+    if (*s&&((fromdrvnum==(unsigned)-1)||(*s==(char) (fromdrvnum+'c')))&&((s[1]==':')||(isShareChar(s[1]))))
         filename.setCharAt((size32_t)(s-filename.str()),todrvnum+'c');
     else if (frommask&&*frommask) { // OSS
         StringBuffer tmp;
@@ -846,7 +846,7 @@ void CFile::copySection(const RemoteFilename &dest, offset_t toOfs, offset_t fro
     IFEflags tgtFlags = IFEnone;
     if (copyFlags & CFflush_write)
         tgtFlags = IFEnocache;
-    OwnedIFileIO targetIO = target->open(IFOwrite, tgtFlags);
+    OwnedIFileIO targetIO = target->open(omode, tgtFlags);
     if (!targetIO)
         throw MakeStringException(-1, "copyFile: target path '%s' could not be created", target->queryFilename());
     MemoryAttr mb;
@@ -1164,6 +1164,7 @@ MODULE_EXIT()
     passwordProvider.clear();
 }
 
+#ifdef _WIN32
 static bool parseShare(const char *filename,IpAddress &machine,StringBuffer &share)
 { // windows share parsing
     if (!filename||!isPathSepChar(filename[0])||(filename[0]!=filename[1]))
@@ -1188,7 +1189,6 @@ static bool parseShare(const char *filename,IpAddress &machine,StringBuffer &sha
         start++;
     }
     return true;
-
 }
 
 static CriticalSection connectcrit;
@@ -1198,7 +1198,6 @@ static bool connectToExternalDrive(const char * const filename)
     CriticalBlock block(connectcrit);
     if (!passwordProvider)
         return false;
-#ifdef _WIN32
 
     StringBuffer share, username, password;
     IpAddress ip;
@@ -1243,15 +1242,12 @@ static bool connectToExternalDrive(const char * const filename)
             return true;
         Sleep(retry*100);
     }
-#endif
     return false;
 }
 
 
 static void disconnectFromExternalDrive(const char * const filename)
 {
-#ifdef _WIN32
-
     CriticalBlock block(connectcrit);
     StringBuffer share;
     IpAddress ip;
@@ -1259,15 +1255,8 @@ static void disconnectFromExternalDrive(const char * const filename)
         return;
     if (share.length()&&isShareChar(share.charAt(share.length()))) 
         WNetCancelConnection2((char *)share.str(), 0, 0);
-#else
-        //TODO: fill in for linux
-#endif
 }
 
-#ifdef _WIN32
-
-
-
 class CWindowsRemoteFile : public CInterface, implements IFile
 {
     IFile               *ifile;
@@ -5493,7 +5482,6 @@ IFileIO *createUniqueFile(const char *dir, const char *prefix, const char *ext,
         ext = "tmp";
     filename.appendf("_%" I64F "x.%x.%x.%s", (__int64)GetCurrentThreadId(), (unsigned)GetCurrentProcessId(), t, ext);
     OwnedIFile iFile = createIFile(filename.str());
-    IFileIO *iFileIO = NULL;
     unsigned attempts = 5; // max attempts
     loop
     {

+ 4 - 5
system/jlib/jflz.cpp

@@ -43,7 +43,7 @@
 */
 
 
-#if !defined(FASTLZ__COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR)
+#if !defined(FASTLZ_COMPRESSOR) && !defined(FASTLZ_DECOMPRESSOR)
 
 // adapted for jlib
 #include "platform.h"
@@ -152,7 +152,7 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
 #undef FASTLZ_DECOMPRESSOR
 #define FASTLZ_COMPRESSOR fastlz2_compress
 #define FASTLZ_DECOMPRESSOR fastlz2_decompress
-static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output);
+static FASTLZ_INLINE int FASTLZ_COMPRESSOR(const void* input, int length, void* output, HTAB_T &htab);
 static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void* output, int maxout);
 #include "jflz.cpp"
 
@@ -1001,14 +1001,13 @@ IExpander *createFastLZExpander()
 
 #define FLZ_BUFFER_SIZE (0x100000)
 
-#define FLZCOMPRESSEDFILEFLAG (I64C(0xc3518de42f15da57))
-
+static const __uint64 FLZCOMPRESSEDFILEFLAG = U64C(0xc3518de42f15da57);
 
 struct FlzCompressedFileTrailer
 {
     offset_t        zfill1;             // must be first
     offset_t        expandedSize;
-    __int64         compressedType;
+    __uint64        compressedType;
     unsigned        zfill2;             // must be last
 };
 

+ 1 - 1
system/jlib/jhash.hpp

@@ -110,7 +110,7 @@ class jlib_decl HashTable
       { return hash(fp, keysize); }
     const void * getFindParam(const void * et) const
       { return const_cast<const void *>(static_cast<const IMapping *>(et)->getKey()); }
-    bool       matchesFindParam(const void * et, const void * key, unsigned fphash) const
+    bool       matchesFindParam(const void * et, const void * key, unsigned fphash __attribute__((unused))) const
       { return keyeq(key, static_cast<const IMapping *>(et)->getKey(), keysize); }
     bool       keyeq(const void *key1, const void *key2, int ksize) const;
     unsigned   hash(const void *key, int ksize) const;

+ 1 - 1
system/jlib/jisem.hpp

@@ -125,7 +125,7 @@ public:
     IMPLEMENT_IINTERFACE;
 
     TokenBucket(unsigned _tokensPerPeriod, unsigned _period, unsigned _maxBucketSize)
-        : tokensPerPeriod(_tokensPerPeriod), period(_period), maxBucketSize(_maxBucketSize), tokens(_maxBucketSize)
+        : tokens(_maxBucketSize), maxBucketSize(_maxBucketSize), tokensPerPeriod(_tokensPerPeriod), period(_period)
     {
         tokensAvailable = _maxBucketSize;
         then = msTick();

+ 5 - 5
system/jlib/jlog.cpp

@@ -134,7 +134,6 @@ StringBuffer & LogMsg::toStringPlain(StringBuffer & out, unsigned fields) const
     }
     if(fields & MSGFIELD_node)
     {
-        size32_t len = out.length();
         sysInfo.queryNode()->getUrlStr(out);
         out.append(" ");
     }
@@ -923,7 +922,8 @@ void FileLogMsgHandlerXML::addToPTree(IPropertyTree * tree) const
 
 // RollingFileLogMsgHandler
 
-RollingFileLogMsgHandler::RollingFileLogMsgHandler(const char * _filebase, const char * _fileextn, unsigned _fields, bool _append, bool _flushes, const char *initialName, const char *_alias, bool daily) : messageFields(_fields), filebase(_filebase), fileextn(_fileextn), append(_append), flushes(_flushes), handle(0), alias(_alias)
+RollingFileLogMsgHandler::RollingFileLogMsgHandler(const char * _filebase, const char * _fileextn, unsigned _fields, bool _append, bool _flushes, const char *initialName, const char *_alias, bool daily)
+  : handle(0), messageFields(_fields), alias(_alias), filebase(_filebase), fileextn(_fileextn), append(_append), flushes(_flushes)
 {
     time_t tNow;
     time(&tNow);
@@ -2486,8 +2486,8 @@ int CSysLogEventLogger::writeDataLog(size32_t datasize, byte const * data)
     off_t fpos = lseek(dataLogFile, 0, SEEK_CUR);
     while(datasize > 0)
     {
-        size32_t written = write(dataLogFile, data, datasize);
-        if(written == -1)
+        ssize_t written = write(dataLogFile, data, datasize);
+        if (written == -1)
             return -1;
         data += written;
         datasize -= written;
@@ -2678,7 +2678,7 @@ public:
             _properties->getProp("@logDir", logDir);
     }
 
-    CComponentLogFileCreator(const char *_logDir, const char *_component) : logDir(_logDir), component(_component)
+    CComponentLogFileCreator(const char *_logDir, const char *_component) : component(_component), logDir(_logDir)
     {
         setDefaults();
     }

+ 7 - 1
system/jlib/jlog.hpp

@@ -370,7 +370,13 @@ public:
     inline LogMsgClass        queryClass() const { return msgClass; }
     inline LogMsgDetail       queryDetail() const { return detail; }
     void                      serialize(MemoryBuffer & out) const { out.append(audience).append(msgClass).append(detail); }
-    void                      deserialize(MemoryBuffer & in) { in.read((unsigned &) audience).read((unsigned &) msgClass).read(detail); }
+    void                      deserialize(MemoryBuffer & in)
+    {
+        unsigned a, c, d; in.read(a).read(c).read(d);
+        audience = (LogMsgAudience) a;
+        msgClass = (LogMsgClass) c;
+        detail = (LogMsgDetail) d;
+    }
     LogMsgCategory const      operator ()(unsigned newDetail) const { return LogMsgCategory(audience, msgClass, newDetail); }
 private:
     LogMsgAudience            audience;

+ 1 - 1
system/jlib/jlog.ipp

@@ -213,7 +213,7 @@ class IpLogMsgFilter : public CLogMsgFilter
 {
 public:
     IpLogMsgFilter(const char * name, bool local) : ip(name), localFlag(local) {}
-    IpLogMsgFilter(const IpAddress & _ip, bool local) : localFlag(local), ip(_ip) 
+    IpLogMsgFilter(const IpAddress & _ip, bool local) : ip(_ip), localFlag(local)
     {
     }
     IpLogMsgFilter(bool local) : localFlag(local) { GetHostIp(ip); }

+ 3 - 4
system/jlib/jlzw.cpp

@@ -1827,9 +1827,9 @@ IRandRowExpander *createRandRDiffExpander()
 
 typedef enum { ICFcreate, ICFread, ICFappend } ICFmode;
 
-#define COMPRESSEDFILEFLAG (I64C(0xc0528ce99f10da55))
+static const __int64 COMPRESSEDFILEFLAG = I64C(0xc0528ce99f10da55);
 #define COMPRESSEDFILEBLOCKSIZE (0x10000)
-#define FASTCOMPRESSEDFILEFLAG (I64C(0xc1518de99f10da55))
+static const __int64 FASTCOMPRESSEDFILEFLAG = I64C(0xc1518de99f10da55);
 
 #pragma pack(push,1)
 
@@ -1840,7 +1840,7 @@ struct CompressedFileTrailer
     offset_t        indexPos;       // end of blocks
     size32_t        blockSize;
     size32_t        recordSize;     // 0 is lzw compressed
-    __int64         compressedType;
+    __int64        compressedType;
     unsigned        crc;                // must be last
     unsigned numBlocks() { return (unsigned)((indexPos+blockSize-1)/blockSize); }
     unsigned method()
@@ -1920,7 +1920,6 @@ class CCompressedFile : public CInterface, implements ICompressedFileIO
     CriticalSection crit;
     MemoryBuffer overflow;          // where partial row written
     MemoryAttr prevrowbuf; 
-    bool checkcrc;
     bool setcrc;
     bool writeException;
     Owned<ICompressor> compressor;

+ 9 - 6
system/jlib/jmalloc.cpp

@@ -1734,13 +1734,16 @@ void CSubAllocator::freeMem(void * p)
         b->unlink();
         superallocator.freeMem(b);
     }
-    else if (wasfull) {
+    else if (wasfull)
+    {
         unsigned i;
         CSubAllocatorBlock * f = item(b->recsize,i);
-#ifdef _DEBUG
         if (!f)
+        {
+#ifdef _DEBUG
             HeapError(e_corrupt_sub_block,p);
 #endif
+        }
         b->unlink();
         blks[i].prepend(*b);
     }
@@ -1925,7 +1928,7 @@ IAllocator *createGuardedMemoryAllocator(memsize_t maxtotal, unsigned suballoc_h
 void fillPtr(IAllocator *a,void *p,size32_t sz)
 {
     size32_t us = a->usableSize(p);
-    ASSERTEX(us>=sz);
+    assertex(us>=sz);
     memset(p,sz^0xc7,us);
 }
 
@@ -1933,11 +1936,11 @@ void testFillPtr(IAllocator *a,void *p,size32_t sz)
 {
     size32_t us = a->usableSize(p);
     byte *b = (byte *)p;
-    ASSERTEX(us>=sz);
-    ASSERTEX(us<sz+OSPAGESIZE);
+    assertex(us>=sz);
+    assertex(us<sz+OSPAGESIZE);
     byte t = sz^0xc7;
     while (us--)
-        ASSERTEX(b[us]==t);
+        assertex(b[us]==t);
 }
 
 void testAllocator()

+ 7 - 6
system/jlib/jmisc.cpp

@@ -62,14 +62,19 @@ HiresTimer logTimer;
 class CStdLogIntercept: public ILogIntercept
 {
     bool nl;
+#ifdef MINIMALTRACE
     time_t lastt;
     unsigned lasttpid;
+#endif
     unsigned detail;
 
 public:
     CStdLogIntercept()
     {
+#ifdef MINIMALTRACE
         lasttpid = 0;
+        lastt = 0;
+#endif
         nl = true;
         detail = _LOG_TIME | _LOG_PID | _LOG_TID;
 #ifdef LOGCLOCK
@@ -90,17 +95,13 @@ public:
             time_t tNow;
             time(&tNow);
 #ifdef _WIN32
-            unsigned tpid = GetCurrentThreadId();
-#else
-            unsigned tpid = getpid();
-#endif
-#ifdef _WIN32
             struct tm ltNow = *localtime(&tNow);
 #else
             struct tm ltNow;
             localtime_r(&tNow, &ltNow);
 #endif
 #ifdef MINIMALTRACE
+            unsigned tpid = GetCurrentThreadId();
             if (((detail & _LOG_TID) && tpid!=lasttpid)||((detail & _LOG_TIME) && memcmp(&tNow,&lastt,sizeof(tNow))!=0))
             {
                 lasttpid = tpid;
@@ -793,7 +794,7 @@ BOOL WINAPI ModuleExitHandler ( DWORD dwCtrlType )
     }
     return FALSE; 
 } 
-#else
+#elif defined(__linux__)
 static void UnixAbortHandler(int signo)
 {
     ahType type = ahInterrupt;

+ 2 - 0
system/jlib/jmisc.hpp

@@ -300,8 +300,10 @@ private:
 
 class NoQuickEditSection
 {
+#ifdef _WIN32
     DWORD savedmode;
     bool saved;
+#endif
 public:
     NoQuickEditSection()
     {

+ 0 - 2
system/jlib/jmutex.cpp

@@ -161,7 +161,6 @@ inline bool write_data(int fd, const void *buf, size_t nbytes)
 static bool lock_file(const char *lfpath) 
 {
     unsigned attempt = 0;
-    int err = 0;
     while (attempt < 3) {
         char lckcontents[12];
         int fd = open(lfpath, O_RDWR | O_CREAT | O_EXCL, S_IRWXU);
@@ -201,7 +200,6 @@ static bool lock_file(const char *lfpath)
 
 static void unlock_file(const char *lfpath) 
 {
-    unsigned attempt = 0;
     for (unsigned attempt=0;attempt<10;attempt++) {
         if (unlink(lfpath)>=0)
             return;

+ 4 - 4
system/jlib/jmutex.hpp

@@ -203,7 +203,7 @@ private:
     ThreadId owner;
     unsigned depth;
 #endif
-    inline CriticalSection(CriticalSection & value) { assert(false); } // dummy to prevent inadvertant use as block
+    inline CriticalSection(CriticalSection & value __attribute__((unused))) { assert(false); } // dummy to prevent inadvertant use as block
 public:
     inline CriticalSection()
     {
@@ -377,7 +377,7 @@ class jlib_decl  SpinLock
     atomic_t value;
     unsigned nesting;           // not volatile since it is only accessed by one thread at a time
     struct { volatile ThreadId tid; } owner;
-    inline SpinLock(SpinLock & value) { assert(false); } // dummy to prevent inadvetant use as block
+    inline SpinLock(SpinLock & value __attribute__((unused))) { assert(false); } // dummy to prevent inadvetant use as block
 public:
     inline SpinLock()       
     {   
@@ -460,7 +460,7 @@ class jlib_decl NonReentrantSpinLock
 {
     atomic_t value;
     struct { volatile ThreadId tid; } owner; // atomic
-    inline NonReentrantSpinLock(NonReentrantSpinLock & value) { assert(false); } // dummy to prevent inadvertent use as block
+    inline NonReentrantSpinLock(NonReentrantSpinLock & value __attribute__((unused))) { assert(false); } // dummy to prevent inadvertent use as block
 public:
     inline NonReentrantSpinLock()       
     {
@@ -488,7 +488,7 @@ public:
 class jlib_decl  NonReentrantSpinLock
 {
     atomic_t value;
-    inline NonReentrantSpinLock(NonReentrantSpinLock & value) { assert(false); } // dummy to prevent inadvertent use as block
+    inline NonReentrantSpinLock(NonReentrantSpinLock & value __attribute__((unused))) { assert(false); } // dummy to prevent inadvertent use as block
 public:
     inline NonReentrantSpinLock()       
     {   

+ 19 - 23
system/jlib/jptree.cpp

@@ -530,7 +530,6 @@ inline static void readID(const char *&xxpath, bool started)
 
 inline static void readWildId(const char *&xpath, bool &wild)
 {
-    const char *start = xpath;
     wild = false;
     loop
     {
@@ -1334,7 +1333,7 @@ void PTree::addProp(const char *xpath, const char *val)
     else if ('[' == *xpath)
     {
         aindex_t pos = getChildMatchPos(xpath);
-        if (-1 == pos)
+        if ((aindex_t) -1 == pos)
             throw MakeIPTException(-1, "addProp: qualifier unmatched %s", xpath);
         addLocal((size32_t)strlen(val)+1, val, false, pos);
     }
@@ -1366,7 +1365,7 @@ void PTree::appendProp(const char *xpath, const char *val)
     else if ('[' == *xpath)
     {
         aindex_t pos = getChildMatchPos(xpath);
-        if (-1 == pos)
+        if ((aindex_t) -1 == pos)
             throw MakeIPTException(-1, "appendProp: qualifier unmatched %s", xpath);
         appendLocal((size_t)strlen(val)+1, val, false);
     }
@@ -1479,7 +1478,7 @@ void PTree::addPropInt64(const char *xpath, __int64 val)
         char buf[23];
         numtostr(buf, val);
         aindex_t pos = getChildMatchPos(xpath);
-        if (-1 == pos)
+        if ((aindex_t) -1 == pos)
             throw MakeIPTException(-1, "addPropInt64: qualifier unmatched %s", xpath);
         addLocal((size32_t)strlen(buf)+1, buf, false, pos);
     }
@@ -1660,7 +1659,7 @@ void PTree::addPropBin(const char *xpath, size32_t size, const void *data)
     else if ('[' == *xpath)
     {
         aindex_t pos = getChildMatchPos(xpath);
-        if (-1 == pos)
+        if ((aindex_t) -1 == pos)
             throw MakeIPTException(-1, "addPropBin: qualifier unmatched %s", xpath);
         addLocal(size, data, true, pos);
     }
@@ -1686,7 +1685,7 @@ void PTree::appendPropBin(const char *xpath, size32_t size, const void *data)
     else if ('[' == *xpath)
     {
         aindex_t pos = getChildMatchPos(xpath);
-        if (-1 == pos)
+        if ((aindex_t) -1 == pos)
             throw MakeIPTException(-1, "appendPropBin: qualifier unmatched %s", xpath);
         appendLocal(size, data, true);
     }
@@ -1838,7 +1837,7 @@ IPropertyTree *PTree::addPropTree(const char *xpath, IPropertyTree *val)
             if (qualifier.length())
             {
                 pos = ((PTree *)child)->getChildMatchPos(qualifier);
-                if (-1 == pos)
+                if ((aindex_t) -1 == pos)
                     throw MakeIPTException(-1, "addPropTree: qualifier unmatched %s", xpath);
             }
             IPropertyTree *_val = ownPTree(val);
@@ -1853,7 +1852,7 @@ IPropertyTree *PTree::addPropTree(const char *xpath, IPropertyTree *val)
                 PTree *tree = static_cast<PTree *>(child);
                 if (tree->value && tree->value->isArray())
                 {
-                    if (-1 == pos)
+                    if ((aindex_t) -1 == pos)
                         tree->value->addElement(_val);
                     else
                         tree->value->setElement(pos, _val);
@@ -1862,8 +1861,8 @@ IPropertyTree *PTree::addPropTree(const char *xpath, IPropertyTree *val)
                 {
                     IPTArrayValue *array = new CPTArray();
                     array->addElement(LINK(child));
-                    assertex(-1 == pos || 0 == pos);
-                    if (-1 == pos)
+                    assertex((aindex_t) -1 == pos || 0 == pos);
+                    if ((aindex_t) -1 == pos)
                         array->addElement(_val);
                     else
                         array->setElement(0, _val);
@@ -2030,7 +2029,7 @@ IAttributeIterator *PTree::getAttributes(bool sorted) const
     public:
         IMPLEMENT_IINTERFACE;
 
-        CAttributeIterator(const PTree *_parent) : parent(_parent), cur(NULL) 
+        CAttributeIterator(const PTree *_parent) : cur(NULL), parent(_parent)
         {
             index = 0;
             cur = NULL;
@@ -2099,7 +2098,7 @@ IAttributeIterator *PTree::getAttributes(bool sorted) const
             return stricmp((*ll)->key->get(), (*rr)->key->get());
         };
 
-        CSortedAttributeIterator(const PTree *_parent) : parent(_parent), iter(NULL), cur(NULL)
+        CSortedAttributeIterator(const PTree *_parent) : cur(NULL), iter(NULL), parent(_parent)
         {
             unsigned i = parent->queryAttributes().count();
             if (i)
@@ -2232,7 +2231,7 @@ restart:
             if ('\0' == *xpath)
                 return new SingleIdIterator(*this);
             else if ('/' != *xpath)
-                throw MakeXPathException(xpath-1, PTreeExcpt_XPath_Unsupported, 0, "");
+                throw MakeXPathException(xpath-1, PTreeExcpt_XPath_Unsupported, 0, "\"/\" expected");
             goto restart;
         case '/':
             ++xpath;
@@ -3196,7 +3195,7 @@ bool isEmptyPTree(IPropertyTree *t)
 
 ///////////////////
 
-PTLocalIteratorBase::PTLocalIteratorBase(const PTree *_tree, const char *_id, bool _nocase, bool _sort) : tree(_tree), id(_id), nocase(_nocase), sort(_sort)
+PTLocalIteratorBase::PTLocalIteratorBase(const PTree *_tree, const char *_id, bool _nocase, bool _sort) : nocase(_nocase), sort(_sort), id(_id), tree(_tree)
 {
     class CPTArrayIterator : public ArrayIIteratorOf<IArrayOf<IPropertyTree>, IPropertyTree, IPropertyTreeIterator>
     {
@@ -3282,7 +3281,7 @@ bool PTIdMatchIterator::match()
 
 ////////////////////////////
 
-SingleIdIterator::SingleIdIterator(const PTree &_tree, unsigned pos, unsigned _many) : tree(_tree), many(_many), start(pos-1), whichNext(pos-1), count(0), current(NULL)
+SingleIdIterator::SingleIdIterator(const PTree &_tree, unsigned pos, unsigned _many) : many(_many), count(0), whichNext(pos-1), start(pos-1), current(NULL), tree(_tree)
 {
     tree.Link();
 }
@@ -3323,7 +3322,7 @@ bool SingleIdIterator::first()
 
 bool SingleIdIterator::next()
 {
-    if ((whichNext>=count) || (-1 != many && whichNext>start+many))
+    if ((whichNext>=count) || ((unsigned) -1 != many && whichNext>start+many))
     {
         current = NULL;
         return false;
@@ -3453,7 +3452,7 @@ bool PTStackIterator::next()
                     separator=false;
                     ++xxpath;
                     if (*xpath && '/' != *xpath)
-                        throw MakeXPathException(xpath-1, PTreeExcpt_XPath_Unsupported, 0, "");
+                        throw MakeXPathException(xpath-1, PTreeExcpt_XPath_Unsupported, 0, "\"/\" expected");
                     break;
                 case '/':
                     ++xxpath;
@@ -3791,7 +3790,7 @@ private:
 
 public:
     CommonReaderBase(ISimpleReadStream &_stream, IPTreeNotifyEvent &_iEvent, PTreeReaderOptions _readerOptions, size32_t _bufSize=0) :
-        readerOptions(_readerOptions), iEvent(&_iEvent), bufSize(_bufSize)
+        bufSize(_bufSize), readerOptions(_readerOptions), iEvent(&_iEvent)
     {
         if (!bufSize) bufSize = 0x8000;
         buf = new byte[bufSize];
@@ -4855,7 +4854,6 @@ public:
             case tagAttributes:
             {
                 skipWS();
-                bool base64 = false;
                 if (nextChar == '>')
                     state = tagContent;
                 else
@@ -5702,7 +5700,6 @@ static void _validateXPathSyntax(const char *xpath);
 static void validateQualifier(const char *&xxpath)
 {
     const char *xpath = xxpath;
-    bool wild = true; // true by default now, introduced  ~ syntax, to denote wild string
     const char *start = xpath;
     skipWS(xpath);
     const char *lhsStart = xpath;
@@ -5748,14 +5745,13 @@ static void validateQualifier(const char *&xxpath)
         skipWS(xpath);
         if ('~' == *xpath)
         {
-            wild = true;
-            ++xpath;
+            ++xpath;  // Signifies wild (now always true but still accepted...)
         }
         skipWS(xpath);
         char qu = *xpath;
         if (qu != '\'' && qu != '\"')
             throw MakeXPathException(xpath, PTreeExcpt_XPath_ParseError, 0, "Syntax error - no opening \" or \'");
-        const char *textStart = ++xpath;
+        ++xpath;
         while (*xpath && *xpath != qu)
             xpath++;
         if (!*xpath)

+ 1 - 1
system/jlib/jptree.ipp

@@ -312,7 +312,7 @@ public:
     ChildMap *queryChildren() { return children; }
     aindex_t findChild(IPropertyTree *child, bool remove=false);
     inline bool isnocase() const { return IptFlagTst(flags, ipt_caseInsensitive); }
-    const ipt_flags queryFlags() const { return (ipt_flags) flags; }
+    ipt_flags queryFlags() const { return (ipt_flags) flags; }
 public:
     void serializeCutOff(MemoryBuffer &tgt, int cutoff=-1, int depth=0);
     void serializeAttributes(MemoryBuffer &tgt);

+ 0 - 2
system/jlib/jsmartsock.cpp

@@ -346,7 +346,6 @@ ISmartSocket *CSmartSocketFactory::connect()
 
 ISmartSocket *CSmartSocketFactory::connectNextAvailableSocket()
 {
-    int numsockets = sockArray.ordinality();
     while(1)
     {
         try 
@@ -362,7 +361,6 @@ ISmartSocket *CSmartSocketFactory::connectNextAvailableSocket()
             e->Release();   //keep trying
         }
     }
-
     return NULL;  // should never get here, but make the compiler happy
 }
 

+ 14 - 21
system/jlib/jsocket.cpp

@@ -1308,7 +1308,9 @@ void CSocket::connect_wait(unsigned timems)
         }
         else {
             unsigned timeoutms = (exit||(remaining<10000))?10000:remaining;
+    #ifndef BLOCK_POLLED_SINGLE_CONNECTS
             unsigned polltime = 1;
+    #endif
             while (!blockselect && ((err == EINPROGRESS)||(err == EWOULDBLOCK))) {
                 T_FD_SET fds;
                 struct timeval tv;
@@ -1867,7 +1869,6 @@ size32_t CSocket::udp_write_to(const SocketEndpoint &ep, void const* buf, size32
     if (size==0)
         return 0;
     unsigned startt=usTick();
-    size32_t size_writ = size;
     if (state != ss_open) {
         THROWJSOCKEXCEPTION(JSOCKERR_not_opened);
     }
@@ -1990,7 +1991,6 @@ EintrRetry:
     size32_t outbufsize = (total+n-1)/n;
     MemoryAttr ma;
     byte *outbuf = (byte *)ma.allocate(outbufsize);
-    size32_t outwr = 0;
     i = 0;
     size32_t os = 0;
     size32_t left = total;
@@ -2101,17 +2101,8 @@ bool CSocket::send_block(const void *blk,size32_t sz)
         STATS.longestblocksize = sz;
     }
 #ifdef TRACE_SLOW_BLOCK_TRANSFER
-    static unsigned lastreporttime=0;
-    static unsigned lastexceeded=0;
-    if (elapsed>1000000*60) { // over 1min
-        unsigned t = msTick();
-        if (1) { //((t-lastreporttime>1000*60) || // only report once per min
-                 // (elapsed>lastexceeded*2)) {
-            lastexceeded = elapsed;
-            lastreporttime = t;
-            WARNLOG("send_block took %ds to %s  (%d,%d,%d)",elapsed/1000000,tracename,startt2-startt,startt3-startt2,nowt-startt3);
-        }
-    }
+    if (elapsed>1000000*60)  // over 1min
+        WARNLOG("send_block took %ds to %s  (%d,%d,%d)",elapsed/1000000,tracename,startt2-startt,startt3-startt2,nowt-startt3);
 #endif
     return true;
 }
@@ -2659,7 +2650,7 @@ bool getInterfaceIp(IpAddress &ip,const char *ifname)
     unsigned n = ifc.ifc_len/sizeof(struct ifreq);
     for (int loopback = 0; loopback <= 1; loopback++)
     {
-        for (int i=0; i<n; i++)
+        for (unsigned i=0; i<n; i++)
         {
             bool useLoopback = (loopback==1);
             struct ifreq *item = &ifr[i];
@@ -3704,7 +3695,6 @@ public:
     bool sockOk(T_SOCKET sock)
     {
         PROGLOG("CSocketBaseThread: sockOk testing %d",sock);
-        int err = 0;
         int t=0;
         socklen_t tl = sizeof(t);
         if (getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *)&t, &tl)!=0) {
@@ -3927,7 +3917,9 @@ public:
     {
         // must be in CriticalBlock block(sect); 
         unsigned n = items.ordinality();
+#ifdef _WIN32
         bool hashupdateneeded = (n!=basesize); // additions all come at end
+#endif
         for (unsigned i=0;i<n;) {
             SelectItem &si = items.element(i);
             if (si.del) {
@@ -3947,7 +3939,9 @@ public:
                 if (i<n) 
                     si = items.item(n);
                 items.remove(n);
+#ifdef _WIN32
                 hashupdateneeded = true;
+#endif
             }
             else
                 i++;
@@ -4513,8 +4507,7 @@ public:
                 epfdtbl[si.handle] = j;
                 if (si.add_epoll) {
                     si.add_epoll = false;
-                    int srtn, ep_mode;
-                    struct epoll_event event;
+                    int ep_mode;
                     if (si.mode != 0) {
                         ep_mode = 0;
                         if (si.mode & SELECTMODE_READ) {
@@ -4806,9 +4799,11 @@ public:
 };
 #endif // _HAS_EPOLL_SUPPORT
 
+#ifdef _HAS_EPOLL_SUPPORT
 enum EpollMethod { EPOLL_INIT = 0, EPOLL_DISABLED, EPOLL_ENABLED };
 static EpollMethod epoll_method = EPOLL_INIT;
 static CriticalSection epollsect;
+#endif
 
 ISocketSelectHandler *createSocketSelectHandler(const char *trc)
 {
@@ -4944,7 +4939,6 @@ class CSingletonSocketConnection: public CInterface, implements IConversation
     Owned<ISocket> sock;
     Owned<ISocket> listensock;
     enum { Snone, Saccept, Sconnect, Srecv, Ssend, Scancelled } state;
-    bool accepting;
     bool cancelling;
     SocketEndpoint ep;
     CriticalSection crit;
@@ -5533,7 +5527,7 @@ void multiConnect(const SocketEndpointArray &eps, IPointerArrayOf<ISocket> &rets
         IPointerArrayOf<ISocket> &retsockets;
     public:
         cNotify(IPointerArrayOf<ISocket> &_retsockets,CriticalSection &_sect)
-            : retsockets(_retsockets),sect(_sect)
+            : sect(_sect), retsockets(_retsockets)
         {
         }
         
@@ -5681,7 +5675,6 @@ inline bool appendv4range(SocketEndpointArray *array,char *str,SocketEndpoint &e
             }
             StringBuffer tmp;
             ep.getIpText(tmp);
-            size32_t l = tmp.length();
             dc++;
             loop { 
                 if (tmp.length()==0)
@@ -6164,7 +6157,7 @@ int wait_multiple(bool isRead,               //IN   true if wait read, false it
                 dbgSB.appendf(" %d",socks.item(idx));
 #endif
                 readySocks.append(socks.item(idx));
-                if (readySocks.length() == res)
+                if ((int) readySocks.length() == res)
                     break;
             }
         }

+ 1 - 1
system/jlib/jsocket.hpp

@@ -132,7 +132,7 @@ public:
     SocketEndpoint(const char *name,unsigned short _port=0)     { set(name,_port); };
     SocketEndpoint(unsigned short _port)                        { setLocalHost(_port); };
     SocketEndpoint(unsigned short _port, const IpAddress & _ip) { set(_port,_ip); };          
-    SocketEndpoint(const SocketEndpoint &other)                 { set(other); } 
+    SocketEndpoint(const SocketEndpoint &other) : IpAddress(other) { port = other.port; }
 
     void deserialize(MemoryBuffer & in);
     void serialize(MemoryBuffer & out) const;

+ 6 - 27
system/jlib/jsort.cpp

@@ -36,7 +36,6 @@
 
 #ifdef _DEBUG
 // #define PARANOID
-// #define DOUBLE_COMPARE
 //#define TESTPARSORT
 //#define MCMERGESTATS
 #endif
@@ -45,7 +44,6 @@
 //#define TRACE_PARTITION
 
 #define PARALLEL_GRANULARITY 1024
-static const unsigned numPartitionSamples = 3;
 
 static bool sortParallel(unsigned &numcpus)
 {
@@ -857,11 +855,12 @@ void msortvecstableinplace(void ** rows, size_t n, const ICompare & compare, voi
 
 //=========================================================================
 
+#ifdef _USE_TBB
+static const unsigned numPartitionSamples = 3;
 //These constants are probably architecture and number of core dependent
 static const size_t singleThreadedMSortThreshold = 2000;
 static const size_t multiThreadedBlockThreshold = 64;       // must be at least 2!
 
-#ifdef _USE_TBB
 using tbb::task;
 class TbbParallelMergeSorter
 {
@@ -889,7 +888,7 @@ class TbbParallelMergeSorter
     {
     public:
         BisectTask(TbbParallelMergeSorter & _sorter, void ** _rows, size_t _n, void ** _temp, unsigned _depth, task * _next)
-        : sorter(_sorter), rows(_rows), n(_n), temp(_temp), depth(_depth), next(_next)
+        : sorter(_sorter), rows(_rows), temp(_temp), next(_next), n(_n), depth(_depth)
         {
         }
         virtual task * execute()
@@ -965,7 +964,7 @@ class TbbParallelMergeSorter
     {
     public:
         SubSortTask(TbbParallelMergeSorter & _sorter, void ** _rows, size_t _n, void ** _temp, unsigned _depth)
-        : sorter(_sorter), rows(_rows), n(_n), temp(_temp), depth(_depth)
+        : sorter(_sorter), rows(_rows), temp(_temp), n(_n), depth(_depth)
         {
         }
 
@@ -987,7 +986,7 @@ class TbbParallelMergeSorter
     {
     public:
         MergeTask(const ICompare & _compare, void * * _result, size_t _n1, void * * _src1, size_t _n2, void * * _src2, size_t _n)
-        : compare(_compare),result(_result), n1(_n1), src1(_src1), n2(_n2), src2(_src2), n(_n)
+        : compare(_compare),result(_result), src1(_src1), src2(_src2), n1(_n1), n2(_n2), n(_n)
         {
         }
 
@@ -1062,7 +1061,7 @@ class TbbParallelMergeSorter
     {
     public:
         PartitionSplitTask(size_t _n1, void * * _src1, size_t _n2, void * * _src2, unsigned _numPartitions, const ICompare & _compare)
-            : numPartitions(_numPartitions), n1(_n1), n2(_n2), src1(_src1), src2(_src2), compare(_compare)
+            : compare(_compare), numPartitions(_numPartitions), n1(_n1), n2(_n2), src1(_src1), src2(_src2)
         {
             //These could be local variables in calculatePartitions(), but placed here to simplify cleanup.  (Should consider using alloca)
             posLeft = new size_t[numPartitions+1];
@@ -1388,27 +1387,7 @@ public:
 #define INSERTMAX 10000
 #define BUFFSIZE 0x100000   // used for output buffer
 
-
-
 //==================================================================================================
-#ifdef DOUBLE_COMPARE
-#define BuffCompare(a, b) ((MSbuffcomp(a,b,inbuffers,mergeheap,icmp)+MSbuffcomp(a,b,inbuffers,mergeheap,icmp))/2)
-#else
-#define BuffCompare(a, b) MSbuffcomp(a,b,inbuffers,mergeheap,icmp)
-#endif
-
-static inline int MSbuffcomp(unsigned a,unsigned b, void **inbuffers, unsigned *mergeheap, ICompare *icmp)
-{
-    int ret = icmp->docompare(inbuffers[mergeheap[a]], inbuffers[mergeheap[b]]);
-    if (ret==0) 
-        ret = (int)mergeheap[a]-mergeheap[b];
-    return ret;
-}
-
-
-    
-
-
 
 class CRowStreamMerger
 {

+ 3 - 33
system/jlib/jstats.cpp

@@ -963,36 +963,6 @@ void StatsScopeId::setSubgraphId(unsigned _id)
     setId(SSTsubgraph, _id);
 }
 
-
-//Use an atom table to minimimize memory usage in esp.
-//The class could try and use a combination of the scope type and an unsigned, but I suspect not worth it.
-IAtom * createStatsScope(const char * name)
-{
-    //MORE: Should this use a separate atom table?
-    return createAtom(name);
-}
-
-IAtom * createActivityScope(unsigned value)
-{
-    char temp[12];
-    sprintf(temp, ActivityScopePrefix "%u", value);
-    return createStatsScope(temp);
-}
-
-static IAtom * createSubGraphScope(unsigned value)
-{
-    char temp[13];
-    sprintf(temp, SubGraphScopePrefix "%u", value);
-    return createStatsScope(temp);
-}
-
-IAtom * createEdgeScope(unsigned value1, unsigned value2)
-{
-    StringBuffer temp;
-    temp.append(EdgeScopePrefix).append(value1).append("_").append(value2);
-    return createStatsScope(temp);
-}
-
 //--------------------------------------------------------------------------------------------------------------------
 
 enum
@@ -1025,7 +995,7 @@ class CStatisticCollection : public CInterfaceOf<IStatisticCollection>
 {
     friend class CollectionHashTable;
 public:
-    CStatisticCollection(CStatisticCollection * _parent, const StatsScopeId & _id) : parent(_parent), id(_id)
+    CStatisticCollection(CStatisticCollection * _parent, const StatsScopeId & _id) : id(_id), parent(_parent)
     {
     }
 
@@ -1845,7 +1815,7 @@ static void checkKind(StatisticKind kind)
     const char * shortName = queryStatisticName(kind);
     StringBuffer longName;
     queryLongStatisticName(longName, kind);
-    const char * tagName = queryTreeTag(kind);
+    const char * tagName __attribute__ ((unused)) = queryTreeTag(kind);
     const char * prefix = queryMeasurePrefix(measure);
     //Check short names are all correctly prefixed.
     assertex(strncmp(shortName, prefix, strlen(prefix)) == 0);
@@ -1874,7 +1844,7 @@ void verifyStatisticFunctions()
     //Check the various functions return values for all possible values.
     for (unsigned i1=SMeasureAll; i1 < SMeasureMax; i1++)
     {
-        const char * prefix = queryMeasurePrefix((StatisticMeasure)i1);
+        const char * prefix __attribute__((unused)) = queryMeasurePrefix((StatisticMeasure)i1);
         const char * name = queryMeasureName((StatisticMeasure)i1);
         assertex(queryMeasure(name) == i1);
     }

+ 0 - 1
system/jlib/jstring.cpp

@@ -2001,7 +2001,6 @@ const char *decodeXML(const char *x, StringBuffer &ret, const char **errMark, IE
                 default:
                     if (entityHelper)
                     {
-                        bool error = false;
                         const char *start=x+1;
                         const char *finger=start;
                         while (*finger && *finger != ';')

+ 13 - 13
system/jlib/jsuperhash.hpp

@@ -154,8 +154,8 @@ public:
 
     IMPLEMENT_SUPERHASHTABLEOF_REF_FIND(ET, FP);
 
-    virtual void onAdd(void *et) { }
-    virtual void onRemove(void *et) { }
+    virtual void onAdd(void * et __attribute__((unused))) { }
+    virtual void onRemove(void * et __attribute__((unused))) { }
     virtual unsigned getHashFromElement(const void *et) const
     {
         return hashc((const unsigned char *) ((const ET *) et)->queryFindParam(), sizeof(FP), 0);
@@ -168,7 +168,7 @@ public:
     {
         return ((const ET *)et)->queryFindParam();
     }
-    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash) const
+    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash __attribute__((unused))) const
     {
         return *(FP *)((const ET *)et)->queryFindParam() == *(FP *)fp;
     }
@@ -189,7 +189,7 @@ public:
 class jlib_decl SuperHashIterator : public CInterface
 {
 public:
-    SuperHashIterator(const SuperHashTable & _table, bool _linkTable=true) : table(_table), linkTable(_linkTable) { cur = NULL; if (linkTable) table.Link(); }
+    SuperHashIterator(const SuperHashTable & _table, bool _linkTable=true) : linkTable(_linkTable), table(_table) { cur = NULL; if (linkTable) table.Link(); }
     ~SuperHashIterator() { if (linkTable) table.Release(); }
 
     IMPLEMENT_IINTERFACE
@@ -206,7 +206,7 @@ protected:
 private:
     bool linkTable;
     const SuperHashTable & table;
-    void*            cur;
+    void * cur;
 };
 
 template <class ET>
@@ -264,8 +264,8 @@ public:
     StringSuperHashTableOf<ET>(unsigned initsize) : SuperHashTableOf<ET, const char>(initsize) { }
     ~StringSuperHashTableOf<ET>() { SELF::kill(); }
 
-    virtual void onAdd(void *et) { }
-    virtual void onRemove(void *et) { }
+    virtual void onAdd(void *et __attribute__((unused))) { }
+    virtual void onRemove(void *et __attribute__((unused))) { }
     virtual unsigned getHashFromElement(const void *et) const
     {
         const char *str = ((const ET *) et)->queryFindString();
@@ -279,7 +279,7 @@ public:
     {
         return ((const ET *)et)->queryFindString();
     }
-    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash) const
+    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash __attribute__((unused))) const
     {
         return (0==strcmp(((const ET *)et)->queryFindString(), (const char *)fp));
     }
@@ -303,8 +303,8 @@ class ThreadSafeSimpleHashTableOf : private SuperHashTable
 {
     typedef ThreadSafeSimpleHashTableOf<ET, FP> SELF;
 
-    virtual void onAdd(void *et) { }
-    virtual void onRemove(void *et) { }
+    virtual void onAdd(void *et __attribute__((unused))) { }
+    virtual void onRemove(void *et __attribute__((unused))) { }
     virtual unsigned getHashFromElement(const void *et) const
     {
         return hashc((const unsigned char *) ((const ET *) et)->queryFindParam(), sizeof(FP), 0);
@@ -317,7 +317,7 @@ class ThreadSafeSimpleHashTableOf : private SuperHashTable
     {
         return ((const ET *)et)->queryFindParam();
     }
-    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash) const
+    virtual bool matchesFindParam(const void *et, const void *fp, unsigned fphash __attribute__((unused))) const
     {
         return *(FP *)((const ET *)et)->queryFindParam() == *(FP *)fp;
     }
@@ -536,7 +536,7 @@ public:
 
 protected:
 // SuperHashTable definitions
-    virtual void onAdd(void *e) { }
+    virtual void onAdd(void *e __attribute__((unused))) { }
     virtual void onRemove(void *e) 
     { 
         free(e); 
@@ -560,7 +560,7 @@ protected:
         return ((HashKeyElement *) e)->get();
     }
 
-    virtual bool matchesFindParam(const void *e, const void *fp, unsigned fphash) const
+    virtual bool matchesFindParam(const void *e, const void *fp, unsigned fphash __attribute__((unused))) const
     {
         if (nocase)
             return (0 == stricmp(((HashKeyElement *)e)->get(), (const char *)fp));

+ 1 - 2
system/jlib/jthread.cpp

@@ -443,7 +443,6 @@ bool Thread::join(unsigned timeout)
         stopped.signal();
         return true;
     }
-    unsigned count = 0;
     unsigned st = 0;
     loop {                                              // this is to prevent race with destroy
                                                         // (because Thread objects are not always link counted!)
@@ -1688,7 +1687,7 @@ class CLinuxPipeProcess: public CInterface, implements IPipeProcess
         int &hError;
     public:
         cStdErrorBufferThread(size32_t maxbufsize,int &_hError,CriticalSection &_sect)
-            : hError(_hError), sect(_sect)
+            : sect(_sect), hError(_hError)
         {
             buf.allocate(maxbufsize);
             bufsize = 0;

+ 1 - 3
system/jlib/jtime.cpp

@@ -23,8 +23,6 @@
 #include "jexcept.hpp"
 #include "jerror.hpp"
 
-static int tzDelta = 0;                 // Mainly for testing, but could be used for a cache
-
 #ifndef __GNUC__
 
 #if _WIN32 //this appears to be the best way of controlling timezone information used by mktime
@@ -1083,7 +1081,7 @@ public:
     CronTableItem(CronTableItem * _prev, CronTableItem * _next, char const * spec, char const * _tag, bool inframe) : prev(_prev), next(_next), tag(_tag), markDelete(false), markNew(inframe)
     {
         char const * specend = cron.set(spec);
-        if((specend-spec) != strlen(spec))
+        if (*specend)
             throw MakeStringException(0, "Bad cron spec %s", spec);
     }
     CronTableItem * prev;

+ 2 - 25
system/jlib/jutil.cpp

@@ -15,8 +15,8 @@
     limitations under the License.
 ############################################################################## */
 
+#ifdef _WIN32
 #pragma warning(disable: 4996)
-#ifdef _WIN32 
 #include "winprocess.hpp"
 #include <conio.h>
 #endif
@@ -1573,29 +1573,6 @@ int make_daemon(bool printpid)
 
 }
 
-#ifndef _WIN32 
-static int exec(const char* _command)
-{
-    const char* tok=" \t";
-    size32_t sz=16, count=0;
-    char* command = strdup(_command);
-    char **args=(char**)malloc(sz*sizeof(char*));
-    
-    for(char *temp, *p=strtok_r(command,tok,&temp);;p=strtok_r(NULL,tok,&temp))
-    {
-        if(count>=sz)
-            args=(char**)realloc(args,(sz*=2)*sizeof(char*));
-        args[count++]=p;
-        if(!p)
-            break;
-    }
-    int ret=execv(*args,args);
-    free(args);
-    free(command);
-    return ret;
-}
-#endif 
-
 //Calculate the greatest common divisor using Euclid's method
 unsigned __int64 greatestCommonDivisor(unsigned __int64 left, unsigned __int64 right)
 {
@@ -1628,7 +1605,7 @@ void doStackProbe()
 {
     byte local;
     const volatile byte * x = (const byte *)&local;
-    byte forceload = x[-4096];
+    byte forceload __attribute__((unused)) = x[-4096];
 }
 
 #ifdef __GNUC__

+ 0 - 1
system/jlib/jvmem.cpp

@@ -319,7 +319,6 @@ public:
         CriticalBlock block(sect);
         if (!ptr)
             return true;
-        bool ret = false;
         if (sz>SECTIONSIZE) { // was too big, resorted to OS
             free(ptr);
             totalallocated -= sz;