Sfoglia il codice sorgente

HPCC-22956 Turn on -Wall -Wextra for Thor

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 5 anni fa
parent
commit
4d8f0bdb18
54 ha cambiato i file con 168 aggiunte e 204 eliminazioni
  1. 5 5
      ecl/hql/hql.hpp
  2. 5 0
      thorlcr/CMakeLists.txt
  3. 1 3
      thorlcr/activities/diskread/thdiskread.cpp
  4. 2 2
      thorlcr/activities/enth/thenthslave.cpp
  5. 1 3
      thorlcr/activities/fetch/thfetchslave.cpp
  6. 1 1
      thorlcr/activities/firstn/thfirstn.cpp
  7. 5 4
      thorlcr/activities/firstn/thfirstnslave.cpp
  8. 0 1
      thorlcr/activities/funnel/thfunnelslave.cpp
  9. 15 20
      thorlcr/activities/hashdistrib/thhashdistribslave.cpp
  10. 0 2
      thorlcr/activities/indexread/thindexread.cpp
  11. 0 1
      thorlcr/activities/indexread/thindexreadslave.cpp
  12. 2 2
      thorlcr/activities/indexwrite/thindexwriteslave.cpp
  13. 2 0
      thorlcr/activities/join/thjoinslave.cpp
  14. 2 2
      thorlcr/activities/keydiff/thkeydiffslave.cpp
  15. 3 5
      thorlcr/activities/keyedjoin/thkeyedjoinslave-legacy.cpp
  16. 2 6
      thorlcr/activities/keyedjoin/thkeyedjoinslave.cpp
  17. 2 2
      thorlcr/activities/keypatch/thkeypatchslave.cpp
  18. 2 1
      thorlcr/activities/limit/thlimit.cpp
  19. 2 0
      thorlcr/activities/lookupjoin/thlookupjoin.cpp
  20. 2 0
      thorlcr/activities/lookupjoin/thlookupjoincommon.hpp
  21. 15 11
      thorlcr/activities/lookupjoin/thlookupjoinslave.cpp
  22. 1 5
      thorlcr/activities/loop/thloop.cpp
  23. 2 2
      thorlcr/activities/loop/thloopslave.cpp
  24. 0 2
      thorlcr/activities/msort/thmsort.cpp
  25. 4 7
      thorlcr/activities/msort/thsortu.cpp
  26. 0 1
      thorlcr/activities/normalize/thnormalizeslave.cpp
  27. 0 4
      thorlcr/activities/result/thresult.cpp
  28. 0 1
      thorlcr/activities/selectnth/thselectnthslave.cpp
  29. 1 1
      thorlcr/activities/spill/thspillslave.cpp
  30. 2 4
      thorlcr/activities/thactivityutil.cpp
  31. 0 1
      thorlcr/activities/thdiskbase.cpp
  32. 1 1
      thorlcr/activities/thdiskbaseslave.cpp
  33. 1 2
      thorlcr/activities/topn/thtopnslave.cpp
  34. 1 1
      thorlcr/activities/wuidwrite/thwuidwrite.cpp
  35. 1 3
      thorlcr/activities/xmlwrite/thxmlwrite.cpp
  36. 14 12
      thorlcr/graph/thgraph.cpp
  37. 11 10
      thorlcr/graph/thgraph.hpp
  38. 11 11
      thorlcr/graph/thgraphmaster.cpp
  39. 5 4
      thorlcr/graph/thgraphslave.cpp
  40. 3 6
      thorlcr/master/thgraphmanager.cpp
  41. 3 4
      thorlcr/master/thmastermain.cpp
  42. 3 1
      thorlcr/mfilemanager/thmfilemanager.cpp
  43. 0 4
      thorlcr/msort/tsortm.cpp
  44. 1 3
      thorlcr/msort/tsorts.cpp
  45. 0 9
      thorlcr/shared/thor.hpp
  46. 0 1
      thorlcr/slave/backup.cpp
  47. 2 0
      thorlcr/slave/slave.cpp
  48. 0 1
      thorlcr/slave/slave.ipp
  49. 11 16
      thorlcr/slave/slavmain.cpp
  50. 3 3
      thorlcr/slave/thslavemain.cpp
  51. 1 3
      thorlcr/thorutil/thbuf.cpp
  52. 3 1
      thorlcr/thorutil/thmem.cpp
  53. 6 7
      thorlcr/thorutil/thormisc.cpp
  54. 8 2
      thorlcr/thorutil/thormisc.hpp

+ 5 - 5
ecl/hql/hql.hpp

@@ -119,7 +119,7 @@ typedef IAtom ISourcePath;
 struct HQL_API ECLlocation
 {
 public:
-    inline ECLlocation() : lineno(0), column(0), position(0), sourcePath(NULL) {}
+    inline ECLlocation() {}
     ECLlocation(const IHqlExpression * _expr) { if (!extractLocationAttr(_expr)) clear(); }
     ECLlocation(int _line, int _column, int _position, ISourcePath * _sourcePath) { set(_line, _column, _position, _sourcePath); }
 
@@ -170,10 +170,10 @@ public:
 
 public:
 //  Linked<ISourcePath> sourcePath;
-    ISourcePath * sourcePath;
-    int position;
-    int lineno;
-    int column;
+    ISourcePath * sourcePath = nullptr;
+    int position = 0;
+    int lineno = 0;
+    int column = 0;
 };
 
 interface IFileContents;

+ 5 - 0
thorlcr/CMakeLists.txt

@@ -13,6 +13,11 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 ################################################################################
+
+if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-reorder -Wno-unused-parameter -Wno-overloaded-virtual -Wno-delete-non-virtual-dtor")
+endif()
+
 add_subdirectory (activities)
 add_subdirectory (graph)
 add_subdirectory (master)

+ 1 - 3
thorlcr/activities/diskread/thdiskread.cpp

@@ -90,8 +90,8 @@ public:
     virtual void init() override
     {
         CDiskReadMasterVF::init();
-        IHThorDiskReadArg *helper = (IHThorDiskReadArg *)queryHelper();
 #if 0 // JCSMORE
+        IHThorDiskReadArg *helper = (IHThorDiskReadArg *)queryHelper();
         hash = helper->queryRehash();
 #endif
     }
@@ -120,8 +120,6 @@ public:
     }
     virtual void process() override
     {
-        IRecordSize *recordSize = helper->queryOutputMeta();
-
         Owned<IThorRowInterfaces> rowIf = createRowInterfaces(helper->queryOutputMeta());
         OwnedConstThorRow result = getAggregate(*this, container.queryJob().querySlaves(), *rowIf, *helper, mpTag);
         if (!result)

+ 2 - 2
thorlcr/activities/enth/thenthslave.cpp

@@ -105,8 +105,8 @@ public:
         PARENT::start();
         IHThorEnthArg *helper = static_cast <IHThorEnthArg *> (queryHelper());
         counter = 0;
-        denominator = validRC(helper->getProportionDenominator());
-        numerator = validRC(helper->getProportionNumerator());
+        denominator = (rowcount_t)helper->getProportionDenominator();
+        numerator = (rowcount_t)helper->getProportionNumerator();
     }
     virtual bool isGrouped() const override { return false; }
     void getMetaInfo(ThorDataLinkMetaInfo &info) const override

+ 1 - 3
thorlcr/activities/fetch/thfetchslave.cpp

@@ -273,7 +273,6 @@ class CFetchSlaveBase : public CSlaveActivity, implements IFetchHandler
     typedef CSlaveActivity PARENT;
 
     IRowStream *fetchStreamOut = nullptr;
-    unsigned maxKeyRecSize = 0;
     rowcount_t limit = 0;
     unsigned offsetCount = 0;
     unsigned offsetMapSz = 0;
@@ -551,7 +550,6 @@ public:
             prefetchBuffer.setStream(stream);
             prefetcher->readAhead(prefetchBuffer);
             const byte * row = prefetchBuffer.queryRow();
-            size32_t sz = prefetchBuffer.queryRowSize();
             LocalVirtualFieldCallback fieldCallback("<MORE>", fpos, localFpos);
             fetchedLen = translator->queryTranslator().translate(fetchedRowBuilder, fieldCallback, row);
             prefetchBuffer.finishedRow();
@@ -599,7 +597,7 @@ public:
         if (inputStream->eos())
             return 0;
         size32_t maxRowSize = 10*1024*1024; // MORE - make configurable
-        size32_t thisLineLength = csvSplitter.splitLine(inputStream, maxRowSize);
+        csvSplitter.splitLine(inputStream, maxRowSize);
         return ((IHThorCsvFetchArg *)fetchBaseHelper)->transform(rowBuilder, csvSplitter.queryLengths(), (const char * *)csvSplitter.queryData(), keyRow, localFpos);
     }
     virtual void onLimitExceeded()

+ 1 - 1
thorlcr/activities/firstn/thfirstn.cpp

@@ -40,7 +40,7 @@ public:
         IHThorFirstNArg *helper = (IHThorFirstNArg *)queryHelper();
 
         rowcount_t limit = (rowcount_t)helper->getLimit();
-        rowcount_t skip = validRC(helper->numToSkip());
+        rowcount_t skip = (rowcount_t)helper->numToSkip();
         unsigned nslaves = container.queryJob().querySlaves();
         unsigned s = 1;
         for (;;)

+ 5 - 4
thorlcr/activities/firstn/thfirstnslave.cpp

