diff options
| author | Enji Cooper <ngie@FreeBSD.org> | 2026-02-15 01:57:42 +0000 |
|---|---|---|
| committer | Enji Cooper <ngie@FreeBSD.org> | 2026-02-15 02:12:44 +0000 |
| commit | e8dbf2b6df199526a660f81de07d17925cfd8518 (patch) | |
| tree | cd0c09449bea5df56ef67059e797737d70587070 /usr.bin/xlint/lint1/msg_374.c | |
| parent | 56a7ce8416d181a2060d7a428aed9c3c6a431e6d (diff) | |
Add files missed in 56a7ce8416d181a2060d7a42vendor/NetBSD/tests/2026.02.14_2vendor/NetBSD/tests
Skip usr.bin/diff3 tests as these contain text that gets misinterpreted
as merge conflict markers and blocks push with the relevant pre-receive
hook.
PR: 293186
Diffstat (limited to 'usr.bin/xlint/lint1/msg_374.c')
| -rw-r--r-- | usr.bin/xlint/lint1/msg_374.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/usr.bin/xlint/lint1/msg_374.c b/usr.bin/xlint/lint1/msg_374.c new file mode 100644 index 000000000000..1d4312623e58 --- /dev/null +++ b/usr.bin/xlint/lint1/msg_374.c @@ -0,0 +1,49 @@ +/* $NetBSD: msg_374.c,v 1.6 2024/08/31 06:57:31 rillig Exp $ */ +# 3 "msg_374.c" + +// Test for message: unknown conversion '%.*s', must be one of 'bfF=:*' [374] + +/* + * In the new-style format, an unknown conversion is assumed to have a single + * argument, followed by a null-terminated description. + */ + +/* lint1-extra-flags: -X 351 */ + +typedef typeof(sizeof(0)) size_t; +typedef unsigned long long uint64_t; + +int snprintb(char *, size_t, const char *, uint64_t); + +void +example(uint64_t u64) +{ + char buf[64]; + + /* expect+4: warning: unknown conversion 'x', must be one of 'bfF=:*' [374] */ + snprintb(buf, sizeof(buf), + "\177\020" + "x12345\0", + u64); + + /* expect+4: warning: unknown conversion '\000', must be one of 'bfF=:*' [374] */ + snprintb(buf, sizeof(buf), + "\177\020" + "\00012345\0", + u64); + + /* expect+5: warning: redundant '\0' at the end of the format [377] */ + snprintb(buf, sizeof(buf), + "\177\020" + "b\00012345\0" + "\0", + u64); + + // Real-life example: the '\b' is a typo. + // + /* expect+4: warning: unknown conversion '\b', must be one of 'bfF=:*' [374] */ + snprintb(buf, sizeof(buf), + "\177\020" + "b\15ENCNT\0b\16" "TC\0\b\20DSBL_CSR_DRN\0", + u64); +} |
