Skip to content

Conversation

Empact
Copy link
Contributor

@Empact Empact commented Oct 10, 2022

The only current violations are a few uses of assert(!"descriptive string").

Seems the benefit of ensuring against a code fault outweighs the benefit of possible additional information in these cases.

-Wstring-concatenation
Diagnostic text:

warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma?

-Wstring-conversion
Diagnostic text:

warning: implicit conversion turns string literal into bool: A to B

https://clang.llvm.org/docs/DiagnosticsReference.html#wstring-concatenation

@Empact Empact changed the title Enable -Wstrinng-concatenation and -Wstring-conversion on clang builds Enable -Wstring-concatenation and -Wstring-conversion on clang builds Oct 10, 2022
@Empact Empact force-pushed the 2022-10-warn-string branch 2 times, most recently from 3a127d9 to 6709e7e Compare October 10, 2022 20:41
@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 10, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK theuni

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28191 (refactor: Remove unused MessageStartChars parameters from BlockManager methods by MarcoFalke)
  • #26326 (net: don't lock cs_main while reading blocks in net processing by andrewtoth)
  • #25972 (build: no-longer disable WARN_CXXFLAGS when CXXFLAGS is set by fanquake)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. This has been open for a while, I'm curious to know if any new violations have snuck in since?

@hebasto
Copy link
Member

hebasto commented May 4, 2023

Concept ACK. This has been open for a while, I'm curious to know if any new violations have snuck in since?

Maybe rebase it?

@Empact
Copy link
Contributor Author

Empact commented Jun 29, 2023

Rebased. 👍

@theuni
Copy link
Member

theuni commented Jun 29, 2023

Thanks! Now mind updating to use Assert()? :)

@Empact Empact force-pushed the 2022-10-warn-string branch from f26f19f to 2c0e21c Compare July 17, 2023 20:19
The only current violations are a few uses of assert(!"descriptive string").

Seems the benefit of ensuring against a code fault outweighs the benefit of
possible additional information in these cases.
@Empact Empact force-pushed the 2022-10-warn-string branch from 2c0e21c to d928fb5 Compare July 17, 2023 20:22
@Empact Empact force-pushed the 2022-10-warn-string branch from d928fb5 to 06f5558 Compare July 17, 2023 20:32
@Empact Empact force-pushed the 2022-10-warn-string branch from 06f5558 to 50e7f52 Compare July 17, 2023 20:39
@Empact
Copy link
Contributor Author

Empact commented Jul 17, 2023

Rebased, converted assignments to initialization, and moved to Assert where possible. I could not apply Assert(false) in interpreter.cpp due to errors, but #26504 could be applied here once merged.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 7, 2023

🐙 This pull request conflicts with the target branch and needs rebase.

@@ -934,7 +934,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
case OP_ABS: if (bn < bnZero) bn = -bn; break;
case OP_NOT: bn = (bn == bnZero); break;
case OP_0NOTEQUAL: bn = (bn != bnZero); break;
default: assert(!"invalid opcode"); break;
default: assert(false); break; // invalid opcode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the goal here is? This will print something else on stderr when the assert is hit.

Pretty sure the previous code is commonly used and understood?

@maflcko
Copy link
Member

maflcko commented Sep 20, 2023

Closing for now due to lack of progress. Let us know if this should be reopened.

@maflcko maflcko closed this Sep 20, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Sep 19, 2024
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.

5 participants