@@ -87,7 +87,7 @@ public:
     virtual void start()
     {
         PARENT::start();
-        skipCount = validRC(helper->numToSkip());
+        skipCount = (rowcount_t)helper->numToSkip();
         limit = (rowcount_t)helper->getLimit();
         firstget = true;
         skipped = 0;
@@ -142,7 +142,7 @@ public:
     virtual void start()
     {
         PARENT::start();
-        skipCount = validRC(helper->numToSkip());
+        skipCount = (rowcount_t)helper->numToSkip();
         limit = (rowcount_t)helper->getLimit();
         countThisGroup = 0;
     }
@@ -216,7 +216,8 @@ class CFirstNSlaveGlobal : public CFirstNSlaveBase, implements ILookAheadStopNot
     bool firstget = true;
     ThorDataLinkMetaInfo inputMeta;
 
-    rowcount_t lastTotalLimitState = 0, lastSkipCountState = RCMAX;
+    rowcount_t lastTotalLimitState = 0;
+    rowcount_t lastSkipCountState = RCMAX;
 
     void sendOnce(rowcount_t count)
     {
@@ -259,7 +260,7 @@ public:
         input->getMetaInfo(inputMeta);
         totallimit = (rowcount_t)helper->getLimit();
 
-        rowcount_t _skipCount = validRC(helper->numToSkip()); // max
+        rowcount_t _skipCount = (rowcount_t)helper->numToSkip(); // max
         if (!isInputFastThrough(0))
         {
             if (hasLookAhead(0) && (lastTotalLimitState == totallimit) && (lastSkipCountState == _skipCount))

+ 0 - 1
thorlcr/activities/funnel/thfunnelslave.cpp

@@ -117,7 +117,6 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
 
     CSlaveActivity &activity;
     CIArrayOf<CInputHandler> inputHandlers;
-    bool startInputs;
     Linked<IException> exception;
     unsigned eoss;
     StringAttr idStr;

+ 15 - 20
thorlcr/activities/hashdistrib/thhashdistribslave.cpp

@@ -231,10 +231,7 @@ protected:
                     if (nesting)
                         nested.append(len, ptr);
                     else
-                    {
-                        size32_t sz = compressor.write(ptr, len);
-                        dbgassertex(sz);
-                    }
+                        verifyex(0 != compressor.write(ptr, len));
                 }
                 virtual size32_t beginNested(size32_t count)
                 {
@@ -1240,7 +1237,9 @@ public:
                 {
                     try
                     {
+#ifdef _DEBUG
                         size32_t sz = recvMb.length();
+#endif
                         if (expander)
                             CSendBucket::deserializeCompress(recvMb, tempMb.clear(), *expander);
                         else
@@ -2207,7 +2206,6 @@ public:
 //===========================================================================
 class CHDRproportional: implements IHash, public CSimpleInterface
 {
-    CActivityBase *activity;
     Owned<IFile> tempfile;
     Owned<IRowStream> tempstrm;
     IHThorHashDistributeArg *args;
@@ -2230,7 +2228,7 @@ class CHDRproportional: implements IHash, public CSimpleInterface
     }
 
 public:
-    CHDRproportional(CActivityBase *_activity, IHThorHashDistributeArg *_args,mptag_t _mastertag) : activity(_activity)
+    CHDRproportional(IHThorHashDistributeArg *_args, mptag_t _mastertag)
     {
         args = _args;
         statstag = _mastertag;
@@ -2436,7 +2434,7 @@ public:
         PARENT::init(data, slaveData);
         mptag_t tag = container.queryJobChannel().deserializeMPTag(data);
         IHThorHashDistributeArg *distribargs = (IHThorHashDistributeArg *)queryHelper();
-        partitioner.setown(new CHDRproportional(this, distribargs,tag));
+        partitioner.setown(new CHDRproportional(distribargs,tag));
         ihash = partitioner;
         setupDist = false;
     }
@@ -2538,7 +2536,7 @@ class CHashTableRowTable : private CThorExpandingRowArray
 {
     CBucket *owner;
     HashDedupSlaveActivityBase &activity;
-    IHash *iRowHash, *iKeyHash;
+    IHash *iKeyHash;
     ICompare *iCompare;
     rowidx_t htElements, htMax;
 
@@ -2569,7 +2567,7 @@ class CHashTableRowTable : private CThorExpandingRowArray
 public:
     IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
 
-    CHashTableRowTable(HashDedupSlaveActivityBase &_activity, IThorRowInterfaces *rowIf, IHash *_iRowHash, IHash *_iKeyHash, ICompare *_iCompare);
+    CHashTableRowTable(HashDedupSlaveActivityBase &_activity, IThorRowInterfaces *rowIf, IHash *_iKeyHash, ICompare *_iCompare);
     inline const void *query(rowidx_t i) const { return CThorExpandingRowArray::query(i); }
     inline void setOwner(CBucket *_owner) { owner = _owner; }
     bool kill()
@@ -2729,9 +2727,7 @@ public:
 class CBucket : public CSimpleInterface
 {
     HashDedupSlaveActivityBase &owner;
-    IThorRowInterfaces *rowIf, *keyIf;
-    IHash *iRowHash, *iKeyHash;
-    ICompare *iCompare;
+    IThorRowInterfaces *keyIf;
     Owned<IEngineRowAllocator> _keyAllocator;
     IEngineRowAllocator *keyAllocator;
     CHashTableRowTable *htRows;
@@ -2746,7 +2742,7 @@ class CBucket : public CSimpleInterface
     bool streamed = false;
 
 public:
-    CBucket(HashDedupSlaveActivityBase &_owner, IThorRowInterfaces *_rowIf, IThorRowInterfaces *_keyIf, IHash *_iRowHash, IHash *_iKeyHash, ICompare *_iCompare, bool _extractKey, unsigned _bucketN, CHashTableRowTable *_htRows);
+    CBucket(HashDedupSlaveActivityBase &_owner, IThorRowInterfaces *_rowIf, IThorRowInterfaces *_keyIf, bool _extractKey, unsigned _bucketN, CHashTableRowTable *_htRows);
     bool addKey(const void *key, unsigned hashValue);
     bool addRow(const void *row, unsigned hashValue);
     void clear();
@@ -3044,7 +3040,7 @@ protected:
             hashTables = (CHashTableRowTable **)_hashTables.getArray();
             for (unsigned i=numHashTables; i<_numHashTables; i++)
             {
-                hashTables[i] = new CHashTableRowTable(*this, keyRowInterfaces, iHash, iKeyHash, rowKeyCompare);
+                hashTables[i] = new CHashTableRowTable(*this, keyRowInterfaces, iKeyHash, rowKeyCompare);
                 hashTables[i]->init(initSize);
             }
         }
@@ -3065,7 +3061,6 @@ public:
         keyRowInterfaces = NULL;
         hashTables = NULL;
         numHashTables = initialNumBuckets = 0;
-        roxiemem::RoxieHeapFlags allocFlags = roxiemem::RHFnone;
         appendOutputLinked(this);
         keepBest = false;
         testSpillTimes = getOptInt("testHashDedupSpillTimes");
@@ -3283,9 +3278,9 @@ friend class CHashTableRowTable;
 friend class CBucket;
 };
 
-CHashTableRowTable::CHashTableRowTable(HashDedupSlaveActivityBase &_activity, IThorRowInterfaces *rowIf, IHash *_iRowHash, IHash *_iKeyHash, ICompare *_iCompare)
+CHashTableRowTable::CHashTableRowTable(HashDedupSlaveActivityBase &_activity, IThorRowInterfaces *rowIf, IHash *_iKeyHash, ICompare *_iCompare)
     : CThorExpandingRowArray(_activity, rowIf, ers_allow),
-      activity(_activity), iRowHash(_iRowHash), iKeyHash(_iKeyHash), iCompare(_iCompare)
+      activity(_activity), iKeyHash(_iKeyHash), iCompare(_iCompare)
 {
     htMax = htElements = 0;
     owner = NULL;
@@ -3350,8 +3345,8 @@ void CHashTableRowTable::rehash(const void **newRows)
 
 //
 
-CBucket::CBucket(HashDedupSlaveActivityBase &_owner, IThorRowInterfaces *_rowIf, IThorRowInterfaces *_keyIf, IHash *_iRowHash, IHash *_iKeyHash, ICompare *_iCompare, bool _extractKey, unsigned _bucketN, CHashTableRowTable *_htRows)
-    : owner(_owner), rowIf(_rowIf), keyIf(_keyIf), iRowHash(_iRowHash), iKeyHash(_iKeyHash), iCompare(_iCompare), extractKey(_extractKey), bucketN(_bucketN), htRows(_htRows),
+CBucket::CBucket(HashDedupSlaveActivityBase &_owner, IThorRowInterfaces *_rowIf, IThorRowInterfaces *_keyIf, bool _extractKey, unsigned _bucketN, CHashTableRowTable *_htRows)
+    : owner(_owner), keyIf(_keyIf), extractKey(_extractKey), bucketN(_bucketN), htRows(_htRows),
       rowSpill(owner, _rowIf, "rows", _bucketN), keySpill(owner, _keyIf, "keys", _bucketN)
 
 {
@@ -3688,7 +3683,7 @@ void CBucketHandler::init(unsigned _numBuckets, IRowStream *keyStream)
     for (unsigned i=0; i<numBuckets; i++)
     {
         CHashTableRowTable &htRows = owner.queryHashTable(i);
-        buckets[i] = new CBucket(owner, rowIf, keyIf, iRowHash, iKeyHash, iCompare, extractKey, i, &htRows);
+        buckets[i] = new CBucket(owner, rowIf, keyIf, extractKey, i, &htRows);
         htRows.setOwner(buckets[i]);
     }
     ActPrintLog(&owner, "Max %d buckets, current depth = %d", numBuckets, depth+1);

+ 0 - 2
thorlcr/activities/indexread/thindexread.cpp

@@ -43,7 +43,6 @@ protected:
     rowcount_t aggregateToLimit()
     {
         rowcount_t total = 0;
-        ICommunicator &comm = queryJobChannel().queryJobComm();
         unsigned slaves = container.queryJob().querySlaves();
         unsigned s;
         for (s=0; s<slaves; s++)
@@ -185,7 +184,6 @@ protected:
                     else
                     {
                         // if not partitionable filter, all parts need to be used
-                        unsigned nparts = f->numParts();
                         for (unsigned p=0; p<f->numParts(); p++)
                             performPartLookup.replace(true, p);
                     }

+ 0 - 1
thorlcr/activities/indexread/thindexreadslave.cpp

@@ -1000,7 +1000,6 @@ class CIndexGroupAggregateSlaveActivity : public CIndexReadSlaveBase, implements
     bool gathered, merging;
     Owned<IAggregateTable> localAggTable;
     Owned<IRowStream> aggregateStream;
-    memsize_t maxMem;
     Owned<IHashDistributor> distributor;
     bool done = false;
 

+ 2 - 2
thorlcr/activities/indexwrite/thindexwriteslave.cpp

@@ -582,7 +582,7 @@ public:
             Owned<IFile> ifile = createIFile(partFname.str());
             offset_t sz = ifile->size();
             mb.append(sz);
-            if (-1 != sz)
+            if ((offset_t)-1 != sz)
                 container.queryJob().queryIDiskUsage().increase(sz);
             CDateTime createTime, modifiedTime, accessedTime;
             ifile->getTime(&createTime, &modifiedTime, &accessedTime);
@@ -596,7 +596,7 @@ public:
                 ifile.setown(createIFile(path.str()));
                 sz = ifile->size();
                 mb.append(sz);
-                if (-1 != sz)
+                if ((offset_t)-1 != sz)
                     container.queryJob().queryIDiskUsage().increase(sz);
                 ifile->getTime(&createTime, &modifiedTime, &accessedTime);
                 modifiedTime.serialize(mb);

+ 2 - 0
thorlcr/activities/join/thjoinslave.cpp

@@ -258,6 +258,8 @@ public:
                 joinhelper.setown(createDenormalizeHelper(*this, helperdn, this));
                 break;
             }
+            default:
+                throwUnexpected();
         }
     }
     void startSecondaryInput()

+ 2 - 2
thorlcr/activities/keydiff/thkeydiffslave.cpp

@@ -160,7 +160,7 @@ public:
         StringBuffer tmpStr;
         Owned<IFile> ifile = createIFile(getPartFilename(*patchPart, 0, tmpStr).str());
         offset_t sz = ifile->size();
-        if (-1 != sz)
+        if ((offset_t)-1 != sz)
             container.queryJob().queryIDiskUsage().increase(sz);
         mb.append(sz);
 
@@ -177,7 +177,7 @@ public:
         {
             Owned<IFile> ifile = createIFile(getPartFilename(*patchTlkPart, 0, tmpStr.clear()).str());
             offset_t sz = ifile->size();
-            if (-1 != sz)
+            if ((offset_t)-1 != sz)
                 container.queryJob().queryIDiskUsage().increase(sz);
             mb.append(sz);
 

+ 3 - 5
thorlcr/activities/keyedjoin/thkeyedjoinslave-legacy.cpp

@@ -355,14 +355,13 @@ static int unsignedcompare(unsigned *i1, unsigned *i2)
 
 class CJoinGroupPool
 {
-    CActivityBase &activity;
     CJoinGroup *groupStart;
 public:
     CJoinGroup head;
     CriticalSection crit;
     bool preserveGroups, preserveOrder;
 
-    CJoinGroupPool(CActivityBase &_activity) : activity(_activity), head(_activity)
+    CJoinGroupPool(CActivityBase &_activity) : head(_activity)
     {
         head.next = &head;
         head.prev = &head;
@@ -858,7 +857,6 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
                                     prefetchBuffer.setStream(stream);
                                     prefetcher->readAhead(prefetchBuffer);
                                     const byte * row = prefetchBuffer.queryRow();
-                                    size32_t sz = prefetchBuffer.queryRowSize();
                                     LocalVirtualFieldCallback fieldCallback("<MORE>", fpos, localFpos);
                                     fetchedLen = translator->queryTranslator().translate(fetchedRowBuilder, fieldCallback, row);
                                     prefetchBuffer.finishedRow();
@@ -1637,8 +1635,6 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
             StringBuffer filename;
             rfn.getPath(filename);
 
-            IPropertyTree const &props = filePart.queryOwner().queryProperties();
-            unsigned publishedFormatCrc = (unsigned)props.getPropInt("@formatCrc", 0);
             Owned<IFileIO> lazyFileIO = queryThor().queryFileCache().lookupIFileIO(*this, indexName, filePart);
             Owned<IDelayedFile> delayedFile = createDelayedFile(lazyFileIO);
             Owned<IKeyIndex> keyIndex = createKeyIndex(filename, crc, *delayedFile, false, false);
@@ -2240,6 +2236,8 @@ public:
                                     transformedSize = helper->transform(row.ensureRow(), djg->queryLeft(), NULL, 0, (const void **)NULL); // no dummrhs (hthor and roxie don't pass)
                                     break;
                                 }
+                                default:
+                                    throwUnexpected();
                             }
                             if (transformedSize)
                                 currentAdded++;

+ 2 - 6
thorlcr/activities/keyedjoin/thkeyedjoinslave.cpp

@@ -1705,7 +1705,6 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
 
             ScopedAtomic<unsigned __int64> diskRejected(activity.statsArr[AS_DiskRejected]);
             ScopedAtomic<unsigned __int64> diskSeeks(activity.statsArr[AS_DiskSeeks]);
-            unsigned numRows = processing.ordinality();
             for (unsigned r=0; r<processing.ordinality() && !stopped; r++)
             {
                 OwnedConstThorRow row = processing.getClear(r);
@@ -2382,10 +2381,7 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
         {
             indexLookupRow.setown(preparePendingLookupRow(keyFieldsRowBuilder.getUnfinalizedClear(), keyFieldsRowBuilder.getMaxLength(), lhsRow, keyedFieldsRowSize));
             if (keyLookupHandlers.isLocalKey())
-            {
-                CLookupHandler *lookupHandler = keyLookupHandlers.queryHandler(0);
                 queueLookupForPart(0, indexLookupRow);
-            }
             else if (!remoteKeyedLookup) // either local only or legacy, either way lookup in all allIndexParts I have
             {
                 ForEachItemIn(p, allIndexParts)
@@ -2625,7 +2621,6 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
         // NB: This is called in partNo ascending order
 
         unsigned partNo = partCopy & partMask;
-        unsigned copy = partCopy >> 24;
         unsigned slave = 0;
         if (partToSlaveMap.size())
         {
@@ -3099,6 +3094,8 @@ public:
                                         ret.setown(rowBuilder.finalizeRowClear(transformedSize));
                                     break;
                                 }
+                                default:
+                                    throwUnexpected();
                             }
                             if (ret)
                                 currentAdded++;
@@ -3459,7 +3456,6 @@ public:
         std::vector<CJoinGroup *> doneJGCandidates, incompleteJGCandidates;
         memsize_t totalToSpill = 0;
         memsize_t totalInUse = 0;
-        unsigned allRows = 0;
 
         CriticalBlock b(onCompleteCrit);
 

+ 2 - 2
thorlcr/activities/keypatch/thkeypatchslave.cpp

@@ -153,7 +153,7 @@ public:
         StringBuffer newIndexFilePath;
         Owned<IFile> ifile = createIFile(getPartFilename(*newIndexPart, 0, newIndexFilePath).str());
         offset_t sz = ifile->size();
-        if (-1 != sz)
+        if ((offset_t)-1 != sz)
             container.queryJob().queryIDiskUsage().increase(sz);
         mb.append(sz);
 
@@ -170,7 +170,7 @@ public:
             StringBuffer filePath;
             Owned<IFile> ifile = createIFile(getPartFilename(*newIndexTlkPart, 0, filePath).str());
             offset_t sz = ifile->size();
-            if (-1 != sz)
+            if ((offset_t)-1 != sz)
                 container.queryJob().queryIDiskUsage().increase(sz);
             mb.append(sz);
 

+ 2 - 1
thorlcr/activities/limit/thlimit.cpp

@@ -57,7 +57,6 @@ public:
             case TAKcreaterowlimit: 
             case TAKskiplimit: 
             {
-                unsigned slaves = container.queryJob().querySlaves();
                 CMessageBuffer mb;
                 mb.append(total);
                 queryJobChannel().queryJobComm().send(mb, RANK_ALL_OTHER, mpTag);
@@ -69,6 +68,8 @@ public:
                     helper->onLimitExceeded();
                 break;
             }
+            default:
+                throwUnexpected();
         }
     }
     virtual void abort()

+ 2 - 0
thorlcr/activities/lookupjoin/thlookupjoin.cpp

@@ -37,6 +37,8 @@ class CLookupJoinActivityMaster : public CMasterActivity
             case TAKalldenormalize:
             case TAKalldenormalizegroup:
                 return true;
+            default:
+                break;
         }
         return false;
     }

+ 2 - 0
thorlcr/activities/lookupjoin/thlookupjoincommon.hpp

@@ -31,6 +31,8 @@ inline bool isSmartJoin(CActivityBase &activity)
         case TAKsmartdenormalize:
         case TAKsmartdenormalizegroup:
             return true;
+        default:
+            break;
     }
     return false;
 }

+ 15 - 11
thorlcr/activities/lookupjoin/thlookupjoinslave.cpp

@@ -286,7 +286,9 @@ class CBroadcaster : public CSimpleInterface
                 if (t>=nodes)
                     t -= nodes;
                 t += 1; // adjust 0 based to 1 based, i.e. excluding master at 0
+#ifdef _TRACEBROADCAST
                 unsigned sendLen = sendItem->length();
+#endif
                 if (0 == sendRecv) // send
                 {
 #ifdef _TRACEBROADCAST
@@ -376,10 +378,8 @@ class CBroadcaster : public CSimpleInterface
                     break;
                 }
                 case bcast_sendStopping:
-                {
                     setStopping(sendItem->queryNode());
-                    // fall through
-                }
+                // fall through
                 case bcast_send:
                 {
                     if (!allRequestStop) // don't care if all stopping
@@ -759,11 +759,11 @@ public:
     {
         return helper->match(lhs, rhsrow);
     }
-    inline const size32_t joinTransform(ARowBuilder &rowBuilder, const void *left, const void *right, unsigned numRows, const void **rows, unsigned flags)
+    inline size32_t joinTransform(ARowBuilder &rowBuilder, const void *left, const void *right, unsigned numRows, const void **rows, unsigned flags)
     {
         return helper->transform(rowBuilder, left, right, numRows, rows, flags);
     }
-    inline const size32_t joinTransform(ARowBuilder &rowBuilder, const void *left, const void *right, unsigned count, unsigned flags)
+    inline size32_t joinTransform(ARowBuilder &rowBuilder, const void *left, const void *right, unsigned count, unsigned flags)
     {
         return helper->transform(rowBuilder, left, right, count, flags);
     }
@@ -956,7 +956,7 @@ protected:
     unsigned numNodes, numSlaves;
     OwnedMalloc<CInMemJoinBase *> channels;
 
-    atomic_t interChannelToNotifyCount; // only used on channel 0
+    std::atomic<unsigned> interChannelToNotifyCount{0}; // only used on channel 0
     InterruptableSemaphore interChannelBarrierSem;
     bool channelActivitiesAssigned;
 
@@ -968,9 +968,9 @@ protected:
     }
     inline bool incNotifyCountAndCheck()
     {
-        if (atomic_add_and_read(&interChannelToNotifyCount, 1) == queryJob().queryJobChannels())
+        if (++interChannelToNotifyCount == queryJob().queryJobChannels())
         {
-            atomic_set(&interChannelToNotifyCount, 0); // reset for next barrier
+            interChannelToNotifyCount = 0; // reset for next barrier
             return true;
         }
         return false;
@@ -1007,6 +1007,8 @@ protected:
             case TAKsmartdenormalizegroup:
             case TAKalldenormalizegroup:
                 return true;
+            default:
+                break;
         }
         return false;
     }
@@ -1021,6 +1023,8 @@ protected:
             case TAKsmartdenormalize:
             case TAKsmartdenormalizegroup:
                 return true;
+            default:
+                break;
         }
         return false;
     }
