Fix shadowing of ‘what’ as described in #10080. #10089

pull dooglus wants to merge 1 commits into bitcoin:master from dooglus:fix-what-shadowing changing 1 files +1 −1
  1. dooglus commented at 7:06 pm on March 26, 2017: contributor
    @paveljanik is this what you meant? I didn’t really understand your request.
  2. Fix shadowing of 'what' as described in #10080. c8b6cc77bd
  3. sipa commented at 7:06 pm on March 26, 2017: member
    Duplicate of #10087.
  4. paveljanik commented at 7:08 pm on March 26, 2017: contributor
    Closing mine, as @dooglus was original reporter. Thanks!
  5. dooglus commented at 8:03 pm on March 26, 2017: contributor

    I’m seeing a lot of very similar warnings when building the Qt client:

      1 qt/addressbookpage.cpp:24:108: warning: declaration of ‘parent’ shadows a member of 'this' [-Wshadow]
      1 qt/addressbookpage.cpp:303:89: warning: declaration of ‘parent’ ...
    
      1 qt/addresstablemodel.cpp:167:75: warning: declaration of ‘parent’ ...
      1 qt/addresstablemodel.cpp:180:60: warning: declaration of ‘parent’ ...
      1 qt/addresstablemodel.cpp:186:63: warning: declaration of ‘parent’ ...
      1 qt/addresstablemodel.cpp:192:70: warning: declaration of ‘index’ ...
      1 qt/addresstablemodel.cpp:239:90: warning: declaration of ‘index’ ...
      1 qt/addresstablemodel.cpp:307:66: warning: declaration of ‘index’ ...
      1 qt/addresstablemodel.cpp:324:86: warning: declaration of ‘parent’ ...
      1 qt/addresstablemodel.cpp:327:24: warning: declaration of ‘data’ ...
      1 qt/addresstablemodel.cpp:404:81: warning: declaration of ‘parent’ ...
    
      1 qt/askpassphrasedialog.cpp:21:69: warning: declaration of ‘parent’ ...
      1 qt/askpassphrasedialog.cpp:220:46: warning: declaration of ‘event’ ...
      1 qt/askpassphrasedialog.cpp:237:69: warning: declaration of ‘event’ ...
    
      1 qt/bantablemodel.cpp:85:49: warning: declaration of ‘parent’ ...
      1 qt/bantablemodel.cpp:103:56: warning: declaration of ‘parent’ ...
      1 qt/bantablemodel.cpp:109:59: warning: declaration of ‘parent’ ...
      1 qt/bantablemodel.cpp:115:66: warning: declaration of ‘index’ ...
      1 qt/bantablemodel.cpp:149:62: warning: declaration of ‘index’ ...
      1 qt/bantablemodel.cpp:158:82: warning: declaration of ‘parent’ ...
      1 qt/bantablemodel.cpp:161:19: warning: declaration of ‘data’ ...
    
      1 qt/bitcoinaddressvalidator.cpp:18:75: warning: declaration of ‘parent’ ...
      1 qt/bitcoinaddressvalidator.cpp:83:75: warning: declaration of ‘parent’ ...
    
      1 qt/bitcoinamountfield.cpp:25:44: warning: declaration of ‘parent’ ...
      1 qt/bitcoinamountfield.cpp:36:5: warning: declaration of ‘pos’ ...
      1 qt/bitcoinamountfield.cpp:36:5: warning: declaration of ‘text’ ...
      1 qt/bitcoinamountfield.cpp:62:5: warning: declaration of ‘value’ ...
      1 qt/bitcoinamountfield.cpp:138:5: warning: declaration of ‘text’ ...
      1 qt/bitcoinamountfield.cpp:153:5: warning: declaration of ‘event’ ...
      1 qt/bitcoinamountfield.cpp:193:55: warning: declaration of ‘parent’ ...
      1 qt/bitcoinamountfield.cpp:202:18: warning: declaration of ‘layout’ ...
      1 qt/bitcoinamountfield.cpp:251:68: warning: declaration of ‘event’ ...
      1 qt/bitcoinamountfield.cpp:273:55: warning: declaration of ‘value’ ...
    
      1 qt/bitcoin.cpp:331:17: warning: declaration of ‘platformName’ ...
    
      1 qt/bitcoingui.cpp:81:110: warning: declaration of ‘parent’ ...
      1 qt/bitcoingui.cpp:128:13: warning: declaration of ‘windowTitle’ ...
      1 qt/bitcoingui.cpp:577:13: warning: declaration of ‘toolTip’ ...
      1 qt/bitcoingui.cpp:874:101: warning: declaration of ‘message’ ...
      1 qt/bitcoingui.cpp:874:101: warning: declaration of ‘style’ ...
      1 qt/bitcoingui.cpp:952:47: warning: declaration of ‘event’ ...
      1 qt/bitcoingui.cpp:975:45: warning: declaration of ‘event’ ...
      1 qt/bitcoingui.cpp:999:55: warning: declaration of ‘event’ ...
      1 qt/bitcoingui.cpp:1006:45: warning: declaration of ‘event’ ...
      1 qt/bitcoingui.cpp:1018:60: warning: declaration of ‘event’ ...
      1 qt/bitcoingui.cpp:1216:69: warning: declaration of ‘event’ ...
    
      1 qt/bitcoinunits.cpp:11:43: warning: declaration of ‘parent’ ...
      1 qt/bitcoinunits.cpp:184:55: warning: declaration of ‘parent’ ...
      1 qt/bitcoinunits.cpp:190:65: warning: declaration of ‘index’ ...
    
      1 qt/clientmodel.cpp:32:70: warning: declaration of ‘parent’ ...
    
      1 qt/coincontroldialog.cpp:46:90: warning: declaration of ‘parent’ ...
    
      1 qt/coincontroltreewidget.cpp:8:61: warning: declaration of ‘parent’ ...
      1 qt/coincontroltreewidget.cpp:14:59: warning: declaration of ‘event’ ...
    
      1 qt/editaddressdialog.cpp:14:65: warning: declaration of ‘parent’ ...
    
      1 qt/guiutil.cpp:977:58: warning: declaration of ‘event’ ...
      1 qt/guiutil.cpp:982:64: warning: declaration of ‘event’ ...
      1 qt/guiutil.cpp:456:86: warning: declaration of ‘parent’ ...
      1 qt/guiutil.cpp:585:152: warning: declaration of ‘parent’ ...
    
      1 qt/intro.cpp:118:29: warning: declaration of ‘parent’ ...
    
      1 qt/modaloverlay.cpp:15:43: warning: declaration of ‘parent’ ...
      1 qt/modaloverlay.cpp:149:58: warning: declaration of ‘hide’ ...
    
      1 qt/openuridialog.cpp:13:45: warning: declaration of ‘parent’ ...
    
      1 qt/optionsdialog.cpp:33:64: warning: declaration of ‘parent’ ...
      1 qt/optionsdialog.cpp:89:31: warning: declaration of ‘locale’ ...
      1 qt/optionsdialog.cpp:324:61: warning: declaration of ‘parent’ ...
    
      1 qt/optionsmodel.cpp:31:63: warning: declaration of ‘parent’ ...
      1 qt/optionsmodel.cpp:176:56: warning: declaration of ‘parent’ ...
      1 qt/optionsmodel.cpp:182:66: warning: declaration of ‘index’ ...
      1 qt/optionsmodel.cpp:258:87: warning: declaration of ‘index’ ...
    
      1 qt/overviewpage.cpp:28:81: warning: declaration of ‘parent’ ...
      1 qt/overviewpage.cpp:111:79: warning: declaration of ‘parent’ ...
    
      1 qt/paymentserver.cpp:298:68: warning: declaration of ‘parent’ ...
      1 qt/paymentserver.cpp:346:63: warning: declaration of ‘event’ ...
    
      1 qt/peertablemodel.cpp:112:51: warning: declaration of ‘parent’ ...
      1 qt/peertablemodel.cpp:146:57: warning: declaration of ‘parent’ ...
      1 qt/peertablemodel.cpp:152:60: warning: declaration of ‘parent’ ...
      1 qt/peertablemodel.cpp:158:67: warning: declaration of ‘index’ ...
      1 qt/peertablemodel.cpp:197:63: warning: declaration of ‘index’ ...
      1 qt/peertablemodel.cpp:206:83: warning: declaration of ‘parent’ ...
      1 qt/peertablemodel.cpp:209:25: warning: declaration of ‘data’ ...
    
      1 qt/receivecoinsdialog.cpp:25:92: warning: declaration of ‘parent’ ...
      1 qt/receivecoinsdialog.cpp:213:57: warning: declaration of ‘event’ ...
      1 qt/receivecoinsdialog.cpp:219:56: warning: declaration of ‘event’ ...
    
      1 qt/receiverequestdialog.cpp:32:45: warning: declaration of ‘parent’ ...
      1 qt/receiverequestdialog.cpp:51:55: warning: declaration of ‘event’ ...
      1 qt/receiverequestdialog.cpp:85:62: warning: declaration of ‘event’ ...
      1 qt/receiverequestdialog.cpp:92:59: warning: declaration of ‘parent’ ...
      1 qt/receiverequestdialog.cpp:172:22: warning: declaration of ‘y’ ...
      1 qt/receiverequestdialog.cpp:174:26: warning: declaration of ‘x’ ...
      1 qt/receiverequestdialog.cpp:186:19: warning: declaration of ‘font’ ...
    
      1 qt/recentrequeststablemodel.cpp:16:88: warning: declaration of ‘parent’ ...
      1 qt/recentrequeststablemodel.cpp:39:67: warning: declaration of ‘parent’ ...
      1 qt/recentrequeststablemodel.cpp:46:70: warning: declaration of ‘parent’ ...
      1 qt/recentrequeststablemodel.cpp:53:77: warning: declaration of ‘index’ ...
      1 qt/recentrequeststablemodel.cpp:101:97: warning: declaration of ‘index’ ...
      1 qt/recentrequeststablemodel.cpp:131:93: warning: declaration of ‘parent’ ...
      1 qt/recentrequeststablemodel.cpp:138:88: warning: declaration of ‘parent’ ...
      1 qt/recentrequeststablemodel.cpp:161:73: warning: declaration of ‘index’ ...
      1 qt/recentrequeststablemodel.cpp:186:28: warning: declaration of ‘data’ ...
      1 qt/recentrequeststablemodel.cpp:189:24: warning: declaration of ‘entry’ ...
    
      1 qt/rpcconsole.cpp:409:76: warning: declaration of ‘parent’ ...
      1 qt/rpcconsole.cpp:471:57: warning: declaration of ‘event’ ...
      1 qt/rpcconsole.cpp:738:48: warning: declaration of ‘event’ ...
      1 qt/rpcconsole.cpp:746:73: warning: declaration of ‘message’ ...
      1 qt/rpcconsole.cpp:1066:49: warning: declaration of ‘event’ ...
      1 qt/rpcconsole.cpp:1071:45: warning: declaration of ‘event’ ...
      1 qt/rpcconsole.cpp:1082:45: warning: declaration of ‘event’ ...
    
      1 qt/sendcoinsdialog.cpp:35:86: warning: declaration of ‘parent’ ...
      1 qt/sendcoinsdialog.cpp:879:20: warning: declaration of ‘parent’ ...
      1 qt/sendcoinsdialog.cpp:879:20: warning: declaration of ‘text’ ...
    
      1 qt/sendcoinsentry.cpp:18:84: warning: declaration of ‘parent’ ...
    
      1 qt/signverifymessagedialog.cpp:23:102: warning: declaration of ‘parent’ ...
      1 qt/signverifymessagedialog.cpp:261:73: warning: declaration of ‘event’ ...
    
      1 qt/splashscreen.cpp:39:11: warning: declaration of ‘devicePixelRatio’ ...
      1 qt/splashscreen.cpp:50:13: warning: declaration of ‘font’ ...
      1 qt/splashscreen.cpp:106:19: warning: declaration of ‘x’ ...
      1 qt/splashscreen.cpp:107:19: warning: declaration of ‘y’ ...
      1 qt/splashscreen.cpp:205:49: warning: declaration of ‘event’ ...
      1 qt/splashscreen.cpp:214:49: warning: declaration of ‘event’ ...
    
      1 qt/transactiondescdialog.cpp:12:85: warning: declaration of ‘parent’ ...
    
      1 qt/transactionfilterproxy.cpp:19:63: warning: declaration of ‘parent’ ...
      1 qt/transactionfilterproxy.cpp:34:17: warning: declaration of ‘index’ ...
      1 qt/transactionfilterproxy.cpp:104:65: warning: declaration of ‘parent’ ...
    
      1 qt/transactiontablemodel.cpp:285:64: warning: declaration of ‘parent’ ...
      1 qt/transactiontablemodel.cpp:291:67: warning: declaration of ‘parent’ ...
      1 qt/transactiontablemodel.cpp:521:74: warning: declaration of ‘index’ ...
      1 qt/transactiontablemodel.cpp:694:90: warning: declaration of ‘parent’ ...
      1 qt/transactiontablemodel.cpp:697:24: warning: declaration of ‘data’ ...
      1 qt/transactiontablemodel.cpp:238:120: warning: declaration of ‘parent’ ...
    
      1 qt/transactionview.cpp:38:85: warning: declaration of ‘parent’ ...
      1 qt/transactionview.cpp:123:9: warning: declaration of ‘width’ ...
      1 qt/transactionview.cpp:146:14: warning: declaration of ‘copyTxPlainText’ ...
      1 qt/transactionview.cpp:503:18: warning: declaration of ‘layout’ ...
      1 qt/transactionview.cpp:555:54: warning: declaration of ‘event’ ...
      1 qt/transactionview.cpp:562:62: warning: declaration of ‘event’ ...
    
      1 qt/utilitydialog.cpp:34:65: warning: declaration of ‘parent’ ...
      1 qt/utilitydialog.cpp:74:28: warning: declaration of ‘cursor’ ...
      1 qt/utilitydialog.cpp:164:66: warning: declaration of ‘parent’ ...
      1 qt/utilitydialog.cpp:167:18: warning: declaration of ‘layout’ ...
      1 qt/utilitydialog.cpp:190:51: warning: declaration of ‘event’ ...
    
      1 qt/walletmodel.cpp:33:124: warning: declaration of ‘parent’ ...
    
      1 qt/walletview.cpp:32:76: warning: declaration of ‘parent’ ...
      1 qt/walletview.cpp:152:89: warning: declaration of ‘parent’ ...
    
     29 qt/paymentrequest.pb.h:844:63: warning: declaration of ‘script’ ...
     29 qt/paymentrequest.pb.h:924:73: warning: declaration of ‘network’ ...
     29 qt/paymentrequest.pb.h:1078:67: warning: declaration of ‘memo’ ...
     29 qt/paymentrequest.pb.h:1154:81: warning: declaration of ‘payment_url’ ...
     29 qt/paymentrequest.pb.h:1230:85: warning: declaration of ‘merchant_data’ ...
     29 qt/paymentrequest.pb.h:1334:75: warning: declaration of ‘pki_type’ ...
     29 qt/paymentrequest.pb.h:1410:75: warning: declaration of ‘pki_data’ ...
     29 qt/paymentrequest.pb.h:1486:111: warning: declaration of ‘serialized_payment_details’ ...
     29 qt/paymentrequest.pb.h:1562:77: warning: declaration of ‘signature’ ...
     29 qt/paymentrequest.pb.h:1700:78: warning: declaration of ‘merchant_data’ ...
     29 qt/paymentrequest.pb.h:1860:60: warning: declaration of ‘memo’ ...
     29 qt/paymentrequest.pb.h:1908:75: warning: declaration of ‘payment’ ...
     29 qt/paymentrequest.pb.h:1981:63: warning: declaration of ‘memo’ ...
    
      4 qt/coincontroldialog.h:34:66: warning: declaration of ‘parent’ ...
      4 qt/coincontroldialog.h:34:66: warning: declaration of ‘type’ ...
      4 qt/coincontroldialog.h:35:45: warning: declaration of ‘type’ ...
      4 qt/coincontroldialog.h:36:70: warning: declaration of ‘parent’ ...
      4 qt/coincontroldialog.h:36:70: warning: declaration of ‘type’ ...
    

    I don’t remember seeing them previously (like on the 0.14 branch). What is causing all this ‘shadowing’ all of a sudden?

  6. paveljanik commented at 8:14 pm on March 26, 2017: contributor
    We turned on -Wshadow warnings. These are not emitted in newer gccs/clang.
  7. dooglus commented at 8:17 pm on March 26, 2017: contributor

    Well that explains it then!

    I’m happy to fix these warnings if there’s an acceptable way of coming up with alternative non-shadowing argument names. You didn’t like my underscore, and I don’t know how you came up with your suggested replacement name.

  8. fanquake added the label Refactoring on Mar 26, 2017
  9. jonasschnelli commented at 6:32 am on March 27, 2017: contributor
    utACK c8b6cc77bdb17f872e18c7e7ccb01913ca6beebc. Thanks @dooglus for the list. Yes. We should try to fix those.
  10. laanwj commented at 6:59 am on March 27, 2017: member

    We turned on -Wshadow warnings. These are not emitted in newer gccs/clang.

    Yes, ever since enabling them (and before that) there has been a huge discussion about this. See also my comment here: #9911 (comment)

    Unlike in C, for C++ the concept of shadowing seems to be somewhat subjective per compiler vendor and version. So if the source code is clear in clang, it may still cough up tons of warnings in g++. Older versions of g++ tend to go over the top to emit as many warnings as possible.

    We cannot and should not fix all shadowing warnings for all compilers. Maybe it would make sense to disable the warning for some older gccs. Or as I’ve said many times I think this is getting out of hand and we should disable WShadow. There’s a large chance that one of the ‘fixes’ for WShadow, which seem to trail any larger change in the source code, introduce a bug.

  11. MarcoFalke commented at 8:50 pm on March 27, 2017: member
    NACK. Let’s disable wshadow on oder gcc versions.
  12. fanquake commented at 8:05 am on March 30, 2017: member
    Closing this. Let’s continue discussion about disabling -wshadow / fixing older versions in #10080.
  13. fanquake closed this on Mar 30, 2017

  14. laanwj referenced this in commit 2c83911401 on Apr 1, 2017
  15. practicalswift referenced this in commit c8afd888d2 on Apr 27, 2017
  16. MarcoFalke 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-12-19 00:12 UTC

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