aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings-fixit.c
blob: ba38973049cb51bea01e0876b290036475ba41e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t

/* This is a test of the various code modification hints that are
   provided as part of warning or extension diagnostics. All of the
   warnings will be fixed by -fixit, and the resulting file should
   compile cleanly with -Werror -pedantic. */

int printf(char const *, ...);

void test() {
  printf("%0s", (int) 123);
  printf("abc%f", "testing testing 123");
  printf("%u", (long) -12);
  printf("%+.2d", (unsigned long long) 123456);
  printf("%1d", (long double) 1.23);
  printf("%Ld", (long double) -4.56);
  printf("%1$f:%2$.*3$f:%4$.*3$f\n", 1, 2, 3, 4);
}