@@ -1034,6 +1038,8 @@ protected:
             case JT_RightOuter: return str.append("RIGHT OUTER");
             case JT_LeftOnly:   return str.append("LEFT ONLY");
             case JT_RightOnly:  return str.append("RIGHT ONLY");
+            default:
+                break;
         }
         return str.append("---> Unknown Join Type <---");
     }
@@ -1316,7 +1322,6 @@ public:
         numSlaves = queryJob().querySlaves();
         local = container.queryLocal() || (1 == numSlaves);
         rowProcessor = NULL;
-        atomic_set(&interChannelToNotifyCount, 0);
         rhsTableLen = 0;
         leftITDL = rightITDL = NULL;
 
@@ -2708,8 +2713,7 @@ public:
     virtual void start() override
     {
         PARENT::start();
-        if (!isSmart())
-            dbgassertex(leftITDL->isGrouped() == grouped); // std. lookup join expects these to match
+        dbgassertex(isSmart() || (leftITDL->isGrouped() == grouped)); // std. lookup join expects these to match
     }
     virtual void reset() override
     {

+ 1 - 5
thorlcr/activities/loop/thloop.cpp

@@ -173,8 +173,6 @@ class CLoopActivityMaster : public CLoopActivityMasterBase
         Owned<IBitSet> emptyIterationSlaves = createThreadSafeBitSet();
         unsigned loopEnds = 0;
         unsigned nodes = queryJob().querySlaves();
-        unsigned n = nodes;
-        bool allEmptyIterations = true;
         CMessageBuffer msg;
         for (;;)
         {
@@ -314,7 +312,7 @@ public:
         unsigned maxIterations = helper->numIterations();
         if ((int)maxIterations < 0) maxIterations = 0;
         Owned<IThorGraphResults> loopResults = queryGraph().createThorGraphResults(maxIterations);
-        IThorResult *result = loopResults->createResult(*this, 0, this, mergeResultTypes(thorgraphresult_distributed, thorgraphresult_grouped));
+        loopResults->createResult(*this, 0, this, mergeResultTypes(thorgraphresult_distributed, thorgraphresult_grouped));
 
         helper->createParentExtract(extractBuilder);
 
@@ -361,7 +359,6 @@ public:
     virtual void createResult() = 0;
     virtual void process() override
     {
-        IHThorLocalResultWriteArg *helper = (IHThorLocalResultWriteArg *)queryHelper();
         inputRowIf.setown(createRowInterfaces(container.queryInput(0)->queryHelper()->queryOutputMeta()));
         createResult();
     }
@@ -394,7 +391,6 @@ public:
     }
     virtual void createResult()
     {
-        IHThorGraphLoopResultWriteArg *helper = (IHThorGraphLoopResultWriteArg *)queryHelper();
         CGraphBase *graph = container.queryResultsGraph();
         graph->createGraphLoopResult(*this, inputRowIf, mergeResultTypes(thorgraphresult_distributed, thorgraphresult_grouped)); // NB graph owns result
     }

+ 2 - 2
thorlcr/activities/loop/thloopslave.cpp

@@ -342,6 +342,8 @@ public:
                     case TAKloopcount:
                         // NB: finishedLooping set at end of loop, so that last getNextRow() iteration spits out final rows
                         break;
+                    default:
+                        throwUnexpected();
                     }
                 }
 
