blob: 1f085e4f0edd3e92b98d29fefd3d6eee03a82720 [file] [log] [blame]
Daniel Dunbar266cc532009-11-14 19:25:21 +00001// RUN: clang-cc -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
2// RUN: clang-cc -pedantic -Werror -x c -
3// RUN: FileCheck -input-file=%t %s
Douglas Gregor9b3064b2009-04-01 22:41:11 +00004
5/* This is a test of the various code modification hints that are
Douglas Gregorfe057ac2009-04-02 03:20:30 +00006 provided as part of warning or extension diagnostics. All of the
7 warnings will be fixed by -fixit, and the resulting file should
8 compile cleanly with -Werror -pedantic. */
Douglas Gregora86b8322009-04-06 18:45:53 +00009#include <string.h> // FIXME: FIX-IT hint should add this for us!
Douglas Gregor9b3064b2009-04-01 22:41:11 +000010
11void f0(void) { };
12
13struct s {
14 int x, y;;
15};
16
Daniel Dunbar266cc532009-11-14 19:25:21 +000017// CHECK: _Complex double cd;
Douglas Gregor9b3064b2009-04-01 22:41:11 +000018_Complex cd;
19
Daniel Dunbar266cc532009-11-14 19:25:21 +000020// CHECK: struct s s0 = { .y = 5 };
Douglas Gregor9b3064b2009-04-01 22:41:11 +000021struct s s0 = { y: 5 };
Daniel Dunbar266cc532009-11-14 19:25:21 +000022
23// CHECK: int array0[5] = { [3] = 3 };
Douglas Gregor9b3064b2009-04-01 22:41:11 +000024int array0[5] = { [3] 3 };
Douglas Gregora3a83512009-04-01 23:51:29 +000025
26void f1(x, y)
27{
28}
29
30int i0 = { 17 };
31
32int f2(const char *my_string) {
33 // FIXME: terminal output isn't so good when "my_string" is shorter
Daniel Dunbar266cc532009-11-14 19:25:21 +000034// CHECK: return strcmp(my_string , "foo") == 0;
Douglas Gregora86b8322009-04-06 18:45:53 +000035 return my_string == "foo";
Douglas Gregora3a83512009-04-01 23:51:29 +000036}
Daniel Dunbar266cc532009-11-14 19:25:21 +000037