freebsd-skq/test/FixIt/fixit.c

40 lines
927 B
C
Raw Normal View History

2009-11-18 14:59:57 +00:00
// RUN: clang-cc -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
// RUN: clang-cc -pedantic -Werror -x c -
// RUN: FileCheck -input-file=%t %s
2009-06-02 17:58:47 +00:00
/* 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. */
2009-11-18 14:59:57 +00:00
// FIXME: FIX-IT should add #include <string.h>?
int strcmp(const char *s1, const char *s2);
2009-06-02 17:58:47 +00:00
void f0(void) { };
struct s {
int x, y;;
};
2009-11-18 14:59:57 +00:00
// CHECK: _Complex double cd;
2009-06-02 17:58:47 +00:00
_Complex cd;
2009-11-18 14:59:57 +00:00
// CHECK: struct s s0 = { .y = 5 };
2009-06-02 17:58:47 +00:00
struct s s0 = { y: 5 };
2009-11-18 14:59:57 +00:00
// CHECK: int array0[5] = { [3] = 3 };
2009-06-02 17:58:47 +00:00
int array0[5] = { [3] 3 };
void f1(x, y)
{
}
int i0 = { 17 };
int f2(const char *my_string) {
// FIXME: terminal output isn't so good when "my_string" is shorter
2009-11-18 14:59:57 +00:00
// CHECK: return strcmp(my_string , "foo") == 0;
2009-06-02 17:58:47 +00:00
return my_string == "foo";
}
2009-11-18 14:59:57 +00:00