Commit graph

14 commits

Author SHA1 Message Date
Hodlinator
76cca4aa6f
test: Document non-parity between tinyformat and ConstevalFormatstring
- For "%n", which is supposed to write to the argument for printf.
- For string/integer mismatches of width/precision specifiers.

Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
2024-12-06 21:56:16 +01:00
MarcoFalke
faff8403f0
refactor: Pick translated string after format
This passes the return value of _() directly to strprintf so the format
string can be checked at compile time in a future commit.
2024-11-15 17:16:03 +01:00
MarcoFalke
facbcd4cef
log: Use ConstevalFormatString
This changes all logging (including the wallet logging) to produce a
ConstevalFormatString at compile time, so that the format string can be
validated at compile-time.

Also, while touching the wallet logging, avoid a copy of the template
Params by using const Params&.
2024-09-17 18:21:23 +02:00
MarcoFalke
fa5bc450d5
util: Use compile-time check for LogConnectFailure 2024-09-12 15:01:35 +02:00
MarcoFalke
fa7087b896
util: Use compile-time check for FatalErrorf 2024-09-12 15:01:20 +02:00
MarcoFalke
fae7b83eb5
lint: Remove forbidden functions from lint-format-strings.py
Given that all of them are forbidden by the
test/lint/lint-locale-dependence.py check, they can be removed.
2024-09-11 16:52:57 +02:00
MarcoFalke
3333415890
scripted-diff: LogPrint -> LogDebug
-BEGIN VERIFY SCRIPT-
 sed -i 's/\<LogPrint\>/LogDebug/g' $( git grep -l '\<LogPrint\>'  -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' )
-END VERIFY SCRIPT-
2024-08-29 13:49:57 +02:00
MarcoFalke
fa6dc57760
refactor: Enforce C-str fmt strings in WalletLogPrintf() 2023-08-08 10:55:11 +02:00
TheCharlatan
6eb33bd0c2
kernel: Add fatalError method to notifications
FatalError replaces what previously was the AbortNode function in
shutdown.cpp.

This commit is part of the libbitcoinkernel project and further removes
the shutdown's and, more generally, the kernel library's dependency on
interface_ui with a kernel notification method. By removing interface_ui
from the kernel library, its dependency on boost is reduced to just
boost::multi_index. At the same time it also takes a step towards
de-globalising the interrupt infrastructure.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
2023-06-28 09:52:33 +02:00
TheCharlatan
3fa9094b92
scripted-diff: Rename FatalError to FatalErrorf
This is done in preparation for the next commit where a new FatalError
function is introduced. FatalErrorf follows common convention to append
'f' for functions accepting format arguments.

-BEGIN VERIFY SCRIPT-
sed -i 's/FatalError/FatalErrorf/g' $( git grep -l 'FatalError')
-END VERIFY SCRIPT-
2023-06-28 09:52:30 +02:00
Ryan Ofsky
398c3719b0 lint: Fix lint-format-strings false positives when format specifiers have argument positions
Do not error on valid format specifications like strprintf("arg2=%2$s arg1=%1$s arg2=%2$s", arg1, arg2);

Needed to avoid lint error in upcoming commit: https://cirrus-ci.com/task/4755032734695424?logs=lint#L221

Additionally tested with python -m doctest test/lint/run-lint-format-strings.py
2023-04-21 06:53:23 -04:00
Ryan Ofsky
3db2874bd7 Extend bilingual_str support for tinyformat
Previous bilingual_str tinyformat::format accepted bilingual format strings,
but not bilingual arguments. Extend it to accept both. This is useful when
embedding one translated string inside another translated string, for example:
`strprintf(_("Error: %s"), message)` which would fail previously if `message`
was a bilingual_str.
2023-02-28 12:04:47 -05:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
MarcoFalke
fa82e890e7
Move lint script and data file to avoid lint- prefix
This is needed for the next commit
2022-04-04 16:58:07 +02:00
Renamed from test/lint/lint-format-strings.py (Browse further)