Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / param-type-mismatch.c
blob9498a748f308ed8e38ac2f7d38a3a8c18b075c17
1 /* { dg-options "-fdiagnostics-show-caret" } */
3 /* A collection of calls where argument 2 is of the wrong type. */
5 /* decl, with argname. */
7 extern int callee_1 (int one, const char *two, float three); /* { dg-line callee_1 } */
9 int test_1 (int first, int second, float third)
11 return callee_1 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_1' makes pointer from integer without a cast" } */
12 /* { dg-begin-multiline-output "" }
13 return callee_1 (first, second, third);
14 ^~~~~~
15 { dg-end-multiline-output "" } */
16 /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_1 } */
17 /* { dg-begin-multiline-output "" }
18 extern int callee_1 (int one, const char *two, float three);
19 ~~~~~~~~~~~~^~~
20 { dg-end-multiline-output "" } */
23 /* decl, without argname. */
25 extern int callee_2 (int, const char *, float); /* { dg-line callee_2 } */
27 int test_2 (int first, int second, float third)
29 return callee_2 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_2' makes pointer from integer without a cast" } */
30 /* { dg-begin-multiline-output "" }
31 return callee_2 (first, second, third);
32 ^~~~~~
33 { dg-end-multiline-output "" } */
34 /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_2 } */
35 /* { dg-begin-multiline-output "" }
36 extern int callee_2 (int, const char *, float);
37 ^~~~~~~~~~~~
38 { dg-end-multiline-output "" } */
41 /* defn, with argname. */
43 static int callee_3 (int one, const char *two, float three) /* { dg-line callee_3 } */
45 return callee_2 (one, two, three);
48 int test_3 (int first, int second, float third)
50 return callee_3 (first, second, third); // { dg-warning "passing argument 2 of 'callee_3' makes pointer from integer without a cast" }
51 /* { dg-begin-multiline-output "" }
52 return callee_3 (first, second, third);
53 ^~~~~~
54 { dg-end-multiline-output "" } */
55 /* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_3 } */
56 /* { dg-begin-multiline-output "" }
57 static int callee_3 (int one, const char *two, float three)
58 ~~~~~~~~~~~~^~~
59 { dg-end-multiline-output "" } */
62 /* Trivial decl, with argname. */
64 extern int callee_4 (int one, float two, float three); /* { dg-line callee_4 } */
66 int test_4 (int first, const char *second, float third)
68 return callee_4 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_4'" } */
69 /* { dg-begin-multiline-output "" }
70 return callee_4 (first, second, third);
71 ^~~~~~
72 { dg-end-multiline-output "" } */
73 /* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_4 } */
74 /* { dg-begin-multiline-output "" }
75 extern int callee_4 (int one, float two, float three);
76 ~~~~~~^~~
77 { dg-end-multiline-output "" } */
80 /* Trivial decl, without argname. */
82 extern int callee_5 (int, float, float); /* { dg-line callee_5 } */
84 int test_5 (int first, const char *second, float third)
86 return callee_5 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_5'" } */
87 /* { dg-begin-multiline-output "" }
88 return callee_5 (first, second, third);
89 ^~~~~~
90 { dg-end-multiline-output "" } */
91 /* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_5 } */
92 /* { dg-begin-multiline-output "" }
93 extern int callee_5 (int, float, float);
94 ^~~~~
95 { dg-end-multiline-output "" } */
98 /* Callback with name. */
100 extern int callee_6 (int one, int (*two)(int, int), float three); /* { dg-line callee_6 } */
102 int test_6 (int first, int second, float third)
104 return callee_6 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_6' makes pointer from integer without a cast" } */
105 /* { dg-begin-multiline-output "" }
106 return callee_6 (first, second, third);
107 ^~~~~~
108 { dg-end-multiline-output "" } */
109 /* { dg-message " expected 'int \\(\\*\\)\\(int, int\\)' but argument is of type 'int'" "" { target *-*-* } callee_6 } */
110 /* { dg-begin-multiline-output "" }
111 extern int callee_6 (int one, int (*two)(int, int), float three);
112 ~~~~~~^~~~~~~~~~~~~~
113 { dg-end-multiline-output "" } */
116 /* Callback without name. */
118 extern int callee_7 (int one, int (*)(int, int), float three); /* { dg-line callee_7 } */
120 int test_7 (int first, int second, float third)
122 return callee_7 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_7' makes pointer from integer without a cast" } */
123 /* { dg-begin-multiline-output "" }
124 return callee_7 (first, second, third);
125 ^~~~~~
126 { dg-end-multiline-output "" } */
127 /* { dg-message " expected 'int \\(\\*\\)\\(int, int\\)' but argument is of type 'int'" "" { target *-*-* } callee_7 } */
128 /* { dg-begin-multiline-output "" }
129 extern int callee_7 (int one, int (*)(int, int), float three);
130 ^~~~~~~~~~~~~~~~~
131 { dg-end-multiline-output "" } */