Home | History | Annotate | Download | only in Sema

Lines Matching refs:format

20 int vscanf(const char *restrict format, va_list arg);
30 printf(s); // expected-warning {{format string is not a string literal}}
31 vprintf(s,ap); // expected-warning {{format string is not a string literal}}
32 fprintf(fp,s); // expected-warning {{format string is not a string literal}}
33 vfprintf(fp,s,ap); // expected-warning {{format string is not a string literal}}
34 asprintf(&b,s); // expected-warning {{format string is not a string lit}}
35 vasprintf(&b,s,ap); // expected-warning {{format string is not a string literal}}
36 sprintf(buf,s); // expected-warning {{format string is not a string literal}}
37 snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
38 __builtin___sprintf_chk(buf,0,-1,s); // expected-warning {{format string is not a string literal}}
39 __builtin___snprintf_chk(buf,2,0,-1,s); // expected-warning {{format string is not a string lit}}
40 vsprintf(buf,s,ap); // expected-warning {{format string is not a string lit}}
41 vsnprintf(buf,2,s,ap); // expected-warning {{format string is not a string lit}}
42 vsnprintf(buf,2,global_fmt,ap); // expected-warning {{format string is not a string literal}}
43 __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // expected-warning {{format string is not a string lit}}
44 __builtin___vsnprintf_chk(buf,2,0,-1,global_fmt,ap); // expected-warning {{format string is not a string literal}}
46 vscanf(s, ap); // expected-warning {{format string is not a string literal}}
61 // When calling a non-variadic format function (vprintf, vscanf, NSLogv, ...),
62 // warn only if the format string argument is a parameter that is not itself
63 // declared as a format string with compatible format.
70 printf(s); // expected-warning {{format string is not a string literal}}
72 fprintf(fp,s); // expected-warning {{format string is not a string literal}}
74 asprintf(&b,s); // expected-warning {{format string is not a string lit}}
76 sprintf(buf,s); // expected-warning {{format string is not a string literal}}
77 snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
80 vscanf(s, ap); // expected-warning {{format string is not a string literal}}
86 printf(i == 0 ? (i == 1 ? s : "no") : "dont know"); // expected-warning{{format string is not a string literal}}
87 printf("yes" ?: "no %d", 1); // expected-warning{{data argument not used by format string}}
94 printf("%n", b); // expected-warning{{format specifies type 'int *' but the argument has type 'char *'}}
100 printf("%hhn", (int*)0); // expected-warning{{format specifies type 'signed char *' but the argument has type 'int *'}}
104 printf("%hn", (int*)0); // expected-warning{{format specifies type 'short *' but the argument has type 'int *'}}
108 printf("%n", (char*)0); // expected-warning{{format specifies type 'int *' but the argument has type 'char *'}}
112 printf("%ln", (int*)0); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
116 printf("%lln", (int*)0); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
120 printf("%qn", (int*)0); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
129 fprintf(fp,"%%%l"); // expected-warning {{incomplete format specifier}}
130 sprintf(buf,"%%%%%ld%d%d", 1, 2, 3); // expected-warning{{format specifies type 'long' but the argument has type 'int'}}
131 snprintf(buf, 2, "%%%%%ld%;%d", 1, 2, 3); // expected-warning{{format specifies type 'long' but the argument has type 'int'}} expected-warning {{invalid conversion specifier ';'}}
145 vprintf("",ap); // expected-warning {{format string is empty}}
146 sprintf(buf, "", 1); // expected-warning {{format string is empty}}
148 // Don't warn about empty format strings when there are no data arguments.
149 // This can arise from macro expansions and non-standard format string
171 void __attribute__((format(printf,1,3))) myprintf(const char*, int blah, ...);
198 printf(P); // expected-warning {{format string is not a string literal (potentially insecure)}}
210 printf("\0"); // expected-warning{{format string contains '\0' within the string body}}
211 printf("xs\0"); // expected-warning{{format string contains '\0' within the string body}}
218 printf("%d\n", x, x); // expected-warning{{data argument not used by format string}}
220 printf("%"); // expected-warning{{incomplete format specifier}}
222 printf("%.", x); // expected-warning{{incomplete format specifier}}
223 printf("%f", 4); // expected-warning{{format specifies type 'double' but the argument has type 'int'}}
225 printf("%qd", x); // expected-warning{{format specifies type 'long long' but the argument has type 'int'}}
231 printf("%d", (long long) 10); // expected-warning{{format specifies type 'int' but the argument has type 'long long'}}
233 printf("%f\n", (long double) 1.0); // expected-warning{{format specifies type 'double' but the argument has type 'long double'}}
236 printf("%c\n", "x"); // expected-warning{{format specifies type 'int' but the argument has type 'char *'}}
237 printf("%c\n", 1.23); // expected-warning{{format specifies type 'int' but the argument has type 'double'}}
238 printf("Format %d, is %! %f", 1, 2, 4.4); // expected-warning{{invalid conversion specifier '!'}}
244 printf("%hhu", (short) 10); // expected-warning{{format specifies type 'unsigned char' but the argument has type 'short'}}
245 printf("%hu\n", (unsigned char) 1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'unsigned char'}}
246 printf("%hu\n", (uint8_t)1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'uint8_t'}}
251 printf("%p", 123); // expected-warning{{format specifies type 'void *' but the argument has type 'int'}}
265 printf ("%.4s\n", &buf); // expected-warning{{format specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
268 asprintf(&b, "%d", "asprintf"); // expected-warning{{format specifies type 'int' but the argument has type 'char *'}}
274 printf("x: '0%hhd'\n", x); // expected-warning {{format specifies type 'char' but the argument has type 'short'}}
279 int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __attribute__((__format__ (__printf__, 4, 5)));
295 printf("%s", s); // expected-warning{{format specifies type 'char *' but the argument has type 'wchar_t *'}}
304 // Mac OS X supports positional arguments in format strings.
308 printf("%0$", (int)2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
309 printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
311 printf("%1$d", (int) 2, 2); // expected-warning{{data argument not used by format string}}
312 printf("%1$d%1$f", (int) 2); // expected-warning{{format specifies type 'double' but the argument has type 'int'}}
320 // PR 6697 - Handle format strings where the data argument is not adjacent to the format string
321 void myprintf_PR_6697(const char *format, int x, ...) __attribute__((__format__(printf,1, 3)));
324 myprintf_PR_6697("%s\n", 1, (int)0); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
330 myprintf_PR_6697("%1$s\n", 1, (int) 0); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
334 fprintf(fp, "\%"); // expected-warning{{incomplete format specifier}}
386 // Handle functions with multiple format attributes.
392 rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}}
417 printf("%s", 1); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
430 printf("%s", 2); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
456 // format string is somewhere else, point to it in a note.
458 const char kFormat1[] = "%d %d \n"; // expected-note{{format string is defined here}}}
462 const char kFormat2[] = "%18$s\n"; // expected-note{{format string is defined here}}
466 const char kFormat4[] = "%y"; // expected-note{{format string is defined here}}
470 const char kFormat5[] = "%."; // expected-note{{format string is defined here}}
471 printf(kFormat5, 5); // expected-warning{{incomplete format specifier}}
472 printf("%.", 5); // expected-warning{{incomplete format specifier}}
474 const char kFormat6[] = "%s"; // expected-note{{format string is defined here}}
475 printf(kFormat6, 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
476 printf("%s", 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
478 const char kFormat7[] = "%0$"; // expected-note{{format string is defined here}}
479 printf(kFormat7, 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
480 printf("%0$", 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
482 const char kFormat8[] = "%1$d %d"; // expected-note{{format string is defined here}}
483 printf(kFormat8, 4, 4); // expected-warning{{cannot mix positional and non-positional arguments in format string}}
484 printf("%1$d %d", 4, 4); // expected-warning{{cannot mix positional and non-positional arguments in format string}}
486 const char kFormat9[] = ""; // expected-note{{format string is defined here}}
487 printf(kFormat9, 4, 4); // expected-warning{{format string is empty}}
488 printf("", 4, 4); // expected-warning{{format string is empty}}
490 const char kFormat10[] = "\0%d"; // expected-note{{format string is defined here}}
491 printf(kFormat10, 4); // expected-warning{{format string contains '\0' within the string body}}
492 printf("\0%d", 4); // expected-warning{{format string contains '\0' within the string body}}
494 const char kFormat11[] = "%*d"; // expected-note{{format string is defined here}}
498 const char kFormat12[] = "%*d"; // expected-note{{format string is defined here}}
502 const char kFormat13[] = "%.3p"; // expected-note{{format string is defined here}}
507 const char kFormat14[] = "%0s"; // expected-note{{format string is defined here}}
511 const char kFormat15[] = "%hhs"; // expected-note{{format string is defined here}}
515 const char kFormat16[] = "%-0d"; // expected-note{{format string is defined here}}
519 // Make sure that the "format string is defined here" note is not emitted
523 const char kFormat17[] = "%hu"; // expected-note{{format string is defined here}}}
524 printf(kFormat17, (int[]){0}); // expected-warning{{format specifies type 'unsigned short' but the argument}}
526 printf("%a", (long double)0); // expected-warning{{format specifies type 'double' but the argument has type 'long double'}}
529 const char kFormat18[] = { "%lld" }; // expected-note{{format string is defined here}}
530 printf(kFormat18, 0); // expected-warning{{format specifies type}}
532 // Make sure we point at the offending argument rather than the format string.
533 const char kFormat19[] = "%d"; // expected-note{{format string is defined here}}
535 0.0); // expected-warning{{format specifies}}
538 void __attribute__((format(strfmon,1,2))) monformat(const char *fmt, ...);
539 void __attribute__((format(strftime,1,0))) dateformat(const char *fmt);
544 monformat("", 1); // expected-warning{{format string is empty}}
545 monformat(str); // expected-warning{{format string is not a string literal (potentially insecure)}}
546 dateformat(""); // expected-warning{{format string is empty}}
552 #include <format-unused-system-args.h>
563 // Test that we correctly merge the format in both orders.
575 test14_foo("%", "%d", p); // expected-warning{{incomplete format specifier}}
576 test14_bar("%", "%d", p); // expected-warning{{incomplete format specifier}}
581 printf("%n", cip); // expected-warning{{format specifies type 'int *' but the argument has type 'const int *'}}
582 printf("%n", cvip); // expected-warning{{format specifies type 'int *' but the argument has type 'const volatile int *'}}
592 printf("%n", (cip_t)0); // expected-warning{{format specifies type 'int *' but the argument has type 'cip_t' (aka 'const int *')}}