111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-Wimplicit-function-declaration -fdiagnostics-show-caret" } */
|
|
3
|
|
4 typedef struct GtkWidget { int dummy; } GtkWidget;
|
|
5
|
|
6 extern void gtk_widget_show_all (GtkWidget *w);
|
|
7
|
|
8 void
|
|
9 test_1 (GtkWidget *w)
|
|
10 {
|
|
11 gtk_widget_showall (w); /* { dg-warning "3: implicit declaration of function .gtk_widget_showall.; did you mean .gtk_widget_show_all.?" } */
|
|
12 /* { dg-begin-multiline-output "" }
|
|
13 gtk_widget_showall (w);
|
|
14 ^~~~~~~~~~~~~~~~~~
|
|
15 gtk_widget_show_all
|
|
16 { dg-end-multiline-output "" } */
|
|
17
|
|
18 /* Ensure we don't try to suggest "gtk_widget_showall" for subsequent
|
|
19 corrections. */
|
|
20 gtk_widget_showall_ (w); /* { dg-warning "3: implicit declaration of function .gtk_widget_showall_.; did you mean .gtk_widget_show_all.?" } */
|
|
21 /* { dg-begin-multiline-output "" }
|
|
22 gtk_widget_showall_ (w);
|
|
23 ^~~~~~~~~~~~~~~~~~~
|
|
24 gtk_widget_show_all
|
|
25 { dg-end-multiline-output "" } */
|
|
26
|
|
27 GtkWidgetShowAll (w); /* { dg-warning "3: implicit declaration of function .GtkWidgetShowAll.; did you mean .gtk_widget_show_all.?" } */
|
|
28 /* { dg-begin-multiline-output "" }
|
|
29 GtkWidgetShowAll (w);
|
|
30 ^~~~~~~~~~~~~~~~
|
|
31 gtk_widget_show_all
|
|
32 { dg-end-multiline-output "" } */
|
|
33 }
|
|
34
|
|
35 int
|
|
36 test_2 (int param)
|
|
37 {
|
|
38 return parma * parma; /* { dg-error "10: .parma. undeclared .first use in this function.; did you mean .param." } */
|
|
39 /* { dg-begin-multiline-output "" }
|
|
40 return parma * parma;
|
|
41 ^~~~~
|
|
42 param
|
|
43 { dg-end-multiline-output "" } */
|
|
44 }
|
|
45
|
|
46 #define MACRO(X) ((X))
|
|
47
|
|
48 int
|
|
49 test_3 (int i)
|
|
50 {
|
|
51 return MACRAME (i); /* { dg-warning "10: implicit declaration of function .MACRAME.; did you mean .MACRO.?" } */
|
|
52 /* { dg-begin-multiline-output "" }
|
|
53 return MACRAME (i);
|
|
54 ^~~~~~~
|
|
55 MACRO
|
|
56 { dg-end-multiline-output "" } */
|
|
57 }
|
|
58
|
|
59 #define IDENTIFIER_POINTER(X) ((X))
|
|
60
|
|
61 int
|
|
62 test_4 (int node)
|
|
63 {
|
|
64 return IDENTIFIER_PTR (node); /* { dg-warning "10: implicit declaration of function .IDENTIFIER_PTR.; did you mean .IDENTIFIER_POINTER.?" } */
|
|
65 /* { dg-begin-multiline-output "" }
|
|
66 return IDENTIFIER_PTR (node);
|
|
67 ^~~~~~~~~~~~~~
|
|
68 IDENTIFIER_POINTER
|
|
69 { dg-end-multiline-output "" } */
|
|
70 }
|
|
71
|
|
72
|
|
73 int
|
|
74 test_5 (void)
|
|
75 {
|
|
76 return __LINE_; /* { dg-error "10: .__LINE_. undeclared .first use in this function.; did you mean .__LINE__." } */
|
|
77 /* { dg-begin-multiline-output "" }
|
|
78 return __LINE_;
|
|
79 ^~~~~~~
|
|
80 __LINE__
|
|
81 { dg-end-multiline-output "" } */
|
|
82 }
|
|
83
|
|
84 #define MAX_ITEMS 100
|
|
85 int array[MAX_ITEM]; /* { dg-error "11: .MAX_ITEM. undeclared here .not in a function.; did you mean .MAX_ITEMS." } */
|
|
86 /* { dg-begin-multiline-output "" }
|
|
87 int array[MAX_ITEM];
|
|
88 ^~~~~~~~
|
|
89 MAX_ITEMS
|
|
90 { dg-end-multiline-output "" } */
|
|
91
|
|
92
|
|
93 enum foo {
|
|
94 FOO_FIRST,
|
|
95 FOO_SECOND
|
|
96 };
|
|
97
|
|
98 int
|
|
99 test_6 (enum foo f)
|
|
100 {
|
|
101 switch (f)
|
|
102 {
|
|
103 case FOO_FURST: /* { dg-error "10: .FOO_FURST. undeclared .first use in this function.; did you mean .FOO_FIRST." } */
|
|
104 break;
|
|
105 /* { dg-begin-multiline-output "" }
|
|
106 case FOO_FURST:
|
|
107 ^~~~~~~~~
|
|
108 FOO_FIRST
|
|
109 { dg-end-multiline-output "" } */
|
|
110
|
|
111 case FOO_SECCOND: /* { dg-error "10: .FOO_SECCOND. undeclared .first use in this function.; did you mean .FOO_SECOND." } */
|
|
112 break;
|
|
113 /* { dg-begin-multiline-output "" }
|
|
114 case FOO_SECCOND:
|
|
115 ^~~~~~~~~~~
|
|
116 FOO_SECOND
|
|
117 { dg-end-multiline-output "" } */
|
|
118
|
|
119 default:
|
|
120 break;
|
|
121 }
|
|
122 }
|
|
123
|
|
124 int snprintf (char *, __SIZE_TYPE__, const char *, ...);
|
|
125
|
|
126 void
|
|
127 test_7 (int i, int j)
|
|
128 {
|
|
129 int buffer[100];
|
|
130 snprint (buffer, 100, "%i of %i", i, j); /* { dg-warning "3: implicit declaration of function .snprint.; did you mean .snprintf.." } */
|
|
131 /* { dg-begin-multiline-output "" }
|
|
132 snprint (buffer, 100, "%i of %i", i, j);
|
|
133 ^~~~~~~
|
|
134 snprintf
|
|
135 { dg-end-multiline-output "" } */
|
|
136 }
|