Do not shadow global RPC table variable (tableRPC) #8163

pull paveljanik wants to merge 1 commits into bitcoin:master from paveljanik:20160607_shadowing_rpc changing 8 files +19 −19
  1. paveljanik commented at 4:52 pm on June 7, 2016: contributor

    Continues #8105.

    There is (one) global RPC table - tableRPC. Various registration functions use the same-named argument and thus -Wshadow reports them as shadowing the global one:

    E.g.:

    0./rpc/register.h:23:58: warning: declaration shadows a variable in the global namespace [-Wshadow]
    1static inline void RegisterAllCoreRPCCommands(CRPCTable &tableRPC)
    2                                                         ^
    3./rpc/server.h:163:18: note: previous declaration is here
    4extern CRPCTable tableRPC;
    5                 ^
    

    As discussed on IRC, I have chosen to rename the arguments only and do no more changes.

    Review of this should be pretty straight forward. Just compare binaries. View the diff in visual diff or so.

    To provide tested ACK, cherrypick https://github.com/paveljanik/bitcoin/commit/5d2f98e8d1b3772f50c755e6957cb97e0dfe1e9e and compare master build log and this PR build log.

  2. paveljanik force-pushed on Jun 7, 2016
  3. in src/rpc/register.h: in 9e200aff47 outdated
     9@@ -10,23 +10,23 @@
    10 class CRPCTable;
    11 
    12 /** Register block chain RPC commands */
    13-void RegisterBlockchainRPCCommands(CRPCTable &tableRPC);
    14+void RegisterBlockchainRPCCommands(CRPCTable &t);
    


    MarcoFalke commented at 10:09 am on June 8, 2016:
    Is it required to change the prototypes as well?

    paveljanik commented at 10:22 am on June 8, 2016:
    In prototypes, you do not need argument names at all, so I expect the change is not needed strictly speaking (edit: I have just verified this…). I did it just for consistency.

    sipa commented at 12:56 pm on August 25, 2016:
    I don’t think consistency is useful here; using full names is nicer for documentation purposes.

    paveljanik commented at 1:03 pm on August 25, 2016:
    Accepted. Force pushed.

    mmeijeri commented at 7:40 pm on August 25, 2016:
    Agree with sipa: the real solution is to eliminate the global variable, not to use a less descriptive name here.
  4. MarcoFalke added the label Refactoring on Jun 8, 2016
  5. MarcoFalke added the label RPC/REST/ZMQ on Jun 8, 2016
  6. MarcoFalke commented at 10:19 am on June 8, 2016: member
    identical binaries ACK 9e200af
  7. paveljanik commented at 6:57 pm on July 31, 2016: contributor
    more ACKs please
  8. Do not shadow global RPC table variable (tableRPC) de1bbe3b78
  9. paveljanik force-pushed on Aug 25, 2016
  10. MarcoFalke commented at 2:20 pm on August 25, 2016: member
    re-utACK de1bbe3
  11. laanwj commented at 2:07 pm on August 31, 2016: member
    utACK de1bbe3
  12. laanwj merged this on Aug 31, 2016
  13. laanwj closed this on Aug 31, 2016

  14. laanwj referenced this in commit 0c8875d23b on Aug 31, 2016
  15. codablock referenced this in commit 78f3dc51aa on Sep 19, 2017
  16. codablock referenced this in commit d83331d31a on Jan 9, 2018
  17. codablock referenced this in commit 9d061a2730 on Jan 9, 2018
  18. andvgal referenced this in commit dbfcff2fdd on Jan 6, 2019
  19. 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: 2024-09-29 07:12 UTC

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