aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c47
-rw-r--r--gcc/testsuite/ChangeLog14
-rw-r--r--gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wpointer-sign-pedantic.c2
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/assign-warn-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/conv-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/dfp/composite-type.c8
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/20020213-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr30949.c11
-rw-r--r--gcc/testsuite/gcc.dg/transparent-union-1.c2
13 files changed, 80 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5e93e9d..2fe7789 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2008-08-28 Joey Ye <joey.ye@intel.com>
* doc/extend.texi: Document AVX built-in functions.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 9f72588..85a9444 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -3952,28 +3952,31 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
/* This macro is used to emit diagnostics to ensure that all format
strings are complete sentences, visible to gettext and checked at
compile time. */
-#define WARN_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \
- do { \
- switch (errtype) \
- { \
- case ic_argpass: \
- pedwarn (LOCATION, OPT, AR, parmnum, rname); \
- break; \
- case ic_argpass_nonproto: \
- warning (OPT, AR, parmnum, rname); \
- break; \
- case ic_assign: \
- pedwarn (LOCATION, OPT, AS); \
- break; \
- case ic_init: \
- pedwarn (LOCATION, OPT, IN); \
- break; \
- case ic_return: \
- pedwarn (LOCATION, OPT, RE); \
- break; \
- default: \
- gcc_unreachable (); \
- } \
+#define WARN_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \
+ do { \
+ switch (errtype) \
+ { \
+ case ic_argpass: \
+ if (pedwarn (LOCATION, OPT, AR, parmnum, rname)) \
+ inform (fundecl ? DECL_SOURCE_LOCATION (fundecl) : LOCATION, \
+ "expected %qT but argument is of type %qT", \
+ type, rhstype); \
+ break; \
+ case ic_argpass_nonproto: \
+ warning (OPT, AR, parmnum, rname); \
+ break; \
+ case ic_assign: \
+ pedwarn (LOCATION, OPT, AS); \
+ break; \
+ case ic_init: \
+ pedwarn (LOCATION, OPT, IN); \
+ break; \
+ case ic_return: \
+ pedwarn (LOCATION, OPT, RE); \
+ break; \
+ default: \
+ gcc_unreachable (); \
+ } \
} while (0)
STRIP_TYPE_NOPS (rhs);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6af70c5..30b4323 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,17 @@
+2008-08-28 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c/30949
+ * 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.
+
2008-08-28 Daniel Kraft <d@domob.eu>
* gfortran.dg/typebound_call_1.f03: New test.
diff --git a/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c b/gcc/testsuite/gcc.dg/Wpointer-sign-Wall.c
index e72d37a..302d50e 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 25e2520..8b92110 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 1587c20..4c60382 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 0ef6ebe..4656961 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 e5853c4..dd57163 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 ac95584..388dee3 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 56991ad..b2e7632 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 c1de566..41480f0 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 0000000..a3f6a14
--- /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 a43e079..2360912 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 } */