Here you go:
diff -Naur elkhound-orig/src/ast/exampletest.cc elkhound/src/ast/exampletest.cc
--- elkhound-orig/src/ast/exampletest.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/ast/exampletest.cc 2017-03-16 21:54:24.000000000 +0100
@@ -29,15 +29,15 @@
Super *s4 = new Sub2(4, 104);
// **** render it into xml
- cout << "**************** first" << endl;
+ std::cout << "**************** first" << std::endl;
nl0->xmlPrint(cout,0);
- cout << "**************** second" << endl;
+ std::cout << "**************** second" << std::endl;
al0->xmlPrint(cout,0);
- cout << "**************** third" << endl;
+ std::cout << "**************** third" << std::endl;
s3->xmlPrint(cout,0);
- cout << "**************** fourth" << endl;
+ std::cout << "**************** fourth" << std::endl;
s4->xmlPrint(cout,0);
- cout << "**************** done" << endl;
+ std::cout << "**************** done" << std::endl;
return 0;
}
diff -Naur elkhound-orig/src/ast/gramlex.cc elkhound/src/ast/gramlex.cc
--- elkhound-orig/src/ast/gramlex.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/ast/gramlex.cc 2017-03-16 21:41:24.000000000 +0100
@@ -8,6 +8,10 @@
#include <fstream> // std::cout, std::ifstream
+// might break earlier flex versions
+#ifndef FLEX_STD
+ #define FLEX_STD std::
+#endif // FLEX_STD
// workaround for flex-2.5.31
#ifdef FLEX_STD // detect later versions of flex
diff -Naur elkhound-orig/src/elkhound/examples/arith/arith.cc elkhound/src/elkhound/examples/arith/arith.cc
--- elkhound-orig/src/elkhound/examples/arith/arith.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/examples/arith/arith.cc 2017-03-16 21:46:32.000000000 +0100
@@ -59,7 +59,7 @@
// --------------------- main ----------------------
ArithLexer lexer;
-int main(int argc)
+int main(int argc, char *argv[])
{
// initialize lexer by grabbing first token
lexer.nextToken(&lexer);
diff -Naur elkhound-orig/src/elkhound/examples/cexp/cexp3mrg.cc elkhound/src/elkhound/examples/cexp/cexp3mrg.cc
--- elkhound-orig/src/elkhound/examples/cexp/cexp3mrg.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/examples/cexp/cexp3mrg.cc 2017-03-16 21:59:54.000000000 +0100
@@ -9,14 +9,14 @@
void Exp::incRefCt()
{
refCt++;
- trace("refct") << "incremented refct of " << this << " to " << refCt << endl;
+ trace("refct") << "incremented refct of " << this << " to " << refCt << std::endl;
}
void Exp::decRefCt()
{
xassert(refCt > 0);
--refCt;
- trace("refct") << "decremented refct of " << this << " to " << refCt << endl;
+ trace("refct") << "decremented refct of " << this << " to " << refCt << std::endl;
if (refCt == 0) {
delete this;
}
diff -Naur elkhound-orig/src/elkhound/gramanl.cc elkhound/src/elkhound/gramanl.cc
--- elkhound-orig/src/elkhound/gramanl.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/gramanl.cc 2017-03-16 21:49:14.000000000 +0100
@@ -2231,7 +2231,7 @@
STATICDEF unsigned ItemSet::hash(ItemSet const *key)
{
- unsigned crc = key->kernelItemsCRC;
+ uintptr_t crc = key->kernelItemsCRC;
return HashTable::lcprngHashFn((void*)crc);
}
diff -Naur elkhound-orig/src/elkhound/ssxmain.cc elkhound/src/elkhound/ssxmain.cc
--- elkhound-orig/src/elkhound/ssxmain.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/ssxmain.cc 2017-03-16 21:54:44.000000000 +0100
@@ -118,14 +118,14 @@
// count # of parses
PTreeNode *top = (PTreeNode*)treeTop;
TreeCount numParses = top->countTrees();
- cout << "num parses: " << numParses << endl;
+ std::cout << "num parses: " << numParses << std::endl;
// print what it should be
int n = (inputLen - 1) / 2;
- cout << "input is x^" << inputLen
- << "; C(" << n
- << ") = " << C(n)
- << endl;
+ std::cout << "input is x^" << inputLen
+ << "; C(" << n
+ << ") = " << C(n)
+ << std::endl;
return 0;
}
diff -Naur elkhound-orig/src/elkhound/triv/AdB.gr.in elkhound/src/elkhound/triv/AdB.gr.in
--- elkhound-orig/src/elkhound/triv/AdB.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/AdB.gr.in 2017-03-16 22:18:20.000000000 +0100
@@ -9,7 +9,7 @@
}
nonterm A {
- fun merge(p1, p2) [ cout << "merging nonterminal A\n"; return p1; ]
+ fun merge(p1, p2) [ std::cout << "merging nonterminal A\n"; return p1; ]
-> d;
-> B;
diff -Naur elkhound-orig/src/elkhound/triv/CAdB.gr.in elkhound/src/elkhound/triv/CAdB.gr.in
--- elkhound-orig/src/elkhound/triv/CAdB.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/CAdB.gr.in 2017-03-16 22:18:26.000000000 +0100
@@ -20,7 +20,7 @@
}
nonterm A {
- fun merge(p1, p2) [ cout << "merging nonterminal A\n"; return p1; ]
+ fun merge(p1, p2) [ std::cout << "merging nonterminal A\n"; return p1; ]
-> d;
-> B;
diff -Naur elkhound-orig/src/elkhound/triv/DeclExpr.gr.in elkhound/src/elkhound/triv/DeclExpr.gr.in
--- elkhound-orig/src/elkhound/triv/DeclExpr.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/DeclExpr.gr.in 2017-03-16 22:18:30.000000000 +0100
@@ -15,7 +15,7 @@
}
nonterm Stmt {
- merge(L,R) [ cout << "merging Stmt\n"; return L; ]
+ merge(L,R) [ std::cout << "merging Stmt\n"; return L; ]
dup(v) [ return v; ]
del(v) []
diff -Naur elkhound-orig/src/elkhound/triv/EEb.gr.in elkhound/src/elkhound/triv/EEb.gr.in
--- elkhound-orig/src/elkhound/triv/EEb.gr.in 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/triv/EEb.gr.in 2017-03-16 22:18:36.000000000 +0100
@@ -9,7 +9,7 @@
}
nonterm E {
- fun merge(L,R) [ cout << "merging E\n"; return ++count; ]
+ fun merge(L,R) [ std::cout << "merging E\n"; return ++count; ]
fun dup(v) [ return ++count; ]
fun del(v) []
diff -Naur elkhound-orig/src/elkhound/trivmain.cc elkhound/src/elkhound/trivmain.cc
--- elkhound-orig/src/elkhound/trivmain.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/elkhound/trivmain.cc 2017-03-16 22:02:24.000000000 +0100
@@ -156,7 +156,7 @@
// count # of parses
if (count) {
TreeCount numParses = top->countTrees();
- cout << "num parses: " << numParses << endl;
+ std::cout << "num parses: " << numParses << std::endl;
TreeCount should = 0; // meaning unknown
if (0==strcmp(GRAMMAR_NAME, "triv/SSx.tree.bin")) {
@@ -167,17 +167,17 @@
}
if (should != 0) {
- cout << "should be: " << should << endl;
+ std::cout << "should be: " << should << std::endl;
if (should != numParses) {
- cout << "MISMATCH in number of parse trees\n";
+ std::cout << "MISMATCH in number of parse trees\n";
}
}
}
- cout << "tree nodes: " << PTreeNode::allocCount
- << endl;
+ std::cout << "tree nodes: " << PTreeNode::allocCount
+ << std::endl;
if (tracingSys("printTree")) {
- top->printTree(cout);
+ top->printTree(std::cout);
}
}
diff -Naur elkhound-orig/src/smbase/bflatten.cc elkhound/src/smbase/bflatten.cc
--- elkhound-orig/src/smbase/bflatten.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bflatten.cc 2017-03-16 21:34:04.000000000 +0100
@@ -92,7 +92,7 @@
}
else /*reading*/ {
// read the int name
- int name = readInt();
+ intptr_t name = readInt();
if (name == 0) { // null
xassert(nullable);
diff -Naur elkhound-orig/src/smbase/bflatten.h elkhound/src/smbase/bflatten.h
--- elkhound-orig/src/smbase/bflatten.h 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bflatten.h 2017-03-16 21:34:48.000000000 +0100
@@ -15,7 +15,7 @@
struct OwnerMapping {
void *ownerPtr; // a pointer
- int intName; // a unique integer name
+ intptr_t intName; // a unique integer name
};
OwnerHashTable<OwnerMapping> ownerTable; // owner <-> int mapping
int nextUniqueName; // counter for making int names
diff -Naur elkhound-orig/src/smbase/bitarray.cc elkhound/src/smbase/bitarray.cc
--- elkhound-orig/src/smbase/bitarray.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/bitarray.cc 2017-03-16 21:55:42.000000000 +0100
@@ -231,9 +231,9 @@
string s2 = toStringViaIter(b);
if (s1 != s2 ||
!s1.equals(str)) {
- cout << "str: " << str << endl;
- cout << " s1: " << s1 << endl;
- cout << " s2: " << s2 << endl;
+ std::cout << "str: " << str << std::endl;
+ std::cout << " s1: " << s1 << std::endl;
+ std::cout << " s2: " << s2 << std::endl;
xbase("testIter failed");
}
@@ -249,8 +249,8 @@
string cStr = toString(c);
if (!inv.equals(cStr)) {
- cout << " inv: " << inv << endl;
- cout << "cStr: " << cStr << endl;
+ std::cout << " inv: " << inv << std::endl;
+ std::cout << "cStr: " << cStr << std::endl;
xbase("test inverter failed");
}
}
@@ -277,18 +277,18 @@
string iStr = toString(i);
if (!uStr.equals(expectUnion)) {
- cout << " s1: " << s1 << endl;
- cout << " s2: " << s2 << endl;
- cout << " uStr: " << uStr << endl;
- cout << "expectUnion: " << expectUnion << endl;
+ std::cout << " s1: " << s1 << std::endl;
+ std::cout << " s2: " << s2 << std::endl;
+ std::cout << " uStr: " << uStr << std::endl;
+ std::cout << "expectUnion: " << expectUnion << std::endl;
xbase("test union failed");
}
if (!iStr.equals(expectIntersection)) {
- cout << " s1: " << s1 << endl;
- cout << " s2: " << s2 << endl;
- cout << " iStr: " << iStr << endl;
- cout << "expectIntersection: " << expectIntersection << endl;
+ std::cout << " s1: " << s1 << std::endl;
+ std::cout << " s2: " << s2 << std::endl;
+ std::cout << " iStr: " << iStr << std::endl;
+ std::cout << "expectIntersection: " << expectIntersection << std::endl;
xbase("test intersection failed");
}
}
@@ -300,9 +300,9 @@
bool answer = b.anyEvenOddBitPair();
if (answer != expect) {
static char const *boolName[] = { "false", "true" };
- cout << " s: " << s << endl;
- cout << "answer: " << boolName[answer] << endl;
- cout << "expect: " << boolName[expect] << endl;
+ std::cout << " s: " << s << std::endl;
+ std::cout << "answer: " << boolName[answer] << std::endl;
+ std::cout << "expect: " << boolName[expect] << std::endl;
xbase("test anyEvenOddBitPair failed");
}
}
@@ -365,7 +365,7 @@
testAnyEvenOddBitPair("11110", true);
testAnyEvenOddBitPair("01100", false);
- cout << "bitarray is ok\n";
+ std::cout << "bitarray is ok\n";
}
USUAL_MAIN
diff -Naur elkhound-orig/src/smbase/growbuf.cc elkhound/src/smbase/growbuf.cc
--- elkhound-orig/src/smbase/growbuf.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/growbuf.cc 2017-03-16 21:53:58.000000000 +0100
@@ -43,7 +43,7 @@
xfailure("buffer contents are wrong");
}
}
- cout << "growbuf ok\n";
+ std::cout << "growbuf ok\n";
}
USUAL_MAIN
diff -Naur elkhound-orig/src/smbase/srcloc.cc elkhound/src/smbase/srcloc.cc
--- elkhound-orig/src/smbase/srcloc.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/srcloc.cc 2017-03-16 22:00:08.000000000 +0100
@@ -748,7 +748,7 @@
fseek(fp, 0, SEEK_END);
len = (int)ftell(fp);
- cout << "length of " << fname << ": " << len << endl;
+ std::cout << "length of " << fname << ": " << len << std::endl;
}
// get locations for the start and end
@@ -897,23 +897,23 @@
int ppLine;
for (ppLine = 1; ppLine < 10; ppLine++) {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
- cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+ std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
}
// similar for last few lines
for (ppLine = pp->numLines - 4; ppLine <= pp->numLines; ppLine++) {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
- cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+ std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
}
// see how the expander line behaves
if (!expanderLine) {
- cout << "didn't find expander line!\n";
+ std::cout << "didn't find expander line!\n";
exit(2);
}
else {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", expanderLine, 1);
- cout << "expander column 1: " << toString(loc) << endl;
+ std::cout << "expander column 1: " << toString(loc) << std::endl;
// in the pp file, I can advance the expander horizontally a long ways;
// this should truncate to column 9
@@ -922,16 +922,16 @@
char const *fname;
int offset;
mgr.decodeOffset(loc, fname, offset);
- cout << "expander column 21: " << fname << ", offset " << offset << endl;
+ std::cout << "expander column 21: " << fname << ", offset " << offset << std::endl;
xassert(0==strcmp(fname, "srcloc.test.cc"));
// map that to line/col, which should show the truncation
int line, col;
orig->charToLineCol(offset, line, col);
- cout << "expander column 21: " << locString(fname, line, col) << endl;
+ std::cout << "expander column 21: " << locString(fname, line, col) << std::endl;
if (col != 9 && col != 10) {
// 9 is for LF line endings, 10 for CRLF
- cout << "expected column 9 or 10!\n";
+ std::cout << "expected column 9 or 10!\n";
exit(2);
}
}
@@ -947,7 +947,7 @@
for (int ppLine = 1; ppLine <= pp->numLines; ppLine++) {
SourceLoc loc = mgr.encodeLineCol("srcloc.test2.cc", ppLine, 1);
- cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+ std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
}
}
@@ -956,7 +956,7 @@
{
xBase::logExceptions = false;
traceAddSys("progress");
- traceProgress() << "begin" << endl;
+ traceProgress() << "begin" << std::endl;
if (argc >= 2) {
// set maxStaticLocs low to test the warning
@@ -974,22 +974,22 @@
testFile("srcloc.h");
}
- traceProgress() << "end" << endl;
+ traceProgress() << "end" << std::endl;
// protect against degeneracy by printing the length of
// the longest line
- cout << "\n";
- cout << "long line len: " << longestLen << endl;
+ std::cout << "\n";
+ std::cout << "long line len: " << longestLen << std::endl;
// test the statics
- cout << "invalid: " << toString(SL_UNKNOWN) << endl;
- cout << "here: " << toString(HERE_SOURCELOC) << endl;
+ std::cout << "invalid: " << toString(SL_UNKNOWN) << std::endl;
+ std::cout << "here: " << toString(HERE_SOURCELOC) << std::endl;
- cout << "\n";
+ std::cout << std::endl;
testHashMap();
testHashMap2();
- cout << "srcloc is ok\n";
+ std::cout << "srcloc is ok\n";
}
ARGS_MAIN
diff -Naur elkhound-orig/src/smbase/srcloc.test.cc elkhound/src/smbase/srcloc.test.cc
--- elkhound-orig/src/smbase/srcloc.test.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/srcloc.test.cc 2017-03-16 22:00:22.000000000 +0100
@@ -757,7 +757,7 @@
fseek(fp, 0, SEEK_END);
len = (int)ftell(fp);
- cout << "length of " << fname << ": " << len << endl;
+ std::cout << "length of " << fname << ": " << len << std::endl;
}
// get locations for the start and end
@@ -906,23 +906,23 @@
int ppLine;
for (ppLine = 1; ppLine < 10; ppLine++) {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
- cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+ std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
}
// similar for last few lines
for (ppLine = pp->numLines - 4; ppLine <= pp->numLines; ppLine++) {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", ppLine, 1);
- cout << "ppLine " << ppLine << ": " << toString(loc) << endl;
+ std::cout << "ppLine " << ppLine << ": " << toString(loc) << std::endl;
}
// see how the expander line behaves
if (!expanderLine) {
- cout << "didn't find expander line!\n";
+ std::cout << "didn't find expander line!\n";
exit(2);
}
else {
SourceLoc loc = mgr.encodeLineCol("srcloc.tmp", expanderLine, 1);
- cout << "expander column 1: " << toString(loc) << endl;
+ std::cout << "expander column 1: " << toString(loc) << std::endl;
// in the pp file, I can advance the expander horizontally a long ways;
// this should truncate to column 9
@@ -931,16 +931,16 @@
char const *fname;
int offset;
mgr.decodeOffset(loc, fname, offset);
- cout << "expander column 21: " << fname << ", offset " << offset << endl;
+ std::cout << "expander column 21: " << fname << ", offset " << offset << std::endl;
xassert(0==strcmp(fname, "srcloc.cc"));
// map that to line/col, which should show the truncation
int line, col;
orig->charToLineCol(offset, line, col);
- cout << "expander column 21: " << locString(fname, line, col) << endl;
+ std::cout << "expander column 21: " << locString(fname, line, col) << std::endl;
if (col != 9 && col != 10) {
// 9 is for LF line endings, 10 for CRLF
- cout << "expected column 9 or 10!\n";
+ std::cout << "expected column 9 or 10!\n";
exit(2);
}
}
@@ -950,7 +950,7 @@
void entry(int argc, char ** /*argv*/)
{
traceAddSys("progress");
- traceProgress() << "begin" << endl;
+ traceProgress() << "begin" << std::endl;
if (argc >= 2) {
// set maxStaticLocs low to test the warning
@@ -968,21 +968,21 @@
testFile("srcloc.h");
}
- traceProgress() << "end" << endl;
+ traceProgress() << "end" << std::endl;
// protect against degeneracy by printing the length of
// the longest line
- cout << "\n";
- cout << "long line len: " << longestLen << endl;
+ std::cout << std::endl;
+ std::cout << "long line len: " << longestLen << std::endl;
// test the statics
- cout << "invalid: " << toString(SL_UNKNOWN) << endl;
- cout << "here: " << toString(HERE_SOURCELOC) << endl;
+ std::cout << "invalid: " << toString(SL_UNKNOWN) << std::endl;
+ std::cout << "here: " << toString(HERE_SOURCELOC) << std::endl;
- cout << "\n";
+ std::cout << std::endl;
testHashMap();
- cout << "srcloc is ok\n";
+ std::cout << "srcloc is ok\n";
}
ARGS_MAIN
diff -Naur elkhound-orig/src/smbase/str.cpp elkhound/src/smbase/str.cpp
--- elkhound-orig/src/smbase/str.cpp 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/str.cpp 2017-03-16 22:00:34.000000000 +0100
@@ -468,9 +468,9 @@
void test(unsigned long val)
{
- //std::cout << stringb(val << " in hex: 0x" << stringBuilder::Hex(val)) << endl;
+ //std::cout << stringb(val << " in hex: 0x" << stringBuilder::Hex(val)) << std::endl;
- std::cout << stringb(val << " in hex: " << SBHex(val)) << endl;
+ std::cout << stringb(val << " in hex: " << SBHex(val)) << std::endl;
}
int main()
@@ -483,7 +483,7 @@
test(1);
std::cout << "stringf: " << stringf("int=%d hex=%X str=%s char=%c float=%f",
- 5, 0xAA, "hi", 'f', 3.4) << endl;
+ 5, 0xAA, "hi", 'f', 3.4) << std::endl;
std::cout << "tests passed\n";
diff -Naur elkhound-orig/src/smbase/strhash.cc elkhound/src/smbase/strhash.cc
--- elkhound-orig/src/smbase/strhash.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/strhash.cc 2017-03-16 22:01:28.000000000 +0100
@@ -333,7 +333,7 @@
dataArray = new StringArray(0);
char *delim = " \t\n\r\v\f";
std::filebuf fb;
- fb.open (inFileName, ios::in);
+ fb.open (inFileName, std::ios::in);
std::istream in(&fb);
while(true) {
stringBuilder s;
@@ -492,7 +492,7 @@
}
} else if (strcmp(*argv, "--file")==0) {
if (numRandStrs) {
- std::cout << "do not use --random and --file together" << endl;
+ std::cout << "do not use --random and --file together" << std::endl;
usage();
exit(1);
}
diff -Naur elkhound-orig/src/smbase/svdict.cc elkhound/src/smbase/svdict.cc
--- elkhound-orig/src/smbase/svdict.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/svdict.cc 2017-03-16 21:58:54.000000000 +0100
@@ -496,7 +496,7 @@
dict2.remove(key.c_str());
}
else {
- dict2.modify(key.c_str(), (void*)((int)value + 24));
+ dict2.modify(key.c_str(), (void*)((intptr_t)value + 24));
}
xassert(dict2 != dict);
}
diff -Naur elkhound-orig/src/smbase/typ.h elkhound/src/smbase/typ.h
--- elkhound-orig/src/smbase/typ.h 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/typ.h 2017-03-16 21:32:06.000000000 +0100
@@ -5,6 +5,8 @@
#ifndef __TYP_H
#define __TYP_H
+#include <stdint.h>
+
// byte
typedef unsigned char byte;
typedef signed char signed_byte;
@@ -30,8 +32,8 @@
// This used when I want to cast a pointer to an integer for something
// like hashing the address. It need not be injective.
-inline long pointerToInteger(void const *p)
- { return (long)p; }
+inline intptr_t pointerToInteger(void const *p)
+ { return (intptr_t)p; }
// This can be used to compare two pointers, even when they do not point
@@ -45,7 +47,7 @@
// existence of this function at least ensures I only have to change
// one place.
return p==q? 0 :
- (long)p < (long)q? -1 : // would use std::less<> here
+ (intptr_t)p < (intptr_t)q? -1 : // would use std::less<> here
+1 ;
}
diff -Naur elkhound-orig/src/smbase/voidlist.cc elkhound/src/smbase/voidlist.cc
--- elkhound-orig/src/smbase/voidlist.cc 2017-01-27 11:23:36.000000000 +0100
+++ elkhound/src/smbase/voidlist.cc 2017-03-16 21:52:18.000000000 +0100
@@ -749,10 +749,10 @@
// whereas isSorted would forget that info)
void verifySorted(VoidList const &list)
{
- int prev = 0;
+ intptr_t prev = 0;
VoidListIter iter(list);
for (; !iter.isDone(); iter.adv()) {
- int current = (int)iter.data();
+ intptr_t current = (intptr_t)iter.data();
xassert(prev <= current); // numeric address test
prev = current;
}
I've tested it on Cygwin (32bit and 64bit) and Debian 7.6 (32bit).
However, "make check" failed with the following error on Cygwin (both 32bit and 64bit):
------------ [12] triv/ESb.gr.exe triv/ESb.in1 ------------
reduced by E -> empty
reduced by E -> empty
reduced by S -> a
reduced by S -> a
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
reduced by S -> E S b
reduced by S -> E S b
WARNING: there is no action to deallocate nonterm S
Exception thrown: Assertion failed: referenceCount > 0, file glr.cc line 455
Assertion failed: referenceCount > 0, file glr.cc line 455
[12] A regression test command failed:
triv/ESb.gr.exe triv/ESb.in1