annotate gcc/testsuite/gcc.dg/fixits.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-fdiagnostics-show-caret" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 struct foo { int x; };
kono
parents:
diff changeset
5 union u { int x; };
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 /* Verify that we issue a hint for "." used with a ptr to a struct. */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 int test_1 (struct foo *ptr)
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 return ptr.x; /* { dg-error "'ptr' is a pointer; did you mean to use '->'?" } */
kono
parents:
diff changeset
12 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
13 return ptr.x;
kono
parents:
diff changeset
14 ^
kono
parents:
diff changeset
15 ->
kono
parents:
diff changeset
16 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
17 }
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 /* Likewise for a ptr to a union. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 int test_2 (union u *ptr)
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 return ptr.x; /* { dg-error "'ptr' is a pointer; did you mean to use '->'?" } */
kono
parents:
diff changeset
24 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
25 return ptr.x;
kono
parents:
diff changeset
26 ^
kono
parents:
diff changeset
27 ->
kono
parents:
diff changeset
28 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
29 }
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 /* Verify that we don't issue a hint for a ptr to something that isn't a
kono
parents:
diff changeset
32 struct or union. */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 int test_3 (void **ptr)
kono
parents:
diff changeset
35 {
kono
parents:
diff changeset
36 return ptr.x; /* { dg-error "request for member 'x' in something not a structure or union" } */
kono
parents:
diff changeset
37 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
38 return ptr.x;
kono
parents:
diff changeset
39 ^
kono
parents:
diff changeset
40 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
41 }