blob: 83d724dffc01af9020a65e0b4c94cb1e8c231e80 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
2// RUN: %clang_cc1 -pedantic -Werror -x c -
Daniel Dunbar266cc532009-11-14 19:25:21 +00003// 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. */
Daniel Dunbard8aefab2009-11-17 22:25:16 +00009
10// FIXME: FIX-IT should add #include <string.h>?
11int strcmp(const char *s1, const char *s2);
Douglas Gregor9b3064b2009-04-01 22:41:11 +000012
13void f0(void) { };
14
15struct s {
16 int x, y;;
17};
18
Daniel Dunbar266cc532009-11-14 19:25:21 +000019// CHECK: _Complex double cd;
Douglas Gregor9b3064b2009-04-01 22:41:11 +000020_Complex cd;
21
Daniel Dunbar266cc532009-11-14 19:25:21 +000022// CHECK: struct s s0 = { .y = 5 };
Douglas Gregor9b3064b2009-04-01 22:41:11 +000023struct s s0 = { y: 5 };
Daniel Dunbar266cc532009-11-14 19:25:21 +000024
25// CHECK: int array0[5] = { [3] = 3 };
Douglas Gregor9b3064b2009-04-01 22:41:11 +000026int array0[5] = { [3] 3 };
Douglas Gregora3a83512009-04-01 23:51:29 +000027
28void f1(x, y)
29{
30}
31
32int i0 = { 17 };
33
34int f2(const char *my_string) {
35 // FIXME: terminal output isn't so good when "my_string" is shorter
Daniel Dunbar266cc532009-11-14 19:25:21 +000036// CHECK: return strcmp(my_string , "foo") == 0;
Douglas Gregora86b8322009-04-06 18:45:53 +000037 return my_string == "foo";
Douglas Gregora3a83512009-04-01 23:51:29 +000038}
Daniel Dunbar266cc532009-11-14 19:25:21 +000039