1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/* { dg-options "-fdiagnostics-show-caret" } */
/* A collection of calls where argument 2 is of the wrong type. */
/* decl, with argname. */
extern int callee_1 (int one, const char *two, float three); /* { dg-line callee_1 } */
int test_1 (int first, int second, float third)
{
return callee_1 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_1' makes pointer from integer without a cast" } */
/* { dg-begin-multiline-output "" }
return callee_1 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_1 } */
/* { dg-begin-multiline-output "" }
extern int callee_1 (int one, const char *two, float three);
~~~~~~~~~~~~^~~
{ dg-end-multiline-output "" } */
}
/* decl, without argname. */
extern int callee_2 (int, const char *, float); /* { dg-line callee_2 } */
int test_2 (int first, int second, float third)
{
return callee_2 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_2' makes pointer from integer without a cast" } */
/* { dg-begin-multiline-output "" }
return callee_2 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_2 } */
/* { dg-begin-multiline-output "" }
extern int callee_2 (int, const char *, float);
^~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
/* defn, with argname. */
static int callee_3 (int one, const char *two, float three) /* { dg-line callee_3 } */
{
return callee_2 (one, two, three);
}
int test_3 (int first, int second, float third)
{
return callee_3 (first, second, third); // { dg-warning "passing argument 2 of 'callee_3' makes pointer from integer without a cast" }
/* { dg-begin-multiline-output "" }
return callee_3 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message "expected 'const char \\*' but argument is of type 'int'" "" { target *-*-* } callee_3 } */
/* { dg-begin-multiline-output "" }
static int callee_3 (int one, const char *two, float three)
~~~~~~~~~~~~^~~
{ dg-end-multiline-output "" } */
}
/* Trivial decl, with argname. */
extern int callee_4 (int one, float two, float three); /* { dg-line callee_4 } */
int test_4 (int first, const char *second, float third)
{
return callee_4 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_4'" } */
/* { dg-begin-multiline-output "" }
return callee_4 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_4 } */
/* { dg-begin-multiline-output "" }
extern int callee_4 (int one, float two, float three);
~~~~~~^~~
{ dg-end-multiline-output "" } */
}
/* Trivial decl, without argname. */
extern int callee_5 (int, float, float); /* { dg-line callee_5 } */
int test_5 (int first, const char *second, float third)
{
return callee_5 (first, second, third); /* { dg-error "incompatible type for argument 2 of 'callee_5'" } */
/* { dg-begin-multiline-output "" }
return callee_5 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message "expected 'float' but argument is of type 'const char \\*'" "" { target *-*-* } callee_5 } */
/* { dg-begin-multiline-output "" }
extern int callee_5 (int, float, float);
^~~~~
{ dg-end-multiline-output "" } */
}
/* Callback with name. */
extern int callee_6 (int one, int (*two)(int, int), float three); /* { dg-line callee_6 } */
int test_6 (int first, int second, float third)
{
return callee_6 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_6' makes pointer from integer without a cast" } */
/* { dg-begin-multiline-output "" }
return callee_6 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message " expected 'int \\(\\*\\)\\(int, int\\)' but argument is of type 'int'" "" { target *-*-* } callee_6 } */
/* { dg-begin-multiline-output "" }
extern int callee_6 (int one, int (*two)(int, int), float three);
~~~~~~^~~~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
/* Callback without name. */
extern int callee_7 (int one, int (*)(int, int), float three); /* { dg-line callee_7 } */
int test_7 (int first, int second, float third)
{
return callee_7 (first, second, third); /* { dg-warning "passing argument 2 of 'callee_7' makes pointer from integer without a cast" } */
/* { dg-begin-multiline-output "" }
return callee_7 (first, second, third);
^~~~~~
{ dg-end-multiline-output "" } */
/* { dg-message " expected 'int \\(\\*\\)\\(int, int\\)' but argument is of type 'int'" "" { target *-*-* } callee_7 } */
/* { dg-begin-multiline-output "" }
extern int callee_7 (int one, int (*)(int, int), float three);
^~~~~~~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
|