Lines Matching full:scanf
12 int scanf(const char * restrict, ...) ;
21 scanf(s, i); // expected-warning{{ormat string is not a string literal}}
22 scanf("%0d", i); // expected-warning{{zero field width in scanf format string is unused}}
23 scanf("%00d", i); // expected-warning{{zero field width in scanf format string is unused}}
24 scanf("%d%[asdfasdfd", i, s); // expected-warning{{no closing ']' for '%[' in scanf format string}}
27 scanf ("%" "hu" "\n", &s_x); // no-warning
28 scanf("%y", i); // expected-warning{{invalid conversion specifier 'y'}}
29 scanf("%%"); // no-warning
30 scanf("%%%1$d", i); // no-warning
31 scanf("%1$d%%", i); // no-warning
32 scanf("%d", i, i); // expected-warning{{data argument not used by format string}}
33 scanf("%*d", i); // // expected-warning{{data argument not used by format string}}
34 scanf("%*d", i); // // expected-warning{{data argument not used by format string}}
35 scanf("%*d%1$d", i); // no-warning
37 scanf("%s", (char*)0); // no-warning
38 scanf("%s", (volatile char*)0); // no-warning
39 scanf("%s", (signed char*)0); // no-warning
40 scanf("%s", (unsigned char*)0); // no-warning
41 scanf("%hhu", (signed char*)0); // no-warning
45 scanf("%hhs", "foo"); // expected-warning{{length modifier 'hh' results in undefined behavior or no effect with 's' conversion specifier}}
46 scanf("%1$zp", &p); // expected-warning{{length modifier 'z' results in undefined behavior or no effect with 'p' conversion specifier}}
47 scanf("%ls", ws); // no-warning
48 scanf("%#.2Lf", ld); // expected-warning{{invalid conversion specifier '#'}}
51 // Test that the scanf call site is where the warning is attached. If the
57 scanf(kFormat1, i); // expected-warning{{zero field width in scanf format string is unused}}
58 scanf("%00d", i); // expected-warning{{zero field width in scanf format string is unused}}
60 scanf(kFormat2, str); // expected-warning{{no closing ']' for '%[' in scanf format string}}
61 scanf("%[", str); // expected-warning{{no closing ']' for '%[' in scanf format string}}
63 scanf(kFormat3, &i); // expected-warning {{format specifies type 'unsigned short *' but the argument}}
65 scanf(kFormat4, &i); // expected-warning {{length modifier 'l' results in undefined behavior or no effect with 'p' conversion specifier}}
79 vscanf("%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
80 vfscanf(f, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
81 vsscanf(buf, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
85 scanf("%[abc]", ip); // expected-warning{{format specifies type 'char *' but the argument has type 'int *'}}
86 scanf("%h[abc]", sp); // expected-warning{{length modifier 'h' results in undefined behavior or no effect with '[' conversion specifier}}
87 scanf("%l[xyx]", ls); // no-warning
88 scanf("%ll[xyx]", ls); // expected-warning {{length modifier 'll' results in undefined behavior or no effect with '[' conversion specifier}}
95 scanf("%as", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}}
96 scanf("%aS", lsp); // expected-warning{{format specifies type 'float *' but the argument has type 'wchar_t **'}}
97 scanf("%a[bcd]", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}}
101 scanf("%ms", sp); // No warning.
102 scanf("%mS", lsp); // No warning.
103 scanf("%mc", sp); // No warning.
104 scanf("%mC", lsp); // No warning.
105 scanf("%m[abc]", sp); // No warning.
106 scanf("%md", sp); // expected-warning{{length modifier 'm' results in undefined behavior or no effect with 'd' conversion specifier}}
109 scanf("%ms", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
110 scanf("%mS", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
111 scanf("%mc", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
112 scanf("%mC", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
113 scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
117 scanf("%qd", x); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
118 scanf("%qd", llx); // no-warning
122 scanf("%n", (void*)0); // expected-warning{{format specifies type 'int *' but the argument has type 'void *'}}
123 scanf("%n %c", x, x); // expected-warning{{format specifies type 'char *' but the argument has type 'int *'}}
125 scanf("%hhn", (signed char*)0); // no-warning
126 scanf("%hhn", (char*)0); // no-warning
127 scanf("%hhn", (unsigned char*)0); // no-warning
128 scanf("%hhn", (int*)0); // expected-warning{{format specifies type 'signed char *' but the argument has type 'int *'}}
130 scanf("%hn", (short*)0); // no-warning
131 scanf("%hn", (unsigned short*)0); // no-warning
132 scanf("%hn", (int*)0); // expected-warning{{format specifies type 'short *' but the argument has type 'int *'}}
134 scanf("%n", (int*)0); // no-warning
135 scanf("%n", (unsigned int*)0); // no-warning
136 scanf("%n", (char*)0); // expected-warning{{format specifies type 'int *' but the argument has type 'char *'}}
138 scanf("%ln", (long*)0); // no-warning
139 scanf("%ln", (unsigned long*)0); // no-warning
140 scanf("%ln", (int*)0); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
142 scanf("%lln", (long long*)0); // no-warning
143 scanf("%lln", (unsigned long long*)0); // no-warning
144 scanf("%lln", (int*)0); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
146 scanf("%qn", (long long*)0); // no-warning
147 scanf("%qn", (unsigned long long*)0); // no-warning
148 scanf("%qn", (int*)0); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
155 scanf("%d", cip); // expected-warning{{format specifies type 'int *' but the argument has type 'const int *'}}
156 scanf("%n", cip); // expected-warning{{format specifies type 'int *' but the argument has type 'const int *'}}
157 scanf("%s", ccp); // expected-warning{{format specifies type 'char *' but the argument has type 'const char *'}}
158 scanf("%d", cvip); // expected-warning{{format specifies type 'int *' but the argument has type 'const volatile int *'}}
160 scanf("%d", vip); // No warning.
161 scanf("%n", vip); // No warning.
162 scanf("%c", vcp); // No warning.
166 scanf("%d", (ip_t)0); // No warning.
167 scanf("%d", (cip_t)0); // expected-warning{{format specifies type 'int *' but the argument has type 'cip_t' (aka 'const int *')}}