Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -pedantic -fixit %s -o - | grep -v 'CHECK' > %t |
| 2 | // RUN: %clang_cc1 -pedantic -Werror -x c - |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 3 | // RUN: FileCheck -input-file=%t %s |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 4 | |
| 5 | /* This is a test of the various code modification hints that are |
Douglas Gregor | fe057ac | 2009-04-02 03:20:30 +0000 | [diff] [blame] | 6 | 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 Dunbar | d8aefab | 2009-11-17 22:25:16 +0000 | [diff] [blame] | 9 | |
| 10 | // FIXME: FIX-IT should add #include <string.h>? |
| 11 | int strcmp(const char *s1, const char *s2); |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 12 | |
| 13 | void f0(void) { }; |
| 14 | |
| 15 | struct s { |
| 16 | int x, y;; |
| 17 | }; |
| 18 | |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 19 | // CHECK: _Complex double cd; |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 20 | _Complex cd; |
| 21 | |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 22 | // CHECK: struct s s0 = { .y = 5 }; |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 23 | struct s s0 = { y: 5 }; |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 24 | |
| 25 | // CHECK: int array0[5] = { [3] = 3 }; |
Douglas Gregor | 9b3064b | 2009-04-01 22:41:11 +0000 | [diff] [blame] | 26 | int array0[5] = { [3] 3 }; |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 27 | |
| 28 | void f1(x, y) |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | int i0 = { 17 }; |
| 33 | |
| 34 | int f2(const char *my_string) { |
| 35 | // FIXME: terminal output isn't so good when "my_string" is shorter |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 36 | // CHECK: return strcmp(my_string , "foo") == 0; |
Douglas Gregor | a86b832 | 2009-04-06 18:45:53 +0000 | [diff] [blame] | 37 | return my_string == "foo"; |
Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 38 | } |
Daniel Dunbar | 266cc53 | 2009-11-14 19:25:21 +0000 | [diff] [blame] | 39 | |