1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-show-caret" } */
3 
4 typedef struct GtkWidget { int dummy; } GtkWidget;
5 
6 extern void gtk_widget_show_all (GtkWidget *w);
7 
8 
9 void
test_1(GtkWidget * w)10 test_1 (GtkWidget *w)
11 {
12   gtk_widget_showall (w); // { dg-error "3: 'gtk_widget_showall' was not declared in this scope; did you mean 'gtk_widget_show_all'\\?" }
13   /* { dg-begin-multiline-output "" }
14    gtk_widget_showall (w);
15    ^~~~~~~~~~~~~~~~~~
16    gtk_widget_show_all
17    { dg-end-multiline-output "" } */
18 
19   /* Ensure we don't try to suggest "gtk_widget_showall" for subsequent
20      corrections.  */
21   gtk_widget_showall_ (w); // { dg-error "3: 'gtk_widget_showall_' was not declared in this scope; did you mean 'gtk_widget_show_all'\\?" }
22   /* { dg-begin-multiline-output "" }
23    gtk_widget_showall_ (w);
24    ^~~~~~~~~~~~~~~~~~~
25    gtk_widget_show_all
26    { dg-end-multiline-output "" } */
27 
28   GtkWidgetShowAll (w); // { dg-error "3: 'GtkWidgetShowAll' was not declared in this scope; did you mean 'gtk_widget_show_all'\\?" }
29   /* { dg-begin-multiline-output "" }
30    GtkWidgetShowAll (w);
31    ^~~~~~~~~~~~~~~~
32    gtk_widget_show_all
33    { dg-end-multiline-output "" } */
34 }
35 
36 int
test_2(int param)37 test_2 (int param)
38 {
39   return parma * parma; // { dg-error "10: 'parma' was not declared in this scope; did you mean 'param'\\?" }
40   /* { dg-begin-multiline-output "" }
41    return parma * parma;
42           ^~~~~
43           param
44    { dg-end-multiline-output "" } */
45 }
46 
47 #define MACRO(X) ((X))
48 
49 int
test_3(int i)50 test_3 (int i)
51 {
52   return MACRAME (i); // { dg-error "10: 'MACRAME' was not declared in this scope; did you mean 'MACRO'\\?" }
53   /* { dg-begin-multiline-output "" }
54    return MACRAME (i);
55           ^~~~~~~
56           MACRO
57    { dg-end-multiline-output "" } */
58 }
59 
60 #define IDENTIFIER_POINTER(X) ((X))
61 
62 int
test_4(int node)63 test_4 (int node)
64 {
65   return IDENTIFIER_PTR (node); // { dg-error "10: 'IDENTIFIER_PTR' was not declared in this scope; did you mean 'IDENTIFIER_POINTER'\\?" }
66   /* { dg-begin-multiline-output "" }
67    return IDENTIFIER_PTR (node);
68           ^~~~~~~~~~~~~~
69           IDENTIFIER_POINTER
70    { dg-end-multiline-output "" } */
71 }
72 
73 
74 int
test_5(void)75 test_5 (void)
76 {
77   return __LINE_; /* { dg-error "10: '__LINE_' was not declared in this scope; did you mean '__LINE__'\\?" }
78   /* { dg-begin-multiline-output "" }
79    return __LINE_;
80           ^~~~~~~
81           __LINE__
82    { dg-end-multiline-output "" } */
83 }
84 
85 #define MAX_ITEMS 100
86 int array[MAX_ITEM]; // { dg-error "11: 'MAX_ITEM' was not declared in this scope; did you mean 'MAX_ITEMS'\\?" }
87   /* { dg-begin-multiline-output "" }
88  int array[MAX_ITEM];
89            ^~~~~~~~
90            MAX_ITEMS
91    { dg-end-multiline-output "" } */
92 
93 
94 enum foo {
95   FOO_FIRST,
96   FOO_SECOND
97 };
98 
99 void
test_6(enum foo f)100 test_6 (enum foo f)
101 {
102   switch (f)
103     {
104     case FOO_FURST: // { dg-error "10: 'FOO_FURST' was not declared in this scope; did you mean 'FOO_FIRST'\\?" }
105       break;
106   /* { dg-begin-multiline-output "" }
107      case FOO_FURST:
108           ^~~~~~~~~
109           FOO_FIRST
110    { dg-end-multiline-output "" } */
111 
112     case FOO_SECCOND: // { dg-error "10: 'FOO_SECCOND' was not declared in this scope; did you mean 'FOO_SECOND'\\?" }
113       break;
114   /* { dg-begin-multiline-output "" }
115      case FOO_SECCOND:
116           ^~~~~~~~~~~
117           FOO_SECOND
118    { dg-end-multiline-output "" } */
119 
120     default:
121       break;
122     }
123 }
124 
125 int snprintf (char *, __SIZE_TYPE__, const char *, ...);
126 
127 void
test_7(int i,int j)128 test_7 (int i, int j)
129 {
130   int buffer[100];
131   snprint (buffer, 100, "%i of %i", i, j); // { dg-error "3: 'snprint' was not declared in this scope; did you mean 'snprintf'\\?" }
132   /* { dg-begin-multiline-output "" }
133    snprint (buffer, 100, "%i of %i", i, j);
134    ^~~~~~~
135    snprintf
136    { dg-end-multiline-output "" } */
137 }
138 
139 int
test_8()140 test_8 ()
141 {
142   int local = 42;
143 
144   return locale; // { dg-error "10: 'locale' was not declared in this scope; did you mean 'local'\\?" }
145   /* { dg-begin-multiline-output "" }
146    return locale;
147           ^~~~~~
148           local
149    { dg-end-multiline-output "" } */
150 }
151 
152 class base
153 {
154 public:
155   int test_method_1 ();
156 
157 protected:
158   int m_foo;
159 };
160 
161 class sub : public base
162 {
163 public:
164   int test_method_2 ();
165 };
166 
test_method_1()167 int base::test_method_1 ()
168 {
169   return m_food; // { dg-error "10: 'm_food' was not declared in this scope; did you mean 'm_foo'\\?" }
170   /* { dg-begin-multiline-output "" }
171    return m_food;
172           ^~~~~~
173           m_foo
174    { dg-end-multiline-output "" } */
175 }
176 
test_method_2()177 int sub::test_method_2 ()
178 {
179   return m_food; // { dg-error "10: 'm_food' was not declared in this scope; did you mean 'm_foo'\\?" }
180   /* { dg-begin-multiline-output "" }
181    return m_food;
182           ^~~~~~
183           m_foo
184    { dg-end-multiline-output "" } */
185 }
186