gcc/
authorJanis Johnson <janis187@us.ibm.com>
Tue, 22 May 2007 18:01:12 +0000 (18:01 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Tue, 22 May 2007 18:01:12 +0000 (18:01 +0000)
* doc/sourcebuild.texi (Test Directives) Add dg-message.
gcc/testsuite/
* lib/gcc-dg.exp(process_message): New proc.
(dg-message): New test directive.
* gcc.dg/always_inline.c: Use dg-message.
* gcc.dg/always_inline2.c: Ditto.
* gcc.dg/always_inline3.c: Ditto.
* gcc.dg/invalid-call-1.c: Ditto.
* gcc.dg/pr17506.c: Ditto.
* gcc.dg/simd-5.c: Ditto.
* gcc.dg/simd-6.c: Ditto.
* gcc.dg/va-arg-2.c: Ditto.
* gcc.dg/cpp/syshdr.c: Ditto.
* gcc.dg/cpp/unc4.c: Ditto.
* gcc.dg/cpp/trad/mi1.c: Ditto.
* gcc.dg/cpp/trad/mi5.c: Ditto.
* gcc.dg/cpp/trad/mi7.c: Ditto.
* gcc.test-framework/dg-outexistsnot-exp-P.c: Ditto.
* gcc.test-framework/dg-outexists-exp-F.c: Ditto.
* gcc.test-framework/test-framework.awk: Special-case outexists
tests.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>
From-SVN: r124952

20 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/always_inline.c
gcc/testsuite/gcc.dg/always_inline2.c
gcc/testsuite/gcc.dg/always_inline3.c
gcc/testsuite/gcc.dg/cpp/syshdr.c
gcc/testsuite/gcc.dg/cpp/trad/mi1.c
gcc/testsuite/gcc.dg/cpp/trad/mi5.c
gcc/testsuite/gcc.dg/cpp/trad/mi7.c
gcc/testsuite/gcc.dg/cpp/unc4.c
gcc/testsuite/gcc.dg/invalid-call-1.c
gcc/testsuite/gcc.dg/pr17506.c
gcc/testsuite/gcc.dg/simd-5.c
gcc/testsuite/gcc.dg/simd-6.c
gcc/testsuite/gcc.dg/va-arg-2.c
gcc/testsuite/gcc.test-framework/dg-outexists-exp-F.c
gcc/testsuite/gcc.test-framework/dg-outexistsnot-exp-P.c
gcc/testsuite/gcc.test-framework/test-framework.awk
gcc/testsuite/lib/gcc-dg.exp

index 160684d..7d46605 100644 (file)
@@ -1,3 +1,7 @@
+2007-05-22  Janis Johnson  <janis187@us.ibm.com>
+
+       * doc/sourcebuild.texi (Test Directives) Add dg-message.
+
 2007-05-22  H.J. Lu  <hongjiu.lu@intel.com>
            Richard Henderson  <rth@redhat.com>
 
index 682ef94..780653a 100644 (file)
@@ -1016,6 +1016,12 @@ message is not matched by @var{regexp} then the check fails and
 @var{comment} is included in the @code{FAIL} message.  The check does
 not look for the string @samp{"warning"} unless it is part of @var{regexp}.
 
+@item @{ dg-message @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
+The line is expected to get a message other than an error or warning.
+If there is no message for that line or if the text of that message is
+not matched by @var{regexp} then the check fails and @var{comment} is
+included in the @code{FAIL} message.
+
 @item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] @}]] @}
 This DejaGnu directive appears on a source line that should not get a
 message matching @var{regexp}, or else specifies the source line
index a74038d..5f694ac 100644 (file)
@@ -1,3 +1,26 @@
+2007-05-22  Janis Johnson  <janis187@us.ibm.com>
+           Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       * lib/gcc-dg.exp(process_message): New proc.
+       (dg-message): New test directive.
+       * gcc.dg/always_inline.c: Use dg-message.
+       * gcc.dg/always_inline2.c: Ditto.
+       * gcc.dg/always_inline3.c: Ditto.
+       * gcc.dg/invalid-call-1.c: Ditto.
+       * gcc.dg/pr17506.c: Ditto.
+       * gcc.dg/simd-5.c: Ditto.
+       * gcc.dg/simd-6.c: Ditto.
+       * gcc.dg/va-arg-2.c: Ditto.
+       * gcc.dg/cpp/syshdr.c: Ditto.
+       * gcc.dg/cpp/unc4.c: Ditto.
+       * gcc.dg/cpp/trad/mi1.c: Ditto.
+       * gcc.dg/cpp/trad/mi5.c: Ditto.
+       * gcc.dg/cpp/trad/mi7.c: Ditto.
+       * gcc.test-framework/dg-outexistsnot-exp-P.c: Ditto.
+       * gcc.test-framework/dg-outexists-exp-F.c: Ditto.
+       * gcc.test-framework/test-framework.awk: Special-case outexists
+       tests.
+
 2007-05-22  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.dg/i386-cpuid.h (bit_SSE4_1): New.