@@ -1200,7 +1202,6 @@ class CChildThroughNormalizeSlaveActivity : public CSlaveActivity
     Owned<IEngineRowAllocator> allocator;
     OwnedConstThorRow lastInput;
     RtlDynamicRowBuilder nextOutput;
-    size32_t recordsize;
     rowcount_t numProcessedLastGroup;
     bool ok;
 
@@ -1428,7 +1429,6 @@ public:
     }
     virtual IThorResult *createResult()
     {
-        IHThorGraphLoopResultWriteArg *helper = (IHThorGraphLoopResultWriteArg *)queryHelper();
         CGraphBase *graph = container.queryResultsGraph();
         ThorGraphResultType resultType = thorgraphresult_nul;
         if (!queryGraph().isLocalChild())

+ 0 - 2
thorlcr/activities/msort/thmsort.cpp

@@ -61,7 +61,6 @@ public:
         CSortBaseActivityMaster::init();
         IHThorSortArg *helper = (IHThorSortArg *)queryHelper();
         OwnedRoxieString algoname = helper->getAlgorithm();
-        unsigned flags = helper->getAlgorithmFlags();
         if (algoname && (0 != stricmp(algoname, "quicksort")))
         {
             Owned<IException> e = MakeActivityException(this, 0, "Ignoring, unsupported sort order algorithm '%s'", algoname.get());
@@ -97,7 +96,6 @@ protected:
         CSortBaseActivityMaster::init();
         IHThorSortArg *helper = (IHThorSortArg *)queryHelper();
         OwnedRoxieString algoname(helper->getAlgorithm());
-        unsigned flags = helper->getAlgorithmFlags();
         if (algoname && (0 != stricmp(algoname, "quicksort")))
         {
             Owned<IException> e = MakeActivityException(this, 0, "Ignoring, unsupported sort order algorithm '%s'", algoname.get());

+ 4 - 7
thorlcr/activities/msort/thsortu.cpp

@@ -325,7 +325,6 @@ class CJoinHelper : implements IJoinHelper, public CSimpleInterface
     bool betweenjoin = false;
     Owned<IException> onFailException;
     ThorActivityKind kind = TAKnone;
-    activity_id activityId = 0;
     Owned<ILimitedCompareHelper> limitedhelper;
     Owned<CDualCache> dualcache;
     Linked<IEngineRowAllocator> allocator;
@@ -704,6 +703,8 @@ public:
                             denormRows.kill();
                         }
                         break;
+                    default:
+                        break;
                 }
             }
             nextL();            // output outer once
@@ -998,7 +999,6 @@ class SelfJoinHelper: implements IJoinHelper, public CSimpleInterface
     unsigned keepremaining = (unsigned)-1;
     OwnedConstThorRow nextrow;
     Owned<IException> onFailException;
-    activity_id activityId = 0;
     Linked<IEngineRowAllocator> allocator;
     Linked<IEngineRowAllocator> allocatorin;
     IMulticoreIntercept* mcoreintercept = nullptr;
@@ -1407,8 +1407,6 @@ public:
             }
         }
         while (high-low>((int)atmost)) {
-            CRollingCacheElem *rl = cache->mid(low);
-            CRollingCacheElem *rh = cache->mid(high-1);
             int vl = iabs(cache->mid(low)->cmp);
             int vh = iabs(cache->mid(high-1)->cmp);
             int v;
@@ -1482,17 +1480,16 @@ public:
 
     class cWorkItem
     {
-        CActivityBase &activity;
     public:
         CThorExpandingRowArray lgroup;
         CThorExpandingRowArray rgroup;
         const void *row;
         inline cWorkItem(CActivityBase &_activity, CThorExpandingRowArray *_lgroup, CThorExpandingRowArray *_rgroup)
-            : activity(_activity), lgroup(_activity, &_activity), rgroup(_activity, &_activity)
+            : lgroup(_activity, &_activity), rgroup(_activity, &_activity)
         {
             set(_lgroup,_rgroup);
         }
-        inline cWorkItem(CActivityBase &_activity) : activity(_activity), lgroup(_activity, &_activity), rgroup(_activity, &_activity)
+        inline cWorkItem(CActivityBase &_activity) : lgroup(_activity, &_activity), rgroup(_activity, &_activity)
         {
             clear();
         }

+ 0 - 1
thorlcr/activities/normalize/thnormalizeslave.cpp

@@ -34,7 +34,6 @@ class NormalizeSlaveActivity : public CSlaveActivity
     unsigned curRow;
     unsigned numThisRow;
     bool anyThisGroup;
-    size32_t crcExtraSize;
     Owned<IEngineRowAllocator> allocator;
 
 

+ 0 - 4
thorlcr/activities/result/thresult.cpp

@@ -77,11 +77,7 @@ public:
         if (!results && !abortSoon)
         {
             ActPrintLog("WARNING: no results");
-            IHThorRemoteResultArg *helper = (IHThorRemoteResultArg *)queryHelper();
-            //helper->sendResult(NULL);
-            // Jake I think this always cores (so raise exception instead)
             throw MakeThorException(TE_UnexpectedMultipleSlaveResults, "Received no results from slaves");
-
         }
     }
 };

