Skip to content

Conversation

@prusnak
Copy link
Contributor

@prusnak prusnak commented Mar 16, 2017

This avoids triggering the following warning (appears almost everywhere where this macro is used):

In file included from rpc/protocol.cpp:10:0:
rpc/protocol.cpp: In function ‘void DeleteAuthCookie()’:
./util.h:83:40: warning: declaration of ‘e’ shadows a previous local [-Wshadow]
     } catch (tinyformat::format_error &e) { \
                                        ^
rpc/protocol.cpp:123:9: note: in expansion of macro ‘LogPrintf’
         LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, e.what());
         ^~~~~~~~~
rpc/protocol.cpp:122:57: note: shadowed declaration is here
     } catch (const boost::filesystem::filesystem_error& e) {
                                                         ^

@laanwj
Copy link
Member

laanwj commented Mar 16, 2017

Is this already covered by #9911?

@prusnak
Copy link
Contributor Author

prusnak commented Mar 16, 2017

No, it's not.

@laanwj
Copy link
Member

laanwj commented Mar 16, 2017

#10009 then? There's too many WShadow pulls open...

@prusnak
Copy link
Contributor Author

prusnak commented Mar 16, 2017

Yes, it is present in #10009 - 3df45c6#diff-772f489c7d0a32de3badbfbcb5fd200dR83

Have not noticed the other PR before, sorry. But it makes lots of other (rather questionable) stuff, anyway.

@laanwj
Copy link
Member

laanwj commented Mar 16, 2017

@prusnak I agree, this one seems cleaner. Closing the other one.

@paveljanik
Copy link
Contributor

ACK 9350e13

@maflcko
Copy link
Member

maflcko commented Mar 16, 2017

utACK 9350e13

@laanwj laanwj merged commit 9350e13 into bitcoin:master Mar 17, 2017
laanwj added a commit that referenced this pull request Mar 17, 2017
9350e13 util: rename variable to avoid shadowing (Pavol Rusnak)

Tree-SHA512: 8abc09fdb134c913e823754f3f02a4d8ef120a73f252fbc1217dbd2bdd4ed4fffce92d823a66d1fe51607dc021065df8826f21274ef26e55d82575e96d07224f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 6, 2019
9350e13 util: rename variable to avoid shadowing (Pavol Rusnak)

Tree-SHA512: 8abc09fdb134c913e823754f3f02a4d8ef120a73f252fbc1217dbd2bdd4ed4fffce92d823a66d1fe51607dc021065df8826f21274ef26e55d82575e96d07224f
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 21, 2020
Summary:
b651270 util: Throw tinyformat::format_error on formatting error (Wladimir J. van der Laan)
3b092bd util: Properly handle errors during log message formatting (Wladimir J. van der Laan)

Tree-SHA512: 85e3b7afec2255fc88034187f1abd6060e9421de17ed4e3d918416f393429a99cc2c974b362099aaaff6970549df47664bea4c857c4e46acc0789663201dc541

Merge #10010: util: rename variable to avoid shadowing

9350e13 util: rename variable to avoid shadowing (Pavol Rusnak)

Tree-SHA512: 8abc09fdb134c913e823754f3f02a4d8ef120a73f252fbc1217dbd2bdd4ed4fffce92d823a66d1fe51607dc021065df8826f21274ef26e55d82575e96d07224f

Backport of Core PR9963 and PR10010
bitcoin/bitcoin#9963
bitcoin/bitcoin#10010

Also needed to pull a change from PR12954:
https://github.com/bitcoin/bitcoin/pull/12954/files#diff-772f489c7d0a32de3badbfbcb5fd200dR69

Test Plan:
Change line init.cpp line 1584 to `LogPrintf("Checkpoints will be verified.\n", fCheckpointsEnabled);`
  make check
  ./bitcoind
Verify the following log message appears at start up:
  2020-01-18T00:33:40Z Error "tinyformat: Not enough conversion specifiers in format string" while formatting log message: Checkpoints will be verified.
Undo change to init.cpp and repeat above verifying normal, pre-patch behavior

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D5010
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants