From: Scott Gasch Date: Thu, 4 Oct 2018 03:38:03 +0000 (-0700) Subject: Update codebase to remove clang warnings (and a couple of legit errors X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=typhoon.git Update codebase to remove clang warnings (and a couple of legit errors it found) --- diff --git a/src/GNUmakefile b/src/GNUmakefile index 1ef7fc9..a88b58b 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -19,8 +19,8 @@ # # $Id$ # -CC = gcc -CXX = g++ +CC = clang +CXX = clang++ NASM = yasm ifdef OSX LIBRARIES = -pthread -lc @@ -45,15 +45,15 @@ RM = /bin/rm # ifdef ASM ifdef SIXTYFOUR - PROFILE = -S -fverbose-asm -std=gnu99 -D_X64_ + PROFILE = -S -fverbose-asm -D_X64_ else - PROFILE = -S -fverbose-asm -std=gnu99 -D_X86_ + PROFILE = -S -fverbose-asm -D_X86_ endif else ifdef SIXTYFOUR - PROFILE = -std=gnu99 -D_X64_ + PROFILE = -D_X64_ else - PROFILE = -std=gnu99 -D_X86_ + PROFILE = -D_X86_ endif endif diff --git a/src/book.c b/src/book.c index 217b4ad..b9cb694 100755 --- a/src/book.c +++ b/src/book.c @@ -1831,7 +1831,7 @@ Return value: // else { - memset(pEntry, 0, sizeof(pEntry)); + memset(pEntry, 0, sizeof(*pEntry)); pEntry->u64Sig = entry.u64Sig; pEntry->mvNext = entry.mvNext; pEntry->u64NextSig = entry.u64NextSig; diff --git a/src/chess.h b/src/chess.h index c815701..2bfec4d 100755 --- a/src/chess.h +++ b/src/chess.h @@ -1233,8 +1233,8 @@ _assert(CHAR *szFile, ULONG uLine); RANK1(c) || \ FILEA(c) || \ FILEH(c)) -#define CORNER_DISTANCE(c) (MAX(MIN((ULONG)abs(RANK(c) - 7), RANK(c)),\ - MIN((ULONG)abs(FILE(c) - 7), FILE(c)))) +#define CORNER_DISTANCE(c) (MAX(MIN((ULONG)(RANK(c) - 7), RANK(c)),\ + MIN((ULONG)(FILE(c) - 7), FILE(c)))) #define IN_CORNER(c) (((c) == A8) || \ ((c) == A1) || \ ((c) == H8) || \ diff --git a/src/egtb.cpp b/src/egtb.cpp index bc39636..fd9c4bb 100644 --- a/src/egtb.cpp +++ b/src/egtb.cpp @@ -6279,7 +6279,7 @@ static void VCheckSize if (cb != cbOk1 && cb != cbOk2) { printf ("*** %s corrupted " - DEC_INDEX_FORMAT" "DEC_INDEX_FORMAT" "DEC_INDEX_FORMAT"\n", + DEC_INDEX_FORMAT " " DEC_INDEX_FORMAT " " DEC_INDEX_FORMAT "\n", rgchTbName, cbOk1, cbOk2, cb); exit (1); } diff --git a/src/eval.c b/src/eval.c index 944642a..b6a7792 100755 --- a/src/eval.c +++ b/src/eval.c @@ -699,7 +699,7 @@ ExportEvalDNA() } FLAG -WriteEvalDNA(char *szFilename) +WriteEvalDNA(char *szFilename) { FILE *p = NULL; char *q = NULL; @@ -710,7 +710,7 @@ WriteEvalDNA(char *szFilename) if (!p) goto end; q = ExportEvalDNA(); if (!q) goto end; - fprintf(p, q); + fprintf(p, "%s", q); fRet = TRUE; end: if (p) fclose(p); @@ -719,7 +719,7 @@ WriteEvalDNA(char *szFilename) } FLAG -ImportEvalDNA(char *p) +ImportEvalDNA(char *p) { ULONG u, v; diff --git a/src/ics.c b/src/ics.c index 5a8d2cd..fba1af6 100755 --- a/src/ics.c +++ b/src/ics.c @@ -257,7 +257,7 @@ Return value: // // Handle double jumps. // - if (abs(RANK(cTo) - RANK(cFrom)) > 1) + if (RANK(cTo) - RANK(cFrom) > 1) { mv.bvFlags = MOVE_FLAG_SPECIAL; } diff --git a/src/typhoon.log b/src/typhoon.log deleted file mode 100644 index a436792..0000000 --- a/src/typhoon.log +++ /dev/null @@ -1,66 +0,0 @@ -Typhoon 1.00 (built on Sep 11 2014 08:20:24): - Copyright (C) 2000-2007, Scott Gasch (scott.gasch@gmail.com) - $Id: chess.h 354 2008-06-30 05:10:08Z scott $ - GCC 4.2.1 20070831 patched [FreeBSD] - Make profile used: -std=gnu99 -D_X64_ -g -O3 -fexpensive-optimizations -ffast-math -finline-functions -m64 -DMP -DSMP - Multiprocessor enabled; 1 searcher thread - Hash sizes: 1 Mb (main), 11 Mb / thread (pawn), 48 Mb / thread (eval) - QCheckPlies: 1 - FutilityBase: 50 - Logging Eval DNA. --1,90,81,73,67,62,57,52,50,50,50,50,50,50,50,50,-1,-1,125,117,109,100,91,84,78,71,66,66,66,66,66,66,66,-1,-1,150,132,124,116,109,102,94,87,77,77,77,77,77,77,77,-1 --43,-15,0,3,6,10,15,21,28,-63,-25,0,4,9,14,19,25,32,-10,0,0,7,15,20,24,29,36 -0,0,0,0,0,0,0,0,0,1,1,1,1,1,2,3,4,5,6,6,7,7,7,7,8,8,8,8,8,8,8,8 -8,8,8,8,8,8,8,8,8,7,7,7,7,6,6,5,4,3,3,3,2,2,2,1,1,1,0,0,0,0,0,0 -8,8,8,8,8,8,7,7,7,6,7,5,4,5,4,3,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-8,0,0,0,0,0,0,-8,0,0,0,0,0,0,0,0,-8,0,5,5,5,5,0,-8,0,0,0,0,0,0,0,0,-8,0,5,9,9,5,0,-8,0,0,0,0,0,0,0,0,-8,0,5,9,9,5,0,-8,0,0,0,0,0,0,0,0,-8,0,5,5,5,5,0,-8,0,0,0,0,0,0,0,0,-8,0,0,0,0,0,0,-8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-7,-5,-5,-7,-7,-5,-5,-7,0,0,0,0,0,0,0,0,-5,-4,-4,-5,-5,-4,-4,-5,0,0,0,0,0,0,0,0,-4,-3,-3,-4,-4,-3,-3,-4,0,0,0,0,0,0,0,0,-4,-3,-3,-4,-4,-3,-3,-4,0,0,0,0,0,0,0,0,-5,-4,-4,-5,-5,-4,-4,-5,0,0,0,0,0,0,0,0,-7,-5,-5,-7,-7,-5,-5,-7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-12,-9,-9,-11,-11,-9,-9,-12,0,0,0,0,0,0,0,0,-9,-7,-7,-9,-9,-7,-7,-9,0,0,0,0,0,0,0,0,-7,-6,-6,-7,-7,-6,-6,-7,0,0,0,0,0,0,0,0,-7,-6,-6,-7,-7,-6,-6,-7,0,0,0,0,0,0,0,0,-9,-7,-7,-9,-9,-7,-7,-9,0,0,0,0,0,0,0,0,-12,-9,-9,-11,-11,-9,-9,-12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,-32,-65,-99,-134,-170,-207,-222,-250,0,-23,-47,-76,-108,-144,-184,-200,-216,0,-13,-23,-34,-46,-64,-86,-111,-138,0,-7,-13,-25,-39,-55,-73,-95,-121 -0,-3,-7,-9,-16,-35,-50,-85,-100 -0,-7,-8,-9,-10,-10,-9,-8,-7 --5 --11 -0,0,162,111,62,36,18,13,0,0,0,13,18,36,62,111,162,0 -0,0,0,48,34,22,13,9,0,0,0,9,13,22,34,48,0,0 -0,0,96,74,48,21,10,5,0,0,0,5,10,21,48,74,96,0 -0,0,60,40,13,6,3,1,0,0,0,1,3,6,13,40,60,0 -0,0,7,14,21,28,34,41,55 -60,-1,-1,37,-1,43,19,-1,14,9,20,4,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -800 -0,-6,-10,-16,-22 -33 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,52,51,50,49,48,47,45,43,41,40,40,40,40,40,40,40 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,-6,-7,-7,-7,-7,-6,-4,0,0,0,0,0,0,0,0,-6,-7,-9,-8,-8,-9,-7,-6,0,0,0,0,0,0,0,0,-7,-8,-10,-11,-11,-10,-8,-7,0,0,0,0,0,0,0,0,-7,-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9,11,12,13,15,17,19,21,21,22,22,23,23,24,24,25,25,26,27 -24,22,17,14,13,13,12,12 -12,11,9,9,8,8,8,7 -13,12,11,11,9,9,9,8 -0,0,25,17,12,6,1,0,0,0,0,0,1,6,12,17,25,0 -0,0,-22,-16,-13,-9,-5,-3,0,0,0,-3,-5,-9,-13,-16,-22,0 --40 -22 -55,51,44,38,33,27,22,16,7,1,-3,-6,-9,-12,-18,-22,-25 -7 -4 --28,-24,-20,-14,-7,-2,0,4,8,12,15,17,19,21,22 --15,-6,0,4,8,8,8,8 --30,-26,-22,-17,-11,-8,-4,-2,-1,2,4,7,10,12,14,15,16,17,18,19,20,20,21,21,22,22,23,23 -0,-14,-22,-26,-33 -0,34,28,22,19,17,16,15 -8 -1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0 -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,5,7,7,5,3,1,0,0,0,0,0,0,0,0,3,5,13,15,15,13,5,3,0,0,0,0,0,0,0,0,5,7,17,23,23,17,7,5,0,0,0,0,0,0,0,0,5,7,17,23,23,17,7,5,0,0,0,0,0,0,0,0,3,5,13,15,15,13,5,3,0,0,0,0,0,0,0,0,1,3,5,7,7,5,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,-4,-8,-12,-16,-20,-25,-31,-38,-50,-63,-76,-90,-105,-120,-135,-150,-165,-180,-195,-210,-225,-240,-255,-270,-290,-310,-330,-350,-370,-390,-410,-440,-470,-500,-500,-500,-500,-500,-500,-500,-500 --23 diff --git a/src/util.c b/src/util.c index 599c16d..34b3739 100755 --- a/src/util.c +++ b/src/util.c @@ -426,7 +426,7 @@ Return value: // // Skip chunks // - while(!isspace(*p) && &p) p++; + while(!isspace(*p) && *p) p++; if (!*p) return(NULL); } while(1); @@ -702,13 +702,13 @@ Return value: // Send to logfile // if (NULL != g_pfLogfile) { - fprintf(g_pfLogfile, buf); + fprintf(g_pfLogfile, "%s", buf); } // // Send to stdout // - fprintf(stdout, buf); + fprintf(stdout, "%s", buf); fflush(stdout); } @@ -747,7 +747,7 @@ Return value: // Send to logfile // if (NULL != g_pfLogfile) { - fprintf(g_pfLogfile, buf); + fprintf(g_pfLogfile, "%s", buf); fflush(g_pfLogfile); } } @@ -788,14 +788,14 @@ Return value: // Send it to logfile // if (NULL != g_pfLogfile) { - fprintf(g_pfLogfile, buf); + fprintf(g_pfLogfile, "%s", buf); fflush(g_pfLogfile); } // // Send it to stderr // - fprintf(stderr, buf); + fprintf(stderr, "%s", buf); fflush(stderr); }