You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// FIXME: This is probably not portable everywhere.
392
392
voidtest_positional_arguments(void) {
393
-
printf("%0$", (int)2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
394
-
printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
393
+
printf("%0$", (int)2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} expected-warning{{data argument not used by format string}}
394
+
printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} expected-warning{{data argument not used by format string}}
395
395
printf("%1$d", (int) 2); // no-warning
396
396
printf("%1$d", (int) 2, 2); // expected-warning{{data argument not used by format string}}
397
397
printf("%1$d%1$f", (int) 2); // expected-warning{{format specifies type 'double' but the argument has type 'int'}}
constcharkFormat5[] ="%."; // expected-note{{format string is defined here}}
598
-
printf(kFormat5, 5); // expected-warning{{incomplete format specifier}}
599
-
printf("%.", 5); // expected-warning{{incomplete format specifier}}
598
+
printf(kFormat5, 5); // expected-warning{{incomplete format specifier}} expected-warning{{data argument not used by format string}}
599
+
printf("%.", 5); // expected-warning{{incomplete format specifier}} expected-warning{{data argument not used by format string}}
600
600
601
601
constcharkFormat6[] ="%s"; // expected-note{{format string is defined here}}
602
602
printf(kFormat6, 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
603
603
printf("%s", 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
604
604
605
605
constcharkFormat7[] ="%0$"; // expected-note{{format string is defined here}}
606
-
printf(kFormat7, 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
607
-
printf("%0$", 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
606
+
printf(kFormat7, 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} expected-warning{{data argument not used by format string}}
607
+
printf("%0$", 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} expected-warning{{data argument not used by format string}}
608
608
609
609
constcharkFormat8[] ="%1$d %d"; // expected-note{{format string is defined here}}
610
610
printf(kFormat8, 4, 4); // expected-warning{{cannot mix positional and non-positional arguments in format string}}
@@ -615,8 +615,8 @@ void pr9751(void) {
615
615
printf("", 4, 4); // expected-warning{{format string is empty}}
616
616
617
617
constcharkFormat10[] ="\0%d"; // expected-note{{format string is defined here}}
618
-
printf(kFormat10, 4); // expected-warning{{format string contains '\0' within the string body}}
619
-
printf("\0%d", 4); // expected-warning{{format string contains '\0' within the string body}}
618
+
printf(kFormat10, 4); // expected-warning{{format string contains '\0' within the string body}} expected-warning{{data argument not used by format string}}
619
+
printf("\0%d", 4); // expected-warning{{format string contains '\0' within the string body}} expected-warning{{data argument not used by format string}}
620
620
621
621
constcharkFormat11[] ="%*d"; // expected-note{{format string is defined here}}
622
622
printf(kFormat11); // expected-warning{{'*' specified field width is missing a matching 'int' argument}}
NSLog(@"%[blark]@", @"Foo"); // expected-warning {{'blark' is not a valid object format flag}}
283
+
NSLog(@"%[blark]@", @"Foo"); // expected-warning {{'blark' is not a valid object format flag}} expected-warning{{data argument not used by format string}}
NSLog(@"%2$[tt]@ %1$[tt]s", @"Foo", @"Bar"); // expected-warning {{object format flags cannot be used with 's' conversion specifier}}
285
+
NSLog(@"%2$[tt]@ %1$[tt]s", @"Foo", @"Bar"); // expected-warning {{object format flags cannot be used with 's' conversion specifier}} expected-warning{{data argument not used by format string}}
0 commit comments