diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-28 19:34:36 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-28 19:34:36 +0000 |
commit | 3230bfa8e6bc4569fba44d8c2e4807ddf2a8f06e (patch) | |
tree | 63b0322b8155dda59f3357e394cb4dd3af952625 /gcc/testsuite/gcc.dg | |
parent | f6c7e4afa3fdbe93f5670349dd03ca5733ef4bef (diff) | |
download | gcc-3230bfa8e6bc4569fba44d8c2e4807ddf2a8f06e.tar.gz |
2008-08-28 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/30949
* c-typeck.c (convert_for_assignment): Give a note describing what
was passed and what was expected.
testsuite/
* gcc.dg/pr30949.c: New.
* gcc.dg/transparent-union-1.c: Update.
* gcc.dg/cleanup-1.c: Update.
* gcc.dg/assign-warn-2.c: Update.
* gcc.dg/conv-2.c: Update.
* gcc.dg/Wpointer-sign-pedantic.c: Update.
* gcc.dg/Wpointer-sign-Wall.c: Update.
* gcc.dg/assign-warn-1.c: Update.
* gcc.dg/dfp/composite-type.c: Update.
* gcc.dg/noncompile/20020213-1.c: Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139729 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/assign-warn-1.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/assign-warn-2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cleanup-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/conv-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/composite-type.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/noncompile/20020213-1.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr30949.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/transparent-union-1.c | 2 |
10 files changed, 35 insertions, 6 deletions
diff --git a/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c b/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c index e72d37a18ce..302d50e5cf1 100644 --- a/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c +++ b/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c @@ -2,7 +2,8 @@ /* { dg-options "-Wall" } */ -void foo(unsigned long* ulp); +void foo(unsigned long* ulp); /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 5 } */ + void bar(long* lp) { foo(lp); /* { dg-warning "differ in signedness" } */ diff --git a/gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c b/gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c index 25e25209e52..8b92110988d 100644 --- a/gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c +++ b/gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c @@ -2,7 +2,7 @@ /* { dg-options "-pedantic" } */ -void foo(unsigned long* ulp); +void foo(unsigned long* ulp);/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 5 } */ void bar(long* lp) { foo(lp); /* { dg-warning "differ in signedness" } */ diff --git a/gcc/testsuite/gcc.dg/assign-warn-1.c b/gcc/testsuite/gcc.dg/assign-warn-1.c index 1587c20d7b4..4c603829d59 100644 --- a/gcc/testsuite/gcc.dg/assign-warn-1.c +++ b/gcc/testsuite/gcc.dg/assign-warn-1.c @@ -121,3 +121,6 @@ TESTARP(istrb, int, struct s); /* { dg-error "incompatible type for argument 1 o TESTASS(istrc, int, struct s); /* { dg-error "incompatible types in assignment" } */ TESTINI(istrd, int, struct s); /* { dg-error "incompatible types in initialization" } */ TESTRET(istre, int, struct s); /* { dg-error "incompatible types in return" } */ + +/* Match all extra informative notes. */ +/* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/assign-warn-2.c b/gcc/testsuite/gcc.dg/assign-warn-2.c index 0ef6ebe33b3..4656961f6c4 100644 --- a/gcc/testsuite/gcc.dg/assign-warn-2.c +++ b/gcc/testsuite/gcc.dg/assign-warn-2.c @@ -122,3 +122,4 @@ TESTARP(istrb, int, struct s); /* { dg-error "incompatible type for argument 1 o TESTASS(istrc, int, struct s); /* { dg-error "incompatible types in assignment" } */ TESTINI(istrd, int, struct s); /* { dg-error "incompatible types in initialization" } */ TESTRET(istre, int, struct s); /* { dg-error "incompatible types in return" } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cleanup-1.c b/gcc/testsuite/gcc.dg/cleanup-1.c index e5853c4baa8..dd571635baf 100644 --- a/gcc/testsuite/gcc.dg/cleanup-1.c +++ b/gcc/testsuite/gcc.dg/cleanup-1.c @@ -10,10 +10,10 @@ static void f2() { } static void f3(void) { } static void f4(void *x U) { } static void f5(int *x U) { } -static void f6(double *x U) { } +static void f6(double *x U) { } /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */ static void f7(const int *x U) { } static void f8(const int *x U, int y U) { } -static void f9(int x U) { } +static void f9(int x U) { } /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */ void test(void) { diff --git a/gcc/testsuite/gcc.dg/conv-2.c b/gcc/testsuite/gcc.dg/conv-2.c index ac95584e3a6..388dee3d746 100644 --- a/gcc/testsuite/gcc.dg/conv-2.c +++ b/gcc/testsuite/gcc.dg/conv-2.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-Wpointer-sign" } */ -void f1(long *); -void f2(unsigned long *); +void f1(long *); /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */ +void f2(unsigned long *); /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" } */ int main() { diff --git a/gcc/testsuite/gcc.dg/dfp/composite-type.c b/gcc/testsuite/gcc.dg/dfp/composite-type.c index 56991add7f3..b2e7632e62a 100644 --- a/gcc/testsuite/gcc.dg/dfp/composite-type.c +++ b/gcc/testsuite/gcc.dg/dfp/composite-type.c @@ -33,8 +33,16 @@ do \ } while(0) DECIMAL_COMPOSITE_DECL(32); /* { dg-error "incompatible types in assignment" } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 35 } */ + + DECIMAL_COMPOSITE_DECL(64); /* { dg-error "incompatible types in assignment" } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 39 } */ + + DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types in assignment" } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 43 } */ + int main() { diff --git a/gcc/testsuite/gcc.dg/noncompile/20020213-1.c b/gcc/testsuite/gcc.dg/noncompile/20020213-1.c index c1de5663ace..41480f0794d 100644 --- a/gcc/testsuite/gcc.dg/noncompile/20020213-1.c +++ b/gcc/testsuite/gcc.dg/noncompile/20020213-1.c @@ -25,7 +25,10 @@ int main () } /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 15 } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 5 } */ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 16 } */ /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 16 } */ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 18 } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 6 } */ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 20 } */ +/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 7 } */ diff --git a/gcc/testsuite/gcc.dg/pr30949.c b/gcc/testsuite/gcc.dg/pr30949.c new file mode 100644 index 00000000000..a3f6a14132c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr30949.c @@ -0,0 +1,11 @@ +/* PR30949 */ +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +int func (int x); +void recv (int (* funcptr) (double x)); /* { dg-message "note: expected 'int .\\\*..double.' but argument is of type 'int .\\\*..int.'" } */ +void call (void) +{ + recv (func); /* { dg-error "passing argument 1 of 'recv' from incompatible pointer type" } */ +} + diff --git a/gcc/testsuite/gcc.dg/transparent-union-1.c b/gcc/testsuite/gcc.dg/transparent-union-1.c index a43e07953d3..2360912e3c5 100644 --- a/gcc/testsuite/gcc.dg/transparent-union-1.c +++ b/gcc/testsuite/gcc.dg/transparent-union-1.c @@ -81,3 +81,5 @@ main (void) f13 (&l); return 0; } + +/* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */ |