Changeset View
Changeset View
Standalone View
Standalone View
test/lint/lint-format-strings.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# | # | ||||
# Copyright (c) 2018 The Bitcoin Core developers | # Copyright (c) 2018 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# | # | ||||
# Lint format strings: This program checks that the number of arguments passed | # Lint format strings: This program checks that the number of arguments passed | ||||
# to a variadic format string function matches the number of format specifiers | # to a variadic format string function matches the number of format specifiers | ||||
# in the format string. | # in the format string. | ||||
import argparse | import argparse | ||||
import re | import re | ||||
import sys | import sys | ||||
FALSE_POSITIVES = [ | FALSE_POSITIVES = [ | ||||
("src/dbwrapper.cpp", "vsnprintf(p, limit - p, format, backup_ap)"), | ("src/dbwrapper.cpp", "vsnprintf(p, limit - p, format, backup_ap)"), | ||||
("src/index/base.cpp", "FatalError(const char* fmt, const Args&... args)"), | ("src/index/txindex.cpp", "FatalError(const char *fmt, const Args &... args)"), | ||||
("src/netbase.cpp", "LogConnectFailure(bool manual_connection, const char* fmt, const Args&... args)"), | ("src/netbase.cpp", "LogConnectFailure(bool manual_connection, const char* fmt, const Args&... args)"), | ||||
("src/util.cpp", "strprintf(_(COPYRIGHT_HOLDERS), _(COPYRIGHT_HOLDERS_SUBSTITUTION))"), | ("src/util.cpp", "strprintf(_(COPYRIGHT_HOLDERS), _(COPYRIGHT_HOLDERS_SUBSTITUTION))"), | ||||
("src/util.cpp", "strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION)"), | ("src/util.cpp", "strprintf(COPYRIGHT_HOLDERS, COPYRIGHT_HOLDERS_SUBSTITUTION)"), | ||||
("src/seeder/main.cpp", "fprintf(stderr, help, argv[0])"), | ("src/seeder/main.cpp", "fprintf(stderr, help, argv[0])"), | ||||
("src/tinyformat.h", "printf(const char *fmt, const Args &... args)"), | ("src/tinyformat.h", "printf(const char *fmt, const Args &... args)"), | ||||
("src/tinyformat.h", "printf(const char *fmt, TINYFORMAT_VARARGS(n))"), | ("src/tinyformat.h", "printf(const char *fmt, TINYFORMAT_VARARGS(n))"), | ||||
] | ] | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |