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.
From-SVN: r139729
+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.
/* 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);
+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.
/* { 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" } */
/* { 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" } */
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 } */
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 } */
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)
{
/* { 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()
{
} 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()
{
}
/* { 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 } */
--- /dev/null
+/* 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" } */
+}
+
f13 (&l);
return 0;
}
+
+/* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */