xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_077.c (revision 139c6401cd4c34a37cefc7f82c6f3fc0ff90ec8e)
1 /*	$NetBSD: msg_077.c,v 1.9 2024/02/03 20:10:10 rillig Exp $	*/
2 # 3 "msg_077.c"
3 
4 /* Test for message: bad octal digit '%c' [77] */
5 
6 /* lint1-flags: -tw -X 351 */
7 
8 /* expect+1: warning: bad octal digit '8' [77] */
9 char single_digit = '\8';
10 
11 /*
12  * Before lex.c 1.47 from 2021-06-29, lint intended to detect a "bad octal
13  * digit" following good octal digits, but the corresponding code had an
14  * unsatisfiable guard clause.
15  *
16  * The C Reference Manual 1978, 2.4.3 "Character constants" does not mention
17  * non-octal digits, therefore this code must have been due to a particular
18  * C compiler's interpretation.  It's even wrong according to the Reference
19  * Manual to interpret '\088' as anything else than a malformed character
20  * literal.
21  *
22  * That code has been removed since nobody runs lint in traditional C mode
23  * anyway.
24  * https://mail-index.netbsd.org/tech-toolchain/2021/03/16/msg003933.html
25  */
26 /* expect+2: warning: short octal escape '\0' followed by digit '8' [356] */
27 /* expect+1: warning: multi-character character constant [294] */
28 char several_digits = '\08';
29