Skip to content

Conversation

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Mar 26, 2018

Adjust ifdef to avoid unreachable code.

Introduced in 1e79c05.

@maflcko
Copy link
Member

maflcko commented Mar 26, 2018

You could avoid the "guards cross scopes" by moving everything into the else-scope:

}else{
    // ...
    #ifdef ...
    return ...wallet
    #endif
    throw
}

Also, would be nice if you added a test for the failure case to wallet_disable.py

@maflcko
Copy link
Member

maflcko commented Mar 26, 2018

Assigning "refactoring", since it shouldn't change behavior.

@practicalswift practicalswift force-pushed the unreachable-code-ifdef-ENABLE_WALLET branch from c6ced0a to 61f8298 Compare March 26, 2018 13:19
@achow101
Copy link
Member

utACK 61f8298

Travis seems to have timed out so I restarted it.

@maflcko
Copy link
Member

maflcko commented Mar 26, 2018

utACK 61f8298

1 similar comment
@sipa
Copy link
Member

sipa commented Mar 26, 2018

utACK 61f8298

@promag
Copy link
Contributor

promag commented Mar 26, 2018

avoid unreachable code

What unreachable code?

@maflcko
Copy link
Member

maflcko commented Mar 26, 2018

I'd assume it is a static analyser warning that in return; throw; the throw is unreachable.

@promag
Copy link
Contributor

promag commented Mar 26, 2018

utACK 61f8298.

@jnewbery
Copy link
Contributor

This code is all disappearing after V0.17 is branched, but fine, utACK 61f8298

@laanwj laanwj merged commit 61f8298 into bitcoin:master Mar 29, 2018
laanwj added a commit that referenced this pull request Mar 29, 2018
61f8298 rpc: Adjust ifdef to avoid unreachable code (practicalswift)

Pull request description:

  Adjust `ifdef` to avoid unreachable code.

  Introduced in 1e79c05.

Tree-SHA512: c775cc9181e4034f26c5b219974e06886435275933249b169d2bc8bc98f639c4027e1e7d991f43bded62146a141acee6d3be1f2b313042d9bbc0a5d2e71d6c7c
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 30, 2019
Summary:
61f8298 rpc: Adjust ifdef to avoid unreachable code (practicalswift)

Pull request description:

  Adjust `ifdef` to avoid unreachable code.

  Introduced in 1e79c05.

Tree-SHA512: c775cc9181e4034f26c5b219974e06886435275933249b169d2bc8bc98f639c4027e1e7d991f43bded62146a141acee6d3be1f2b313042d9bbc0a5d2e71d6c7c

Backport of Core PR12787
bitcoin/bitcoin#12787

Test Plan:
  make check

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

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3902
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 16, 2020
61f8298 rpc: Adjust ifdef to avoid unreachable code (practicalswift)

Pull request description:

  Adjust `ifdef` to avoid unreachable code.

  Introduced in 1e79c05.

Tree-SHA512: c775cc9181e4034f26c5b219974e06886435275933249b169d2bc8bc98f639c4027e1e7d991f43bded62146a141acee6d3be1f2b313042d9bbc0a5d2e71d6c7c
@practicalswift practicalswift deleted the unreachable-code-ifdef-ENABLE_WALLET branch April 10, 2021 19:34
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 22, 2022
61f8298 rpc: Adjust ifdef to avoid unreachable code (practicalswift)

Pull request description:

  Adjust `ifdef` to avoid unreachable code.

  Introduced in 1e79c05.

Tree-SHA512: c775cc9181e4034f26c5b219974e06886435275933249b169d2bc8bc98f639c4027e1e7d991f43bded62146a141acee6d3be1f2b313042d9bbc0a5d2e71d6c7c
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
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.

8 participants