+ 0 - 1
thorlcr/activities/selectnth/thselectnthslave.cpp

@@ -98,7 +98,6 @@ public:
         }
 
         rowcount_t rowN = (rowcount_t)helper->getRowToSelect();
-        IStartableEngineRowStream *lookAhead = nullptr;
         if (!isLocal && rowN)
         {
             if (ensureStartFTLookAhead(0))

+ 1 - 1
thorlcr/activities/spill/thspillslave.cpp

@@ -137,7 +137,7 @@ public:
     {
         Owned<IFile> ifile = createIFile(fileName.str());
         offset_t sz = ifile->size();
-        if (-1 != sz)
+        if ((offset_t)-1 != sz)
             container.queryJob().queryIDiskUsage().increase(sz);        
         mb.append(getDataLinkCount()).append(compress?uncompressedBytesWritten:sz).append(sz);
         unsigned crc = compress?~0:fileCRC.get();

+ 2 - 4
thorlcr/activities/thactivityutil.cpp

@@ -488,13 +488,12 @@ static void _doReplicate(CActivityBase *activity, IPartDescriptor &partDesc, ICo
     StringBuffer primaryName;
     getPartFilename(partDesc, 0, primaryName);;
     RemoteFilename rfn;
-    IFileDescriptor &fileDesc = partDesc.queryOwner();
     unsigned copies = partDesc.numCopies();
     unsigned c=1;
     for (; c<copies; c++)
     {
         unsigned replicateCopy;
-        unsigned clusterNum = partDesc.copyClusterNum(c, &replicateCopy);
+        partDesc.copyClusterNum(c, &replicateCopy);
         rfn.clear();
         partDesc.getFilename(c, rfn);
         StringBuffer dstName;
@@ -561,13 +560,12 @@ static void _doReplicate(CActivityBase *activity, IPartDescriptor &partDesc, ICo
 void cancelReplicates(CActivityBase *activity, IPartDescriptor &partDesc)
 {
     RemoteFilename rfn;
-    IFileDescriptor &fileDesc = partDesc.queryOwner();
     unsigned copies = partDesc.numCopies();
     unsigned c=1;
     for (; c<copies; c++)
     {
         unsigned replicateCopy;
-        unsigned clusterNum = partDesc.copyClusterNum(c, &replicateCopy);
+        partDesc.copyClusterNum(c, &replicateCopy);
         rfn.clear();
         partDesc.getFilename(c, rfn);
         StringBuffer dstName;

+ 0 - 1
thorlcr/activities/thdiskbase.cpp

@@ -102,7 +102,6 @@ void CDiskReadMasterBase::init()
 
 void CDiskReadMasterBase::serializeSlaveData(MemoryBuffer &dst, unsigned slave)
 {
-    IHThorDiskReadBaseArg *helper = (IHThorDiskReadBaseArg *) queryHelper();
     dst.append(fileName);
     dst.append(subfileLogicalFilenames.ordinality());
     if (subfileLogicalFilenames.ordinality())

+ 1 - 1
thorlcr/activities/thdiskbaseslave.cpp

@@ -617,7 +617,7 @@ void CDiskWriteSlaveActivityBase::processDone(MemoryBuffer &mb)
     rowcount_t _processed = processed & THORDATALINK_COUNT_MASK;
     Owned<IFile> ifile = createIFile(fName);
     offset_t sz = ifile->size();
-    if (-1 != sz)
+    if ((offset_t)-1 != sz)
         container.queryJob().queryIDiskUsage().increase(sz);
     mb.append(_processed).append(compress?uncompressedBytesWritten:sz).append(sz);
     // NB: block compressed output has implicit crc of 0.

+ 1 - 2
thorlcr/activities/topn/thtopnslave.cpp

@@ -131,8 +131,7 @@ public:
                 const void *lastRow = sortedRows.query(topNLimit-1);
                 if (compare->docompare(lastRow, row) > 0)
                     sortedRows.binaryInsert(row.getClear(), *compare, true);
-                else // had enough and out of range
-                    ;
+                // else had enough and out of range
             }
         }
         rowidx_t sortedCount = sortedRows.ordinality();

+ 1 - 1
thorlcr/activities/wuidwrite/thwuidwrite.cpp

@@ -164,7 +164,7 @@ public:
         {
             Owned<IWorkUnit> wu = &container.queryJob().queryWorkUnit().lock();
             Owned<IWUResult> result = updateWorkUnitResult(wu, resultName, resultSeq);
-            numResults = validRC(result->getResultRowCount());
+            numResults = (rowcount_t)result->getResultRowCount();
         }
     }
 };

+ 1 - 3
thorlcr/activities/xmlwrite/thxmlwrite.cpp

@@ -30,11 +30,9 @@ class CXmlWriteActivityMaster : public CWriteMasterBase
 {
     IHThorXmlWriteArg *helper;
     ThorActivityKind kind;
-    unsigned headerLength;
-    unsigned footerLength;
 
 public:
-    CXmlWriteActivityMaster(CMasterGraphElement *info, ThorActivityKind _kind) : CWriteMasterBase(info), kind(_kind), headerLength(0), footerLength(0)
+    CXmlWriteActivityMaster(CMasterGraphElement *info, ThorActivityKind _kind) : CWriteMasterBase(info), kind(_kind)
     {
         helper = (IHThorXmlWriteArg *)queryHelper();
     }

+ 14 - 12
thorlcr/graph/thgraph.cpp

@@ -221,7 +221,6 @@ IThorResult *createResult(CActivityBase &activity, IThorRowInterfaces *rowIf, Th
 class CThorBoundLoopGraph : implements IThorBoundLoopGraph, public CInterface
 {
     CGraphBase *graph;
-    activity_id activityId;
     Linked<IOutputMetaData> resultMeta;
     Owned<IOutputMetaData> counterMeta, loopAgainMeta;
     Owned<IThorRowInterfaces> resultRowIf, countRowIf, loopAgainRowIf;
@@ -229,7 +228,7 @@ class CThorBoundLoopGraph : implements IThorBoundLoopGraph, public CInterface
 public:
     IMPLEMENT_IINTERFACE;
 
-    CThorBoundLoopGraph(CGraphBase *_graph, IOutputMetaData * _resultMeta, unsigned _activityId) : graph(_graph), resultMeta(_resultMeta), activityId(_activityId)
+    CThorBoundLoopGraph(CGraphBase *_graph, IOutputMetaData * _resultMeta, unsigned _activityId) : graph(_graph), resultMeta(_resultMeta)
     {
         counterMeta.setown(createFixedSizeMetaData(sizeof(thor_loop_counter_t)));
         loopAgainMeta.setown(createFixedSizeMetaData(sizeof(bool)));
@@ -258,8 +257,8 @@ public:
         if (!resultRowIf)
             resultRowIf.setown(activity.createRowInterfaces(resultMeta));
         ThorGraphResultType resultType = activity.queryGraph().isLocalChild() ? thorgraphresult_nul : thorgraphresult_distributed;
-        IThorResult *loopResult =  activity.queryGraph().createResult(activity, 0, results, resultRowIf, resultType); // loop output
-        IThorResult *inputResult = activity.queryGraph().createResult(activity, 1, results, resultRowIf, resultType); // loop input
+        activity.queryGraph().createResult(activity, 0, results, resultRowIf, resultType); // loop output
+        activity.queryGraph().createResult(activity, 1, results, resultRowIf, resultType); // loop input
     }
     virtual CGraphBase *queryGraph() { return graph; }
 };
@@ -680,6 +679,8 @@ bool CGraphElementBase::prepareContext(size32_t parentExtractSz, const byte *par
                         case TAKfilterproject:
                             whichBranch = ((IHThorFilterProjectArg *)baseHelper.get())->canMatchAny() ? 0 : 1;
                             break;
+                        default:
+                            break;
                     }
                     break;
                 }
@@ -703,6 +704,8 @@ bool CGraphElementBase::prepareContext(size32_t parentExtractSz, const byte *par
                         return false;
                     break;
                 }
+                default:
+                    break;
             }
             if (checkDependencies && ((unsigned)-1 != whichBranch))
             {
@@ -993,6 +996,8 @@ bool isLoopActivity(CGraphElementBase &container)
         case TAKgraphloop:
         case TAKparallelgraphloop:
             return true;
+        default:
+            break;
     }
     return false;
 }
@@ -2299,11 +2304,10 @@ class CGraphExecutor : implements IGraphExecutor, public CInterface
 
     class CGraphExecutorFactory : implements IThreadFactory, public CInterface
     {
-        CGraphExecutor &executor;
     public:
         IMPLEMENT_IINTERFACE;
 
-        CGraphExecutorFactory(CGraphExecutor &_executor) : executor(_executor) { }
+        CGraphExecutorFactory() { }
 // IThreadFactory
         virtual IPooledThread *createNew()
         {
@@ -2378,7 +2382,7 @@ public:
         PROGLOG("CGraphExecutor: limit = %d", limit);
         waitOnRunning = 0;
         stopped = false;
-        factory = new CGraphExecutorFactory(*this);
+        factory = new CGraphExecutorFactory();
         graphPool.setown(createThreadPool("CGraphExecutor pool", factory, &jobChannel, limit));
     }
     ~CGraphExecutor()
@@ -2545,8 +2549,7 @@ public:
 // IContextLogger
 class CThorContextLogger : implements IContextLogger, public CSimpleInterface
 {
-    CJobBase &job;
-    unsigned traceLevel;
+    unsigned traceLevel = 1;
     StringAttr globalIdHeader;
     StringAttr callerIdHeader;
     StringAttr globalId;
@@ -2555,9 +2558,8 @@ class CThorContextLogger : implements IContextLogger, public CSimpleInterface
 public:
     IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
 
-    CThorContextLogger(CJobBase &_job) : job(_job)
+    CThorContextLogger()
     {
-        traceLevel = 1;
         if (globals->hasProp("@httpGlobalIdHeader"))
             setHttpIdHeaders(globals->queryProp("@httpGlobalIdHeader"), globals->queryProp("@httpCallerIdHeader"));
     }
@@ -2678,7 +2680,7 @@ void CJobBase::init()
     forceLogGraphIdMin = (graph_id)getWorkUnitValueInt("forceLogGraphIdMin", 0);
     forceLogGraphIdMax = (graph_id)getWorkUnitValueInt("forceLogGraphIdMax", 0);
 
-    logctx.setown(new CThorContextLogger(*this));
+    logctx.setown(new CThorContextLogger());
 
     // global setting default on, can be overridden by #option
     timeActivities = 0 != getWorkUnitValueInt("timeActivities", globals->getPropBool("@timeActivities", true));

+ 11 - 10
thorlcr/graph/thgraph.hpp

@@ -65,7 +65,7 @@ const static roxiemem::RoxieHeapFlags defaultHeapFlags = roxiemem::RHFscanning;
 #define INVALID_UNIQ_ID -1;
 typedef activity_id unique_id;
 
-enum msgids
+enum msgids:unsigned
 {
     QueryInit,
     QueryDone,
@@ -109,7 +109,7 @@ interface IThorResource
 
 interface IBarrier : extends IInterface
 {
-    virtual const mptag_t queryTag() const = 0;
+    virtual mptag_t queryTag() const = 0;
     virtual bool wait(bool exception, unsigned timeout=INFINITE) = 0;
     virtual void cancel(IException *e=NULL) = 0;
 };
@@ -172,8 +172,8 @@ class CFileUsageEntry : public CInterface
 public:
     CFileUsageEntry(const char *_name, graph_id _graphId, WUFileKind _fileKind, unsigned _usage) :name(_name), graphId(_graphId), fileKind(_fileKind), usage(_usage) { }
     unsigned queryUsage() const { return usage; }
-    const graph_id queryGraphId() const { return graphId; }
-    const WUFileKind queryKind() const { return fileKind; }
+    graph_id queryGraphId() const { return graphId; }
+    WUFileKind queryKind() const { return fileKind; }
     const char *queryName() const { return name.get(); }
     void decUsage() { --usage; }
 
@@ -358,7 +358,7 @@ public:
     IPropertyTree &queryXGMML() const { return *xgmml; }
     const activity_id &queryOwnerId() const { return ownerId; }
 //
-    const ThorActivityKind getKind() const { return kind; }
+    ThorActivityKind getKind() const { return kind; }
     const activity_id &queryId() const { return id; }
     StringBuffer &getEclText(StringBuffer& dst) const
     {
@@ -477,10 +477,11 @@ class graph_decl CGraphBase : public CGraphStub, implements IEclGraphResults
 
     class CGraphCodeContext : implements ICodeContextExt
     {
-        ICodeContextExt *ctx;
-        CGraphBase *containerGraph, *parent;
+        ICodeContextExt *ctx = nullptr;
+        CGraphBase *containerGraph = nullptr;
+        CGraphBase *parent = nullptr;
     public:
-        CGraphCodeContext() : parent(nullptr), containerGraph(nullptr), ctx(nullptr) { }
+        CGraphCodeContext() { }
         void setContext(CGraphBase *_parent, CGraphBase *_containerGraph, ICodeContextExt *_ctx)
         {
             parent = _parent;
@@ -904,7 +905,7 @@ public:
     const char *queryScope() const { return scope.str(); }
     IDiskUsage &queryIDiskUsage() const { return *(IDiskUsage *)this; }
     void setDiskUsage(offset_t _diskUsage) { diskUsage = _diskUsage; }
-    const offset_t queryMaxDiskUsage() const { return maxDiskUsage; }
+    offset_t queryMaxDiskUsage() const { return maxDiskUsage; }
     mptag_t querySlaveMpTag() const { return slavemptag; }
     unsigned querySlaves() const { return slaveGroup->ordinality(); }
     unsigned queryNodes() const { return nodeGroup->ordinality()-1; }
@@ -1079,7 +1080,7 @@ public:
     inline IMPServer &queryMPServer() const { return queryJobChannel().queryMPServer(); }
     CGraphBase &queryGraph() const { return container.queryOwner(); }
     CActivityBase &queryChannelActivity(unsigned channel) const { return queryJob().queryChannelActivity(channel, queryGraph().queryGraphId(), queryId()); }
-    inline const mptag_t queryMpTag() const { return mpTag; }
+    inline mptag_t queryMpTag() const { return mpTag; }
     inline bool queryAbortSoon() const { return abortSoon; }
     inline IHThorArg *queryHelper() const { return baseHelper; }
     inline bool needReInit() const { return reInit; }

+ 11 - 11
thorlcr/graph/thgraphmaster.cpp

@@ -129,7 +129,7 @@ void CSlaveMessageHandler::threadmain()
             if (stopped || !job.queryJobChannel(0).queryJobComm().recv(msg, RANK_ALL, mptag, &sender))
                 break;
             SlaveMsgTypes msgType;
-            msg.read((int &)msgType);
+            readUnderlyingType(msg, msgType);
             switch (msgType)
             {
                 case smt_errorMsg:
@@ -594,6 +594,8 @@ bool CMasterGraphElement::checkUpdate()
                 temporary = true;
             break;
         }
+        default:
+            break;
     }
 
     if (doCheckUpdate)
@@ -603,7 +605,7 @@ bool CMasterGraphElement::checkUpdate()
         if (file)
         {
             IPropertyTree &props = file->queryAttributes();
-            if ((eclCRC == props.getPropInt("@eclCRC")) && (totalCRC == props.getPropInt64("@totalCRC")))
+            if ((eclCRC == (unsigned)props.getPropInt("@eclCRC")) && (totalCRC == (unsigned __int64)props.getPropInt64("@totalCRC")))
             {
                 // so this needs pruning
                 Owned<IThorException> e = MakeActivityWarning(this, TE_UpToDate, "output file = '%s' - is up to date - it will not be rebuilt", file->queryLogicalName());
@@ -660,8 +662,8 @@ public:
     {
         receiving = false;
     }
-    virtual const mptag_t queryTag() const { return tag; }
-    virtual bool wait(bool exception, unsigned timeout)
+    virtual mptag_t queryTag() const override { return tag; }
+    virtual bool wait(bool exception, unsigned timeout) override
     {
         Owned<IException> e;
         CTimeMon tm(timeout);
@@ -725,7 +727,7 @@ public:
         }
         return true;
     }
-    virtual void cancel(IException *e)
+    virtual void cancel(IException *e) override
     {
         if (receiving)
             comm->cancel(RANK_ALL, tag);
@@ -1070,7 +1072,6 @@ public:
         PROTECTED_GETRESULT(stepname, sequence, "VarUnicode", "unicode",
             MemoryBuffer result;
             r->getResultUnicode(MemoryBuffer2IDataVal(result));
-            unsigned tlen = result.length()/2;
             result.append((UChar)0);
             return (UChar *)result.detach();
         );
@@ -1758,8 +1759,6 @@ bool CJobMaster::go()
             job.fireException(exception);
             return true;
         }
-    private:
-        graph_id graphId;
     };
     Owned<CTimeoutTrigger> qtHandler;
     int guillotineTimeout = workunit->getDebugValueInt("maxRunTime", 0);
@@ -2756,9 +2755,8 @@ bool CMasterGraph::deserializeStats(unsigned node, MemoryBuffer &mb)
             return false; // don't know if or how this could happen, but all bets off with packet if did.
         }
     }
-    unsigned subs, _subs;
+    unsigned subs;
     mb.read(subs);
-    _subs = subs;
     while (subs--)
     {
         graph_id subId;
@@ -2839,6 +2837,8 @@ static bool suppressStatisticIfZero(StatisticKind kind)
     case StTimeSpillElapsed:
     case StNumDiskRetries:
         return true;
+    default:
+        break;
     }
     return false;
 }
@@ -2867,7 +2867,7 @@ void CThorStats::reset()
 {
     tot = max = avg = 0;
     min = (unsigned __int64) -1;
-    minNode = maxNode = maxSkew = minSkew = maxNode = minNode = 0;
+    minNode = maxNode = maxSkew = minSkew = 0;
 }
 
 void CThorStats::calculateSkew()

+ 5 - 4
thorlcr/graph/thgraphslave.cpp

@@ -47,7 +47,7 @@ public:
     {
         receiving = false;
     }
-    virtual bool wait(bool exception, unsigned timeout)
+    virtual bool wait(bool exception, unsigned timeout) override
     {
         Owned<IException> e;
         CTimeMon tm(timeout);
@@ -94,7 +94,7 @@ public:
         }   
         return true;
     }
-    virtual void cancel(IException *e)
+    virtual void cancel(IException *e) override
     {
         if (receiving)
             comm->cancel(jobChannel.queryMyRank(), tag);
@@ -110,7 +110,7 @@ public:
         if (!comm->send(msg, 0, tag, LONGTIMEOUT))
             throw MakeStringException(0, "CBarrierSlave::cancel - Timeout sending to master");
     }
-    virtual const mptag_t queryTag() const { return tag; }
+    virtual mptag_t queryTag() const override { return tag; }
 };
 
 
@@ -1229,7 +1229,6 @@ bool CSlaveGraph::serializeStats(MemoryBuffer &mb)
     {
         if (checkProgressUpdatedAndClear() || progressActive)
         {
-            unsigned sPos = mb.length();
             Owned<IThorActivityIterator> iter = getConnectedIterator();
             ForEach (*iter)
             {
@@ -2014,6 +2013,8 @@ public:
             return cycle_to_nanosec(getStatistic(StCycleDiskReadIOCycles));
         case StTimeDiskWriteIO:
             return cycle_to_nanosec(getStatistic(StCycleDiskWriteIOCycles));
+        default:
+            break;
         }
 
         Owned<IFileIO> openiFileIO = getFileIO();

+ 3 - 6
thorlcr/master/thgraphmanager.cpp

@@ -457,14 +457,12 @@ void CJobManager::run()
 
     class CThorListener : public CSimpleInterface, implements IThreaded
     {
-        bool stopped;
         CThreaded threaded;
         mptag_t mptag;
-        CJobManager &jobManager;
+        bool stopped = false;
     public:
-        CThorListener(CJobManager &_jobManager, mptag_t _mptag) : threaded("CDaliConnectionValidator"), jobManager(_jobManager), mptag(_mptag)
+        CThorListener(mptag_t _mptag) : threaded("CDaliConnectionValidator"), mptag(_mptag)
         {
-            stopped = false;
             threaded.init(this);
         }
         ~CThorListener() { stop(); threaded.join(); }
@@ -494,7 +492,7 @@ void CJobManager::run()
                     PROGLOG("Unknown cmd = %s", cmd.get());
             }
         }
-    } stopThorListener(*this, MPTAG_THOR);
+    } stopThorListener(MPTAG_THOR);
     StringBuffer exclusiveLockName;
     Owned<IDaliMutex> exclLockDaliMutex;
     if (globals->getProp("@multiThorExclusionLockName",exclusiveLockName))
@@ -832,7 +830,6 @@ bool CJobManager::executeGraph(IConstWorkUnit &workunit, const char *graphName,
     }
     workunit.forceReload();
     StringAttr wuid(workunit.queryWuid());
-    const char *totalTimeStr = "Total thor time";
     cycle_t startCycles = get_cycles_now();
 
     Owned<IConstWUQuery> query = workunit.getQuery(); 

+ 3 - 4
thorlcr/master/thmastermain.cpp

@@ -77,8 +77,7 @@ class CRegistryServer : public CSimpleInterface
 {
     unsigned msgDelay, slavesRegistered;
     CriticalSection crit;
-    bool stopped;
-
+    bool stopped = false;
     static CriticalSection regCrit;
     static CRegistryServer *registryServer;
 
@@ -122,7 +121,7 @@ class CRegistryServer : public CSimpleInterface
                     continue;
                 }
                 RegistryCode code;
-                msg.read((int &)code);
+                readUnderlyingType<RegistryCode>(msg, code);
                 if (rc_deregister != code)
                     throwUnexpected();
                 Owned<IException> e = deserializeException(msg);
@@ -137,7 +136,7 @@ public:
     Linked<CMasterWatchdogBase> watchdog;
     IBitSet *status;
 
-    CRegistryServer()  : deregistrationWatch(*this), stopped(false)
+    CRegistryServer()  : deregistrationWatch(*this)
     {
         status = createThreadSafeBitSet();
         msgDelay = SLAVEREG_VERIFY_DELAY;

+ 3 - 1
thorlcr/mfilemanager/thmfilemanager.cpp

@@ -428,7 +428,7 @@ public:
                         {
                             Owned<IDistributedFilePart> part = f->getPart(p);
                             offset_t sz = part->getFileSize(false, false);
-                            if (-1 != sz)
+                            if ((offset_t)-1 != sz)
                                 job.addNodeDiskUsage(p, -(__int64)sz);
                         }
                     }
@@ -488,6 +488,8 @@ public:
                 case MachineOsSolaris:
                     os = DFD_OSunix;
                     break;
+                default:
+                    break;
             };
 
             unsigned offset = 0;

+ 0 - 4
thorlcr/msort/tsortm.cpp

@@ -643,7 +643,6 @@ public:
         mid.serializeCompress(mdmb);
         mdl = mdmb.length();
         const byte *mdp=(const byte *)mdmb.bufferBase();
-        unsigned i = 0;
         class casyncfor2: public CAsyncFor
         {
             NodeArray &slaves;
@@ -914,7 +913,6 @@ public:
                     if (logging) 
                         ActPrintLog(activity, "  wanted = %" CF "d, %stotal = %" CF "d, loc = %" CF "d, locwanted = %" CF "d\n",wanted,(total!=stotal)?"scaled ":"",tot,loc,nodewanted);
 #endif
-                    bool isdone=false;
                     unsigned __int64 error = (loc>nodewanted)?(loc-nodewanted):(nodewanted-loc);
                     if (error>maxerror)
                         maxerror = error;
@@ -1051,7 +1049,6 @@ public:
     {
         // I think this dependent on row being same format as meta
 
-        unsigned numsplits=numnodes-1;
         CThorExpandingRowArray splits(*activity, keyIf, ers_allow);
         char *s=cosortfilenames;
         unsigned i;
@@ -1085,7 +1082,6 @@ public:
     void CalcPreviousPartition()
     {
         ActPrintLog(activity, "Previous partition");
-        unsigned numsplits=numnodes-1;
         CThorExpandingRowArray splits(*activity, keyIf, ers_allow);
         unsigned i;
         for(i=1;i<numnodes;i++)

+ 1 - 3
thorlcr/msort/tsorts.cpp

@@ -296,7 +296,6 @@ class CMiniSort
         unsigned ret = 0;
         for (;;)
         {
-            size32_t ln = mb.length();
             OwnedConstThorRow row = stream.nextRow();
             if (!row)
                 break;
@@ -570,7 +569,6 @@ class CThorSorter : public CSimpleInterface, implements IThorSorter, implements
 {
     CActivityBase *activity;
     SocketEndpoint myendpoint;
-    IDiskUsage *iDiskUsage;
     Linked<ICommunicator> clusterComm;
     mptag_t mpTagRPC;
 
@@ -780,7 +778,7 @@ public:
     IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
 
     CThorSorter(CActivityBase *_activity, SocketEndpoint &ep, IDiskUsage *_iDiskUsage, ICommunicator *_clusterComm, mptag_t _mpTagRPC)
-        : activity(_activity), myendpoint(ep), iDiskUsage(_iDiskUsage), clusterComm(_clusterComm), mpTagRPC(_mpTagRPC),
+        : activity(_activity), myendpoint(ep), clusterComm(_clusterComm), mpTagRPC(_mpTagRPC),
           rowArray(*_activity, _activity), threaded("CThorSorter", this), spillStats(spillStatistics)
     {
         numnodes = 0;

+ 0 - 9
thorlcr/shared/thor.hpp

@@ -39,15 +39,6 @@ typedef size32_t rowidx_t;
 
 #include "jexcept.hpp"
 
-// validate that type T doesn't truncate
-template <class T>
-inline rowcount_t validRC(T X)
-{
-    if (X != (rowcount_t)X)
-        throw MakeStringException(0, "rowcount_t value truncation");
-    return (rowcount_t)X;
-}
-
 template <class T>
 inline rowidx_t validRIDX(T X)
 {

+ 0 - 1
thorlcr/slave/backup.cpp

@@ -293,7 +293,6 @@ public:
             if (item)
             {
                 lookup.removeExact(item);
-                unsigned pos = todo.find(item);
                 todo.dequeue(item);
                 item->Release();
                 write();

+ 2 - 0
thorlcr/slave/slave.cpp

@@ -287,6 +287,8 @@ public:
             case TAKsideeffect:
                 nullAct = true;
                 break;
+            default:
+                break;
         }
     }
     virtual void deserializeCreateContext(MemoryBuffer &mb)

+ 0 - 1
thorlcr/slave/slave.ipp

@@ -107,7 +107,6 @@ public:
         ForEachItemIn(i, inputs)
         {
             IThorDataLink *curInput = queryInput(i);
-            CActivityBase *activity = curInput->queryFromActivity();
             IThorNWayInput *nWayInput = dynamic_cast<IThorNWayInput *>(curInput);
             if (nWayInput)
             {

+ 11 - 16
thorlcr/slave/slavmain.cpp

@@ -654,7 +654,6 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
     };
     class CKeyLookupRequest : public CLookupRequest
     {
-        CKJService &service;
         Linked<CKMContainer> kmc;
 
         rowcount_t abortLimit = 0;
@@ -718,7 +717,7 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
         const unsigned DEFAULT_KEYLOOKUP_MAXREPLYSZ = 0x100000;
     public:
         CKeyLookupRequest(CKJService &_service, CKeyLookupContext *_ctx, CKMContainer *_kmc, rank_t _sender, mptag_t _replyTag)
-            : CLookupRequest(_ctx->queryActivityCtx(), _sender, _replyTag), kmc(_kmc), service(_service)
+            : CLookupRequest(_ctx->queryActivityCtx(), _sender, _replyTag), kmc(_kmc)
         {
             allocator = activityCtx->queryLookupInputAllocator();
             deserializer = activityCtx->queryLookupInputDeserializer();
@@ -819,7 +818,6 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
     };
     class CFetchLookupRequest : public CLookupRequest
     {
-        CKJService &service;
         Linked<CFetchContext> fetchContext;
         const unsigned defaultMaxFetchLookupReplySz = 0x100000;
         const IDynamicTransform *translator = nullptr;
@@ -872,8 +870,7 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
     public:
         CFetchLookupRequest(CKJService &_service, CFetchContext *_fetchContext, rank_t _sender, mptag_t _replyTag)
             : CLookupRequest(_fetchContext->queryActivityCtx(), _sender, _replyTag),
-              fetchContext(_fetchContext), prefetchSource(fetchContext->queryPrefetchSource()),
-              service(_service)
+              fetchContext(_fetchContext), prefetchSource(fetchContext->queryPrefetchSource())
         {
             allocator = activityCtx->queryFetchInputAllocator();
             deserializer = activityCtx->queryFetchInputDeserializer();
@@ -932,12 +929,11 @@ class CKJService : public CSimpleInterfaceOf<IKJService>, implements IThreaded,
     };
     class CRemoteLookupProcessor : public CSimpleInterfaceOf<IPooledThread>
     {
-        CKJService &service;
         Owned<CLookupRequest> lookupRequest;
         bool abortSoon = false;
 
     public:
-        CRemoteLookupProcessor(CKJService &_service) : service(_service)
+        CRemoteLookupProcessor(CKJService &_service)
         {
         }
     // IPooledThread impl.
@@ -1281,8 +1277,8 @@ public:
                     break;
                 assertex(currentJob);
                 KJServiceCmds cmd;
-                msg.read((byte &)cmd);
-                msg.read((unsigned &)replyTag);
+                readUnderlyingType<KJServiceCmds>(msg, cmd);
+                readUnderlyingType<mptag_t>(msg, replyTag);
                 switch (cmd)
                 {
                     case kjs_keyopen:
@@ -1300,7 +1296,7 @@ public:
                         msg.read(messageCompression);
                         keyLookupContext->queryActivityCtx()->setMessageCompression(messageCompression);
                         RecordTranslationMode translationMode;
-                        msg.read(reinterpret_cast<std::underlying_type<RecordTranslationMode>::type &> (translationMode));
+                        readUnderlyingType(msg, translationMode);
                         if (RecordTranslationMode::None != translationMode)
                         {
                             unsigned publishedFormatCrc;
@@ -1383,7 +1379,7 @@ public:
                         activityCtx->setMessageCompression(messageCompression);
 
                         RecordTranslationMode translationMode;
-                        msg.read(reinterpret_cast<std::underlying_type<RecordTranslationMode>::type &> (translationMode));
+                        readUnderlyingType(msg, translationMode);
                         if (RecordTranslationMode::None != translationMode)
                         {
                             unsigned publishedFormatCrc;
@@ -1397,7 +1393,6 @@ public:
                             else
                                 projectedFormat.set(publishedFormat);
 
-                            IHThorKeyedJoinArg *helper = activityCtx->queryHelper();
                             fetchContext->setTranslation(translationMode, publishedFormat, publishedFormatCrc, projectedFormat);
                         }
 
@@ -1432,7 +1427,6 @@ public:
                             continue;
                         }
 
-                        CActivityContext *activityCtx = fetchContext->queryActivityCtx();
                         Owned<CFetchLookupRequest> lookupRequest = new CFetchLookupRequest(*this, fetchContext, sender, replyTag);
 
                         size32_t requestSz;
@@ -1458,6 +1452,8 @@ public:
                         msg.clear();
                         break;
                     }
+                    default:
+                        throwUnexpected();
                 }
             }
             catch (IMP_Exception *e)
@@ -1725,10 +1721,10 @@ public:
         while (!stopped && queryNodeComm().recv(msg, 0, masterSlaveMpTag))
         {
             doReply = true;
-            msgids cmd;
             try
             {
-                msg.read((unsigned &)cmd);
+                msgids cmd;
+                readUnderlyingType<msgids>(msg, cmd);
                 switch (cmd)
                 {
                     case QueryInit:
@@ -2235,7 +2231,6 @@ public:
         if (item)
         {
             lookup.removeExact(item);
-            unsigned pos = fipList.find(item);
             fipList.dequeue(item);
             item->Release();
             write();

+ 3 - 3
thorlcr/slave/thslavemain.cpp

@@ -158,8 +158,8 @@ static bool RegisterSelf(SocketEndpoint &masterEp)
             return false;
 #endif
         }
-        msg.read((unsigned &)masterSlaveMpTag);
-        msg.read((unsigned &)kjServiceMpTag);
+        readUnderlyingType<mptag_t>(msg, masterSlaveMpTag);
+        readUnderlyingType<mptag_t>(msg, kjServiceMpTag);
         msg.clear();
         msg.setReplyTag(MPTAG_THORREGISTRATION);
         if (!queryNodeComm().reply(msg))
@@ -204,7 +204,7 @@ bool UnregisterSelf(IException *e)
     try
     {
         CMessageBuffer msg;
-        msg.append((int)rc_deregister);
+        msg.append(rc_deregister);
         serializeException(e, msg); // NB: allows exception to be NULL
         if (!queryWorldCommunicator().send(msg, masterNode, MPTAG_THORREGISTRATION, 60*1000))
         {

+ 1 - 3
thorlcr/thorutil/thbuf.cpp

@@ -155,7 +155,6 @@ class CSmartRowBuffer: public CSimpleInterface, implements ISmartRowBuffer, impl
             mb.ensureCapacity(blocksize);
             {
                 SpinUnblock unblock(lock);
-                unsigned p = 0;
                 byte b;
                 for (unsigned i=0;i<csavein.rq->ordinality();i++) {
                     if (waiting)
@@ -224,7 +223,6 @@ class CSmartRowBuffer: public CSimpleInterface, implements ISmartRowBuffer, impl
             assertex(fileio.get());
             size32_t rd = fileio->read(blk*(offset_t)blocksize,readBlockSize,buf);
             assertex(rd==readBlockSize);
-            unsigned p = 0;
             for (;;) {
                 byte b;
                 ds.read(sizeof(b),&b);
@@ -913,7 +911,7 @@ protected:
     unsigned maxPoolChunks;
     bool reuseRowSets;
 
-    inline const rowcount_t readerWait(COutput &output, const rowcount_t rowsRead)
+    inline rowcount_t readerWait(COutput &output, const rowcount_t rowsRead)
     {
         if (rowsRead == rowsWritten)
         {

+ 3 - 1
thorlcr/thorutil/thmem.cpp

@@ -749,9 +749,9 @@ void CThorExpandingRowArray::compact()
         }
     }
     numRows = freeFinger-rows;
-    memsize_t numEmptiedPages = rowManager->compactRows(numRows, rows);
 
 #ifdef _DEBUG
+    memsize_t numEmptiedPages = rowManager->compactRows(numRows, rows);
     ActPrintLog(&activity, "CThorExpandingRowArray::compact(): compactRows freed %" I64F "d pages", (unsigned __int64)numEmptiedPages);
 #endif
 
@@ -1958,6 +1958,8 @@ public:
             return overflowCount;
         case StSizeSpillFile:
             return sizeSpill;
+        default:
+            break;
         }
         return 0;
     }

+ 6 - 7
thorlcr/thorutil/thormisc.cpp

@@ -237,20 +237,20 @@ public:
         : audience(_audience), errorcode(code), msg(str), action(tea_null), graphId(0), id(0), slave(0), line(0), column(0), severity(SeverityInformation), kind(TAKnone) { };
     CThorException(MemoryBuffer &mb)
     {
-        mb.read((unsigned &)action);
+        readUnderlyingType<ThorExceptionAction>(mb, action);
         mb.read(jobId);
         mb.read(graphName);
         mb.read(graphId);
-        mb.read((unsigned &)kind);
+        readUnderlyingType(mb, kind);
         mb.read(id);
         mb.read(slave);
-        mb.read((unsigned &)audience);
+        readUnderlyingType(mb, audience);
         mb.read(errorcode);
         mb.read(msg);
         mb.read(file);
         mb.read(line);
         mb.read(column);
-        mb.read((int &)severity);
+        readUnderlyingType(mb, severity);
         mb.read(origin);
         if (0 == origin.length()) // simpler to clear serialized 0 length terminated string here than check on query
             origin.clear();
@@ -942,7 +942,7 @@ void serializeThorException(IException *e, MemoryBuffer &out)
     out.append(file);
     out.append(line);
     out.append(column);
-    out.append(te->querySeverity());
+    out.append((unsigned)te->querySeverity());
     out.append(te->queryOrigin());
     IException *oe = te->queryOriginalException();
     if (oe)
@@ -1218,7 +1218,7 @@ class CRowServer : public CSimpleInterface, implements IThreaded, implements IRo
     ICommunicator &comm;
     CActivityBase *activity;
     mptag_t mpTag;
-    unsigned myNode, fetchBuffSize;
+    unsigned fetchBuffSize;
     Linked<IRowStream> seq;
     bool running;
 
@@ -1443,7 +1443,6 @@ void getLayoutTranslations(IConstPointerArrayOf<ITranslator> &translators, const
     OwningSimpleHashTableOf<CITranslatorMapping, unsigned> translatorTable;
     ForEachItemIn(p, partDescriptors)
     {
-        IPartDescriptor &partDesc = partDescriptors.item(p);
         unsigned publishedFormatCrc = (unsigned)props.getPropInt("@formatCrc", 0);
         Owned<const ITranslator> translatorContainer;
         if (translatorTable.ordinality())

+ 8 - 2
thorlcr/thorutil/thormisc.hpp

@@ -110,7 +110,7 @@
 
 enum ThorExceptionAction { tea_null, tea_warning, tea_abort, tea_shutdown };
 
-enum RegistryCode { rc_register, rc_deregister };
+enum RegistryCode:unsigned { rc_register, rc_deregister };
 
 #define createThorRow(size)         malloc(size)
 #define destroyThorRow(ptr)         free(ptr)
@@ -470,7 +470,7 @@ extern graph_decl void reportExceptionToWorkunit(IConstWorkUnit &workunit,IExcep
 extern graph_decl IPropertyTree *globals;
 extern graph_decl mptag_t masterSlaveMpTag;
 extern graph_decl mptag_t kjServiceMpTag;
-enum SlaveMsgTypes { smt_errorMsg=1, smt_initGraphReq, smt_initActDataReq, smt_dataReq, smt_getPhysicalName, smt_getFileOffset, smt_actMsg, smt_getresult };
+enum SlaveMsgTypes:unsigned { smt_errorMsg=1, smt_initGraphReq, smt_initActDataReq, smt_dataReq, smt_getPhysicalName, smt_getFileOffset, smt_actMsg, smt_getresult };
 // Logging
 extern graph_decl const LogMsgJobInfo thorJob;
 
@@ -536,5 +536,11 @@ extern graph_decl void checkAndDumpAbortInfo(const char *cmd);
 
 extern graph_decl void checkFileType(CActivityBase *activity, IDistributedFile *file, const char *expectedType, bool throwException);
 
+template <class T>
+inline void readUnderlyingType(MemoryBuffer &mb, T &v)
+{
+    mb.read(reinterpret_cast<typename std::underlying_type<T>::type &> (v));
+}
+
 #endif