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_361.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_361.c')
| -rw-r--r-- | usr.bin/xlint/lint1/msg_361.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/usr.bin/xlint/lint1/msg_361.c b/usr.bin/xlint/lint1/msg_361.c new file mode 100644 index 000000000000..08b3c733ccb2 --- /dev/null +++ b/usr.bin/xlint/lint1/msg_361.c @@ -0,0 +1,52 @@ +/* $NetBSD: msg_361.c,v 1.4 2024/11/05 06:23:04 rillig Exp $ */ +# 3 "msg_361.c" + +// Test for message: number base '%.*s' is %ju, must be 8, 10 or 16 [361] + +/* + * The first or second character of the snprintb format specifies the number + * base. It must be given as an octal or hexadecimal escape sequence. + */ + +/* 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 +old_style_number_base(void) +{ + char buf[64]; + + /* expect+1: warning: missing new-style '\177' or old-style number base [359] */ + snprintb(buf, sizeof(buf), "", 0); + /* expect+1: warning: number base '\002' is 2, must be 8, 10 or 16 [361] */ + snprintb(buf, sizeof(buf), "\002", 0); + snprintb(buf, sizeof(buf), "\010", 0); + snprintb(buf, sizeof(buf), "\n", 0); + snprintb(buf, sizeof(buf), "\020", 0); + /* expect+1: warning: number base '\014' is 12, must be 8, 10 or 16 [361] */ + snprintb(buf, sizeof(buf), "" "\014" "", 0); + snprintb(buf, sizeof(buf), "" "\020" "", 0); +} + +void +new_style_number_base(void) +{ + char buf[64]; + + /* expect+1: warning: missing new-style number base after '\177' [360] */ + snprintb(buf, sizeof(buf), "\177", 0); + /* expect+1: warning: number base '\0' is 0, must be 8, 10 or 16 [361] */ + snprintb(buf, sizeof(buf), "\177\0", 0); + /* expect+1: warning: number base '\002' is 2, must be 8, 10 or 16 [361] */ + snprintb(buf, sizeof(buf), "\177\002", 0); + snprintb(buf, sizeof(buf), "\177\010", 0); + snprintb(buf, sizeof(buf), "\177\n", 0); + snprintb(buf, sizeof(buf), "\177\020", 0); + /* expect+1: warning: number base '\014' is 12, must be 8, 10 or 16 [361] */ + snprintb(buf, sizeof(buf), "" "\177\014" "", 0); + snprintb(buf, sizeof(buf), "" "\177\020" "", 0); +} |
