blob: 7370f29fcdb9d4878a15efea26984f80c58d1633 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* $NetBSD: msg_271.c,v 1.4 2021/08/22 13:52:19 rillig Exp $ */
# 3 "msg_271.c"
/* Test for message: switch expression must be of type 'int' in traditional C [271] */
/* lint1-flags: -tw */
example(long_int, unsigned_int)
long long_int;
unsigned unsigned_int;
{
/* expect+1: warning: switch expression must be of type 'int' in traditional C [271] */
switch (long_int) {
case 3:
return 1;
}
/*
* XXX: K&R clearly says "the result must be 'int'", but lint also
* allows unsigned int.
*/
switch (unsigned_int) {
case 3:
return 1;
}
return 2;
}
|