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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/* $NetBSD: msg_341.c,v 1.3 2023/03/28 14:44:35 rillig Exp $ */
# 3 "msg_341.c"
// Test for message: argument to '%s' must be 'unsigned char' or EOF, not '%s' [341]
/*
* Ensure that the functions from <ctype.h> are called with the correct
* argument.
*/
/* lint1-extra-flags: -X 351 */
/* NetBSD 9.99.81, <ctype.h> */
extern const unsigned short *_ctype_tab_;
extern const short *_tolower_tab_;
extern const short *_toupper_tab_;
int isspace(int);
void sink(int);
void
function_call_char(char c)
{
/* expect+1: warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] */
(isspace)(c);
/* This is the only allowed form. */
isspace((unsigned char)c);
/* The cast to 'int' is redundant, it doesn't hurt though. */
isspace((int)(unsigned char)c);
/* expect+1: warning: argument to 'isspace' must be cast to 'unsigned char', not to 'int' [342] */
isspace((int)c);
/* expect+1: warning: argument to 'isspace' must be cast to 'unsigned char', not to 'unsigned int' [342] */
isspace((unsigned int)c);
}
/*
* If the expression starts with type 'unsigned char', it can be cast to any
* other type. Chances are low enough that the cast is to 'char', which would
* be the only bad type.
*/
void
function_call_unsigned_char(unsigned char c)
{
(isspace)(c);
isspace((unsigned char)c);
isspace((int)c);
isspace((unsigned int)c);
}
/* When used in a loop of fgetc, the type is already 'int'. That's fine. */
void
function_call_int(int c)
{
isspace(c);
}
void
macro_invocation_NetBSD(char c)
{
/* expect+1: warning: argument to 'function from <ctype.h>' must be 'unsigned char' or EOF, not 'char' [341] */
sink(((int)((_ctype_tab_ + 1)[(c)] & 0x0040)));
/* This is the only allowed form. */
sink(((int)((_ctype_tab_ + 1)[((unsigned char)c)] & 0x0040)));
/* expect+1: warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'int' [342] */
sink(((int)((_ctype_tab_ + 1)[((int)c)] & 0x0040)));
/* expect+1: warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'unsigned int' [342] */
sink(((int)((_ctype_tab_ + 1)[((unsigned int)c)] & 0x0040)));
}
|