blob: 51cfb895e2bdcaf739dea0aeb03f26fd9aa035d7 [file] [log] [blame]
Douglas Gregord93256e2010-01-28 06:00:51 +00001_Complex cd; // CHECK: code-complete-errors.c:1:1: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
Douglas Gregor51c6d382010-01-29 00:41:11 +00002// CHECK: FIX-IT: Insert " double" at 1:9
Douglas Gregord93256e2010-01-28 06:00:51 +00003struct s {
Douglas Gregorf13ca062010-06-16 23:08:59 +00004 int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct
Daniel Dunbar51b058c2010-02-14 08:32:24 +00005}; // CHECK: FIX-IT: Remove [4:12 - 4:13]
Douglas Gregord93256e2010-01-28 06:00:51 +00006
7struct s s0 = { y: 5 }; // CHECK: code-complete-errors.c:7:20: warning: use of GNU old-style field designator extension
Daniel Dunbar51b058c2010-02-14 08:32:24 +00008// CHECK: FIX-IT: Replace [7:17 - 7:19] with ".y = "
Douglas Gregord93256e2010-01-28 06:00:51 +00009int f(int *ptr1, float *ptr2) {
Douglas Gregor0a812cf2010-02-18 23:07:20 +000010 return ptr1 != ptr2; // CHECK: code-complete-errors.c:10:15:{10:10-10:14}{10:18-10:22}: warning: comparison of distinct pointer types ('int *' and 'float *')
Douglas Gregord93256e2010-01-28 06:00:51 +000011}
12
Douglas Gregora9b06d42010-11-09 06:24:54 +000013#define expand_to_binary_function(ret, name, parm1, parm2, code) ret name(parm1, parm2) code
14
15expand_to_binary_function(int, g, int *ip, float *fp, {
Douglas Gregoraa5f1352010-11-19 16:18:16 +000016 // CHECK: code-complete-errors.c:17:12:{17:9-17:24}: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
17 if (ip = (float*)fp) ;
18// CHECK: code-complete-errors.c:19:15:{19:12-19:14}{19:18-19:20}: warning: comparison of distinct pointer types ('int *' and 'float *')
Douglas Gregora9b06d42010-11-09 06:24:54 +000019 return ip == fp;
20 })
21
Douglas Gregord93256e2010-01-28 06:00:51 +000022void g() { }
23
Douglas Gregoraa5f1352010-11-19 16:18:16 +000024// RUN: c-index-test -code-completion-at=%s:21:12 -pedantic %s 2> %t
Douglas Gregord93256e2010-01-28 06:00:51 +000025// RUN: FileCheck -check-prefix=CHECK %s < %t