Page MenuHomePhabricator

lint: support cross-platform macros in format specifiers
ClosedPublic

Authored by PiRK on Sep 22 2025, 13:22.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC3bf98f7f014f: lint: support cross-platform macros in format specifiers
Summary

I'm getting a linter error when touching src/seeder/main.cpp:

$ test/lint/lint-format-strings.py src/seeder/*cpp
src/seeder/main.cpp: Expected 10 argument(s) after format string but found 12 argument(s): tfm::format( d, "%-47s %4d %11" PRId64 " %6.2f%% %6.2f%% %6.2f%% %6.2f%% %6.2f%% %6i %08" PRIx64 " %5i \"%s\"\n", rep.ip.ToString(), rep.reliabilityStatus == ReliabilityStatus::OK ? 1 : 0, rep.lastSuccess, 100.0 * rep.uptime[0], 100.0 * rep.uptime[1], 100.0 * rep.uptime[2], 100.0 * rep.uptime[3], 100.0 * rep.uptime[4], rep.blocks, rep.services, rep.clientVersion, rep.clientSubVersion)

fix it by replacing the PRIx64 ...etc macros by something easier to parse by the existing linter.
Depends on D18660

Test Plan
test/lint/lint-format-strings.py src/seeder/*cpp

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Sep 22 2025, 22:59
Fabien added a subscriber: Fabien.
Fabien added inline comments.
test/lint/lint-format-strings.py
275–278 ↗(On Diff #55776)
This revision now requires changes to proceed.Sep 22 2025, 22:59
Fabien requested changes to this revision.Sep 23 2025, 08:20
Fabien added inline comments.
test/lint/lint-format-strings.py
277 ↗(On Diff #55794)

a double is 64 bits, no need for long long double

This revision now requires changes to proceed.Sep 23 2025, 08:20

PRId64 is 64 bits signed integer, not double...

This revision is now accepted and ready to land.Sep 23 2025, 08:22