mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
test: Add strerror
to locale-dependence linter
Add `strerror` to the locale-dependence linter to catch its use. Add exemptions for bdb interface code (false positive) and strerror.cpp (the only allowed use). Also fix a bug in the regexp so that `_r` and `_s` variants are detected again.
This commit is contained in:
parent
f00fb1265a
commit
e3a06a3c6c
@ -49,7 +49,9 @@ KNOWN_VIOLATIONS = [
|
||||
"src/test/fuzz/locale.cpp:.*setlocale",
|
||||
"src/test/fuzz/string.cpp:.*strtol",
|
||||
"src/test/fuzz/string.cpp:.*strtoul",
|
||||
"src/test/util_tests.cpp:.*strtoll"
|
||||
"src/test/util_tests.cpp:.*strtoll",
|
||||
"src/wallet/bdb.cpp:.*DbEnv::strerror", # False positive
|
||||
"src/util/syserror.cpp:.*strerror", # Outside this function use `SysErrorString`
|
||||
]
|
||||
|
||||
REGEXP_EXTERNAL_DEPENDENCIES_EXCLUSIONS = [
|
||||
@ -144,7 +146,7 @@ LOCALE_DEPENDENT_FUNCTIONS = [
|
||||
"strcasecmp",
|
||||
"strcasestr",
|
||||
"strcoll", # LC_COLLATE
|
||||
#"strerror",
|
||||
"strerror",
|
||||
"strfmon",
|
||||
"strftime", # LC_TIME
|
||||
"strncasecmp",
|
||||
@ -218,7 +220,7 @@ LOCALE_DEPENDENT_FUNCTIONS = [
|
||||
def find_locale_dependent_function_uses():
|
||||
regexp_locale_dependent_functions = "|".join(LOCALE_DEPENDENT_FUNCTIONS)
|
||||
exclude_args = [":(exclude)" + excl for excl in REGEXP_EXTERNAL_DEPENDENCIES_EXCLUSIONS]
|
||||
git_grep_command = ["git", "grep", "-E", "[^a-zA-Z0-9_\\`'\"<>](" + regexp_locale_dependent_functions + "(_r|_s)?)[^a-zA-Z0-9_\\`'\"<>]", "--", "*.cpp", "*.h"] + exclude_args
|
||||
git_grep_command = ["git", "grep", "-E", "[^a-zA-Z0-9_\\`'\"<>](" + regexp_locale_dependent_functions + ")(_r|_s)?[^a-zA-Z0-9_\\`'\"<>]", "--", "*.cpp", "*.h"] + exclude_args
|
||||
git_grep_output = list()
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user