Skip to content

Commit

Permalink
chore: exclude underscore placeholder from shadowing linter warnings
Browse files Browse the repository at this point in the history
Bitcoin uses underscore in util/translation.h for translatable strings
but underscores are also a placeholder used in multiple languages, incl.
C++. The next commit will be introducing backports, one of them will be
placing util/translation.h into validation.h, which is a header used by
Dash-specific code.

This causes a conflict between the normal usage of underscore as a
placeholder and Bitcoin's usage of it as a function name, which is
reported by the Dash-specific linter. We need to exclude shadowing
warnings from the linter to account for this.
  • Loading branch information
kwvg committed Jul 19, 2024
1 parent 5f9f05e commit 6df927f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/lint/lint-cppcheck-dash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ENABLED_CHECKS=(
"Variable '.*' is assigned a value that is never used."
"Unused variable"
"The function '.*' overrides a function in a base class but is not marked with a 'override' specifier."
# Enabale to catch all warnings
# Enable to catch all warnings
".*"
)

Expand All @@ -34,13 +34,14 @@ IGNORED_WARNINGS=(
"src/rpc/.*cpp:.*: note: Function pointer used here."
"src/masternode/sync.cpp:.*: warning: Variable 'pnode' can be declared as pointer to const \[constVariableReference\]"
"src/wallet/bip39.cpp.*: warning: The scope of the variable 'ssCurrentWord' can be reduced. \[variableScope\]"

"src/.*:.*: warning: Local variable '_' shadows outer function \[shadowFunction\]"

"src/stacktraces.cpp:.*: .*: Parameter 'info' can be declared as pointer to const"
"src/stacktraces.cpp:.*: note: You might need to cast the function pointer here"

"[note|warning]: Return value 'state.Invalid(.*)' is always false"
"note: Calling function 'Invalid' returns 0"
"note: Shadow variable"

# General catchall, for some reason any value named 'hash' is viewed as never used.
"Variable 'hash' is assigned a value that is never used."
Expand Down

0 comments on commit 6df927f

Please sign in to comment.