* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124952
138bc75d-0d04-0410-961f-
82ee72b054a4
+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>
@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
+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.
#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);
}
/* { 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" "" } */
}
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. */
}
/* { 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"
/* { 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"
/* { 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"
/* { 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"
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
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" } */
}
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 ();
}
/* 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 } */
/* 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 } */
#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 } */
/* { 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 *-*-* } } } */
/* { 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 *-*-* } } } */
# 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.
}
}
+# 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 ""