blob: 9f858524c27219d55666edb5024766a77da84cbc [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
Chris Lattnere5deae92010-04-20 21:33:39 +000034int test_cond(int y, int fooBar) {
35// CHECK: int x = y ? 1 : 4+fooBar;
36 int x = y ? 1 4+foobar;
Ted Kremenek987aa872010-04-12 22:10:35 +000037 return x;
38}