Fixes several (classes of) warnings to allow compiling with -Wall and being less overwhelmed.
Warning fixes #399
pull muggenhor wants to merge 7 commits into bitcoin:master from muggenhor:warning-fixes changing 11 files +18 −20-
muggenhor commented at 12:30 PM on July 12, 2011: contributor
-
muggenhor commented at 12:42 PM on July 12, 2011: contributor
PS I'm not entirely sure what to do with this (in function 'movecmd'):
rpc.cpp:736:9: warning: variable ‘nMinDepth’ set but not used [-Wunused-but-set-variable]
The most obvious solution would be to ditch the nMinDepth variable (and it's assignment) completely. If type-checking the value remains important this code:
int nMinDepth = 1; if (params.size() > 3) nMinDepth = params[3].get_int();could be replaced by this code:
if (params.size() > 3) // unused parameter, used to be nMinDepth, keep type-checking it though (void)params[3].get_int(); -
jgarzik commented at 2:17 AM on July 13, 2011: contributor
looks good, but can you please regenerate (rebase) on top of current -tip ?
-
df40181417
fix warning on 64bit systems: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
ecf1c79aad
fix warnings: expression result unused [-Wunused-value]
In the assert()s take advantage of the fact that string constants ("string") are effectively of type 'const char []', which when used in an expression yield a non-NULL pointer. An assertion that should always fail can thus be formulated as: assert(!"fail); An assertion where a text message should be added to the expression can be written as such: assert("message" && expression); Signed-off-by: Giel van Schijndel <me@mortis.eu> -
f85c097449
fix warnings: using the result of an assignment as a condition without parentheses [-Wparentheses]
Don't unnecessarily assign to variables within the *boolean* expression of a conditional. Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
d7f1d200ab
fix warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
Don't check for a negative parameter count, because not only will it never happen, it doesn't make any sense either. Invalid sockets (as returned by socket(2)) are always exactly -1 (not just negative as negative file descriptors are technically not prohibited by POSIX) on POSIX systems. Since we store them in SOCKET (unsigned int), however, that really is ~0U (or MAX_UINT) which happens to be what INVALID_SOCKET is already defined to, so an additional check for being negative is not only unnecessary (unsigned integers aren't *ever* negative) its redundant as well (the INVALID_SOCKET comparison is enough). Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
225f222c9f
fix warning: X enumeration values not handled in switch [-Wswitch-enum]
Add default cases to opcode switches to assert that they should never occur. Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
858cebed7d
fix warning: unused variable 'X' [-Wunused-variable]
Remove several unused variables. Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
d0538a81bb
fix warning: unused function 'SigIllHandlerSSE2' [-Wunused-function]
Only declare & define SigIllHandlerSSE2 when its used. Signed-off-by: Giel van Schijndel <me@mortis.eu>
-
muggenhor commented at 3:11 AM on July 13, 2011: contributor
done
- jgarzik referenced this in commit 4ea952d5c0 on Jul 13, 2011
- jgarzik merged this on Jul 13, 2011
- jgarzik closed this on Jul 13, 2011
- laanwj referenced this in commit 0ffb3bd95f on Aug 4, 2016
- laanwj referenced this in commit b2135359b3 on Aug 16, 2016
- MarcoFalke referenced this in commit 64dfdde0aa on Dec 13, 2016
- deadalnix referenced this in commit 24ad20f75b on Jan 19, 2017
- classesjack referenced this in commit 7cffa57caa on Jan 2, 2018
- lateminer referenced this in commit 25f16d199e on Oct 16, 2019
- rajarshimaitra referenced this in commit 124766ca1e on Aug 5, 2021
- DrahtBot locked this on Sep 8, 2021
Linked (view graph)