re PR c/14188 (Suggestion: improve warning message for call through incompatible...
authorEric Botcazou <ebotcazou@libertysurf.fr>
Mon, 23 Feb 2004 12:41:43 +0000 (13:41 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 23 Feb 2004 12:41:43 +0000 (12:41 +0000)
PR c/14188
* builtins.c (expand_builtin_va_arg): Emit an informative message
if a trap is generated.
* c-typeck.c (build_function_call): Likewise.

Co-Authored-By: Falk Hueffner <falk@debian.org>
From-SVN: r78294

gcc/ChangeLog
gcc/builtins.c
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cast-function-1.c
gcc/testsuite/gcc.dg/va-arg-1.c

index 9e18f300bdecfd40e0ee2ad6583d5adb730b5b21..e73f7b22795a6bcd7caa4ed6bcd7dcd3c0f06e83 100644 (file)
@@ -1,3 +1,11 @@
+2004-02-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
+            Falk Hueffner  <falk@debian.org>
+
+       PR c/14188
+       * builtins.c (expand_builtin_va_arg): Emit an informative message
+       if a trap is generated.
+       * c-typeck.c (build_function_call): Likewise.
+
 2004-02-22  Jakub Jelinek  <jakub@redhat.com>
 
        * gcov-io.c (gcov_open) [GCOV_LOCKED]: Use open + fdopen instead of
index 7e5953a955cef056718320ea50daea79cd5697aa..895c83527d2e17b18005e7098cec4acd89dbefa2 100644 (file)
@@ -4134,6 +4134,7 @@ expand_builtin_va_arg (tree valist, tree type)
 
       /* We can, however, treat "undefined" any way we please.
         Call abort to encourage the user to fix the program.  */
+      inform ("if this code is reached, the program will abort");
       expand_builtin_trap ();
 
       /* This is dead code, but go ahead and finish so that the
index ff37fea9216fddf0f8dd6ab88236e3f7318d13ce..2f6216c2fb3418586303452ba53e7c02549fab85 100644 (file)
@@ -1709,6 +1709,10 @@ build_function_call (tree function, tree params)
         executions of the program must execute the code.  */
       warning ("function called through a non-compatible type");
 
+      /* We can, however, treat "undefined" any way we please.
+        Call abort to encourage the user to fix the program.  */
+      inform ("if this code is reached, the program will abort");
+
       if (VOID_TYPE_P (return_type))
        return trap;
       else
index a9411261ebff24e905ebd009a537a78bbf9fe3b1..f62f2946be5fb5643723c84c5a29d06ea530264b 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/cast-function-1.c: Adjust for new informative message.
+       * gcc.dg/va-arg-1.c: Likewise.
+
 2004-02-23  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/14143
index 44cb18396236b95d222e986779c01e90db30a4d2..8ed7d5da41cc830fb3544c224365cf14ad1a3661 100644 (file)
@@ -22,19 +22,19 @@ void bar(void)
   int i;
   str_t s;
 
-  d = ((double (*) (int)) foo1) (i);  /* { dg-warning "non-compatible" } */
-  i = ((int (*) (double)) foo1) (d);  /* { dg-warning "non-compatible" } */
-  s = ((str_t (*) (int)) foo1) (i);   /* { dg-warning "non-compatible" } */
-  ((void (*) (int)) foo1) (d);        /* { dg-warning "non-compatible" } */
-  i = ((int (*) (int)) foo1) (i);     /* { dg-bogus "non-compatible" } */
-  (void) foo1 (i);                    /* { dg-bogus "non-compatible" } */
-
-  d = ((double (*) (int)) foo2) (i);  /* { dg-warning "non-compatible" } */
-  i = ((int (*) (double)) foo2) (d);  /* { dg-bogus "non-compatible" } */
-  s = ((str_t (*) (int)) foo2) (i);   /* { dg-warning "non-compatible" } */
-  ((void (*) (int)) foo2) (d);        /* { dg-warning "non-compatible" } */
-  i = ((int (*) (int)) foo2) (i);     /* { dg-bogus "non-compatible" } */
-  (void) foo2 (i);                    /* { dg-bogus "non-compatible" } */
+  d = ((double (*) (int)) foo1) (i);  /* { dg-warning "non-compatible|abort" } */
+  i = ((int (*) (double)) foo1) (d);  /* { dg-warning "non-compatible|abort" } */
+  s = ((str_t (*) (int)) foo1) (i);   /* { dg-warning "non-compatible|abort" } */
+  ((void (*) (int)) foo1) (d);        /* { dg-warning "non-compatible|abort" } */
+  i = ((int (*) (int)) foo1) (i);     /* { dg-bogus "non-compatible|abort" } */
+  (void) foo1 (i);                    /* { dg-bogus "non-compatible|abort" } */
+
+  d = ((double (*) (int)) foo2) (i);  /* { dg-warning "non-compatible|abort" } */
+  i = ((int (*) (double)) foo2) (d);  /* { dg-bogus "non-compatible|abort" } */
+  s = ((str_t (*) (int)) foo2) (i);   /* { dg-warning "non-compatible|abort" } */
+  ((void (*) (int)) foo2) (d);        /* { dg-warning "non-compatible|abort" } */
+  i = ((int (*) (int)) foo2) (i);     /* { dg-bogus "non-compatible|abort" } */
+  (void) foo2 (i);                    /* { dg-bogus "non-compatible|abort" } */
 }
 
 int foo1(int arg)
index a14823725daa5db792ad93735b0cd4eeb07b30e2..ecd0e4d84bfc74462207620a5a7bec808c2db840 100644 (file)
@@ -7,7 +7,7 @@ volatile int i;
 
 void foo()
 {
-  i = va_arg(v, char); /* { dg-warning "is promoted to|so you should" "char" } */
-  i = va_arg(v, short); /* { dg-warning "is promoted to" "short" } */
-  i = va_arg(v, float); /* { dg-warning "is promoted to" "float" } */
+  i = va_arg(v, char); /* { dg-warning "is promoted to|so you should|abort" "char" } */
+  i = va_arg(v, short); /* { dg-warning "is promoted to|abort" "short" } */
+  i = va_arg(v, float); /* { dg-warning "is promoted to|abort" "float" } */
 }