Warning fixes #399

pull muggenhor wants to merge 7 commits into bitcoin:master from muggenhor:warning-fixes changing 11 files +18 −20
  1. muggenhor commented at 12:30 PM on July 12, 2011: contributor

    Fixes several (classes of) warnings to allow compiling with -Wall and being less overwhelmed.

  2. 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();
    
  3. jgarzik commented at 2:17 AM on July 13, 2011: contributor

    looks good, but can you please regenerate (rebase) on top of current -tip ?

  4. 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>
    df40181417
  5. 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>
    ecf1c79aad
  6. 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>
    f85c097449
  7. 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>
    d7f1d200ab
  8. 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>
    225f222c9f
  9. fix warning: unused variable 'X' [-Wunused-variable]
    Remove several unused variables.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    858cebed7d
  10. fix warning: unused function 'SigIllHandlerSSE2' [-Wunused-function]
    Only declare & define SigIllHandlerSSE2 when its used.
    
    Signed-off-by: Giel van Schijndel <me@mortis.eu>
    d0538a81bb
  11. muggenhor commented at 3:11 AM on July 13, 2011: contributor

    done

  12. jgarzik referenced this in commit 4ea952d5c0 on Jul 13, 2011
  13. jgarzik merged this on Jul 13, 2011
  14. jgarzik closed this on Jul 13, 2011

  15. laanwj referenced this in commit 0ffb3bd95f on Aug 4, 2016
  16. laanwj referenced this in commit b2135359b3 on Aug 16, 2016
  17. MarcoFalke referenced this in commit 64dfdde0aa on Dec 13, 2016
  18. deadalnix referenced this in commit 24ad20f75b on Jan 19, 2017
  19. classesjack referenced this in commit 7cffa57caa on Jan 2, 2018
  20. lateminer referenced this in commit 25f16d199e on Oct 16, 2019
  21. rajarshimaitra referenced this in commit 124766ca1e on Aug 5, 2021
  22. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me