index 2177f64..1c04ac8 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdarg.h>
 inline __attribute__ ((always_inline)) void
 e(int t, ...)
-{                              /* { dg-error "variable argument" "" } */
+{                              /* { dg-message "variable argument" "" } */
   va_list q;
   va_start (q, t);
 }
index fa6528d..7e488eb 100644 (file)
@@ -1,8 +1,8 @@
 /* { dg-do compile } */
 /* { dg-options "-Winline -O2" } */
-inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" "" } */
+inline __attribute__ ((always_inline)) void t(void); /* { dg-message "body not available" "" } */
 void
 q(void)
 {
-  t();                                 /* { dg-error "called from here" "" } */
+  t();                                 /* { dg-message "called from here" "" } */
 }
index 7b575d7..369bb87 100644 (file)
@@ -3,9 +3,9 @@
 int do_something_evil (void);
 inline __attribute__ ((always_inline)) void
 q2(void)
-{                              /* { dg-error "recursive" "" } */
+{                              /* { dg-message "recursive" "" } */
   if (do_something_evil ())
     return;
-  q2();                        /* { dg-error "called from here" "" } */
+  q2();                        /* { dg-message "called from here" "" } */
   q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion.  */
 }
index f36df3e..7513773 100644 (file)
@@ -8,5 +8,5 @@
 /* { dg-do preprocess } */
 /* { dg-error "include_next" "good error" { target *-*-* } 4 } */
 
-#include "syshdr1.h"  /* { dg-error "" "In file included from:" } */
+#include "syshdr1.h"  /* { dg-message "" "In file included from:" } */
 #include "syshdr2.h"
index deb9929..4004d21 100644 (file)
@@ -13,7 +13,7 @@
 
 /* { dg-do compile }
    { dg-options "-H -traditional-cpp" }
-   { dg-error "mi1c\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */
+   { dg-message "mi1c\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */
 
 #include "mi1c.h"
 #include "mi1c.h"
index fe3c8d2..ece38b5 100644 (file)
@@ -7,7 +7,7 @@
 
 /* { dg-do preprocess }
    { dg-options "-H -C -traditional-cpp" }
-   { dg-error "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */
+   { dg-message "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */
 
 #include "mi1c.h"
 #include "mi1c.h"
index 8a079d9..d980586 100644 (file)
@@ -11,7 +11,7 @@
 
 /* { dg-do preprocess }
    { dg-options "-H -traditional-cpp" }
-   { dg-error "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */
+   { dg-message "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */
 
 #include "mi7a.h"
 #include "mi7a.h"
index 84ea6e4..758e5bb 100644 (file)
@@ -32,7 +32,7 @@ ignored
    message.  */
 #define FOO
 #ifdef FOO  /* { dg-bogus "unterminated" "nested unterm" } */
-#include "unc1.c"  /* { dg-error "" } */
+#include "unc1.c"  /* { dg-message "file included from" "" { target *-*-* } 0 } */
 #endif
 
 /* dg.exp doesn't read the included files for tags, so we have to
index 4126b5a..2a7d372 100644 (file)
@@ -13,5 +13,5 @@ char* cptr;
 void foo()
 {
   cptr = mar(6);
-  ((char *(*)(void *,int (*)(void *,unsigned char **),char**))((fp)bar))(0,0,(void*)(0)); /* { dg-warning "" "non-compatible type" } */
+  ((char *(*)(void *,int (*)(void *,unsigned char **),char**))((fp)bar))(0,0,(void*)(0)); /* { dg-message "" "non-compatible type" } */
 }
index 44fb90c..7cca746 100644 (file)
@@ -18,7 +18,7 @@ void baz (void);
 void
 bar (void)
 {
-  int j; /* { dg-error "note: 'j' was declared here" } */
+  int j; /* { dg-message "note: 'j' was declared here" } */
   for (; foo (j); ++j)
     baz ();
 }
index 37df370..0721625 100644 (file)
@@ -4,4 +4,5 @@
 /* Ensure that we don't need a typedef to initialize a vector type.  */
 #define vector __attribute__ ((vector_size (8)))
 vector char x = (vector char) {1,2,3,4,5,6,7,8}; /* { dg-bogus "initializer" } */
-vector char y = (vector short) {1,2,3,4}; /* { dg-error "use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts.*incompatible types in initialization" } */
+vector char y = (vector short) {1,2,3,4}; /* { dg-message "use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
+  /* { dg-error "incompatible types in initialization" "" { target *-*-* } 7 } */
index a88f13f..386f02e 100644 (file)
@@ -4,4 +4,5 @@
 /* Ensure that we don't need a typedef to initialize a vector type.  */
 #define vector __attribute__ ((vector_size (8)))
 vector char x = (vector char) {1,2,3,4,5,6,7,8}; /* { dg-bogus "initializer" } */
-vector char y = (vector short) {1,2,3,4}; /* { dg-error "use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts.*incompatible types in initialization" } */
+vector char y = (vector short) {1,2,3,4}; /* { dg-message "use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
+       /* { dg-message "incompatible types in initialization" "" { target *-*-* } 7 } */
index 2e2849c..597bf98 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <varargs.h>  /* { dg-bogus "varargs.h" "missing file" } */
 
-/* { dg-error "" "In file included from" { target *-*-* } 6 } */
+/* { dg-message "" "In file included from" { target *-*-* } 6 } */
 /* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */
 /* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */
 
index d53a2f5..34968a5 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-Wunused-value -Werror" } */
 
-int main (void) { 0; }   /* { dg-warning "no effect" } */
+int main (void) { 0; }   /* { dg-error "no effect" } */
 
-/* { dg-warning "warnings being treated as errors" "" { target *-*-* } 0 } */
+/* { dg-message "warnings being treated as errors" "" { target *-*-* } 0 } */
 /* { dg-final { output-exists { target *-*-* } } } */
index 8d6bf97..0026006 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-Wunused-value -Werror" } */
 
-int main (void) { 0; }   /* { dg-warning "no effect" } */
+int main (void) { 0; }   /* { dg-error "no effect" } */
 
-/* { dg-warning "warnings being treated as errors" "" { target *-*-* } 0 } */
+/* { dg-message "warnings being treated as errors" "" { target *-*-* } 0 } */
 /* { dg-final { output-exists-not { target *-*-* } } } */
index daefa0c..043e0c6 100644 (file)
@@ -46,6 +46,7 @@ BEGIN                 { skip = 1; passes = 0; fails = 0; }
 # ignore compile step, tests for warnings for output-exists[-not] tests.
 /dg-outexists.*\(test for excess errors)/ { ignore(); next }
 /dg-outexists.*\(test for warnings/ { ignore(); next }
+/dg-outexists.*\(test for errors/ { ignore(); next }
 # The other dox tests pass the compile step; ignore that message.
 /^PASS.*dox.*\(test for excess errors\)/ { ignore(); next }
 # The sf tests pass the compile step; ignore that message.
index 98be07f..d12ff52 100644 (file)
@@ -559,4 +559,40 @@ if { [info procs saved-dg-test] == [list] } {
     }
 }
 
+# Modify the regular expression saved by a DejaGnu message directive to
+# include a prefix and to force the expression to match a single line.
+# MSGPROC is the procedure to call.
+# MSGPREFIX is the prefix to prepend.
+# DGARGS is the original argument list.
+
+proc process-message { msgproc msgprefix dgargs } {
+    upvar dg-messages dg-messages
+
+    # Process the dg- directive, including adding the regular expression
+    # to the new message entry in dg-messages.
+    set msgcnt [llength ${dg-messages}]
+    catch { eval $msgproc $dgargs }
+
+    # If the target expression wasn't satisfied there is no new message.
+    if { [llength ${dg-messages}] == $msgcnt } {
+       return;
+    }
+
+    # Prepend the message prefix to the regular expression and make
+    # it match a single line.
+    set newentry [lindex ${dg-messages} end]
+    set expmsg [lindex $newentry 2]
+    set expmsg "$msgprefix\[^\n]*$expmsg"
+    set newentry [lreplace $newentry 2 2 $expmsg]
+    set dg-messages [lreplace ${dg-messages} end end $newentry]
+    verbose "process-message:\n${dg-messages}" 2
+}
+
+# Look for messages that don't have standard prefixes.
+
+proc dg-message { args } {
+    upvar dg-messages dg-messages
+    process-message dg-warning "" $args
+}
+
 set additional_prunes ""