annotate gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-parseable-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 "-O -fdiagnostics-parseable-fixits" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 /* This is a collection of unittests for diagnostic_show_locus;
kono
parents:
diff changeset
5 see the overview in diagnostic_plugin_test_show_locus.c.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 In particular, note the discussion of why we need a very long line here:
kono
parents:
diff changeset
8 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
kono
parents:
diff changeset
9 and that we can't use macros in this file. */
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 /* Unit test for rendering of insertion fixit hints
kono
parents:
diff changeset
12 (example taken from PR 62316). */
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 void test_fixit_insert (void)
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 #if 0
kono
parents:
diff changeset
17 int a[2][2] = { 0, 1 , 2, 3 }; /* { dg-warning "insertion hints" } */
kono
parents:
diff changeset
18 /* { dg-regexp "fix-it:.*\\{17:20-17:20\\}:.*" } */
kono
parents:
diff changeset
19 /* { dg-regexp "fix-it:.*\\{17:24-17:24\\}:.*" } */
kono
parents:
diff changeset
20 #endif
kono
parents:
diff changeset
21 }
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* Unit test for rendering of "remove" fixit hints. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 void test_fixit_remove (void)
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 #if 0
kono
parents:
diff changeset
28 int a;; /* { dg-warning "example of a removal hint" } */
kono
parents:
diff changeset
29 /* { dg-regexp "fix-it:.*\\{28:9-28:10\\}:.*" } */
kono
parents:
diff changeset
30 #endif
kono
parents:
diff changeset
31 }
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 /* Unit test for rendering of "replace" fixit hints. */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 void test_fixit_replace (void)
kono
parents:
diff changeset
36 {
kono
parents:
diff changeset
37 #if 0
kono
parents:
diff changeset
38 gtk_widget_showall (dlg); /* { dg-warning "example of a replacement hint" } */
kono
parents:
diff changeset
39 /* { dg-regexp "fix-it:.*\\{38:3-38:21\\}:.*" } */
kono
parents:
diff changeset
40 #endif
kono
parents:
diff changeset
41 }
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 /* Unit test for rendering of fix-it hints that add new lines. */
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 void test_fixit_insert_newline (void)
kono
parents:
diff changeset
46 {
kono
parents:
diff changeset
47 #if 0
kono
parents:
diff changeset
48 switch (op)
kono
parents:
diff changeset
49 {
kono
parents:
diff changeset
50 case 'a':
kono
parents:
diff changeset
51 x = a;
kono
parents:
diff changeset
52 case 'b': /* { dg-warning "newline insertion" } */
kono
parents:
diff changeset
53 x = b;
kono
parents:
diff changeset
54 }
kono
parents:
diff changeset
55 /* { dg-regexp "fix-it:.*\\{52:1-52:1\\}:.*\\n" } */
kono
parents:
diff changeset
56 #endif
kono
parents:
diff changeset
57 }
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 /* Unit test for mutually-exclusive suggestions. */
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 void test_mutually_exclusive_suggestions (void)
kono
parents:
diff changeset
62 {
kono
parents:
diff changeset
63 #if 0
kono
parents:
diff changeset
64 original; /* { dg-warning "warning 1" } */
kono
parents:
diff changeset
65 /* { dg-warning "warning 2" "" { target *-*-* } .-1 } */
kono
parents:
diff changeset
66 /* We should print the mutually-incompatible fix-it hints within
kono
parents:
diff changeset
67 -fdiagnostics-parseable-fixits; verify that they are printed. */
kono
parents:
diff changeset
68 /* { dg-regexp "fix-it:.*\\{64:3-64:11}:.*\\n" } */
kono
parents:
diff changeset
69 /* { dg-regexp "fix-it:.*\\{64:3-64:11}:.*\\n" } */
kono
parents:
diff changeset
70 #endif
kono
parents:
diff changeset
71 }