From: Janis Johnson Date: Tue, 22 May 2007 18:01:12 +0000 (+0000) Subject: gcc/ X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba2f32a925d3af9152710520c77de11c2987afd8;p=platform%2Fupstream%2Fgcc.git gcc/ * 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 From-SVN: r124952 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 160684d..7d46605 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2007-05-22 Janis Johnson + + * doc/sourcebuild.texi (Test Directives) Add dg-message. + 2007-05-22 H.J. Lu Richard Henderson diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 682ef94..780653a 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a74038d..5f694ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,26 @@ +2007-05-22 Janis Johnson + Manuel Lopez-Ibanez + + * 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 * gcc.dg/i386-cpuid.h (bit_SSE4_1): New. diff --git a/gcc/testsuite/gcc.dg/always_inline.c b/gcc/testsuite/gcc.dg/always_inline.c index 2177f64..1c04ac8 100644 --- a/gcc/testsuite/gcc.dg/always_inline.c +++ b/gcc/testsuite/gcc.dg/always_inline.c @@ -3,7 +3,7 @@ #include inline __attribute__ ((always_inline)) void e(int t, ...) -{ /* { dg-error "variable argument" "" } */ +{ /* { dg-message "variable argument" "" } */ va_list q; va_start (q, t); } diff --git a/gcc/testsuite/gcc.dg/always_inline2.c b/gcc/testsuite/gcc.dg/always_inline2.c index fa6528d..7e488eb 100644 --- a/gcc/testsuite/gcc.dg/always_inline2.c +++ b/gcc/testsuite/gcc.dg/always_inline2.c @@ -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" "" } */ } diff --git a/gcc/testsuite/gcc.dg/always_inline3.c b/gcc/testsuite/gcc.dg/always_inline3.c index 7b575d7..369bb87 100644 --- a/gcc/testsuite/gcc.dg/always_inline3.c +++ b/gcc/testsuite/gcc.dg/always_inline3.c @@ -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. */ } diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr.c b/gcc/testsuite/gcc.dg/cpp/syshdr.c index f36df3e..7513773 100644 --- a/gcc/testsuite/gcc.dg/cpp/syshdr.c +++ b/gcc/testsuite/gcc.dg/cpp/syshdr.c @@ -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" diff --git a/gcc/testsuite/gcc.dg/cpp/trad/mi1.c b/gcc/testsuite/gcc.dg/cpp/trad/mi1.c index deb9929..4004d21 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/mi1.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/mi1.c @@ -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" diff --git a/gcc/testsuite/gcc.dg/cpp/trad/mi5.c b/gcc/testsuite/gcc.dg/cpp/trad/mi5.c index fe3c8d2..ece38b5 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/mi5.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/mi5.c @@ -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" diff --git a/gcc/testsuite/gcc.dg/cpp/trad/mi7.c b/gcc/testsuite/gcc.dg/cpp/trad/mi7.c index 8a079d9..d980586 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/mi7.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/mi7.c @@ -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" diff --git a/gcc/testsuite/gcc.dg/cpp/unc4.c b/gcc/testsuite/gcc.dg/cpp/unc4.c index 84ea6e4..758e5bb 100644 --- a/gcc/testsuite/gcc.dg/cpp/unc4.c +++ b/gcc/testsuite/gcc.dg/cpp/unc4.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/invalid-call-1.c b/gcc/testsuite/gcc.dg/invalid-call-1.c index 4126b5a..2a7d372 100644 --- a/gcc/testsuite/gcc.dg/invalid-call-1.c +++ b/gcc/testsuite/gcc.dg/invalid-call-1.c @@ -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" } */ } diff --git a/gcc/testsuite/gcc.dg/pr17506.c b/gcc/testsuite/gcc.dg/pr17506.c index 44fb90c..7cca746 100644 --- a/gcc/testsuite/gcc.dg/pr17506.c +++ b/gcc/testsuite/gcc.dg/pr17506.c @@ -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 (); } diff --git a/gcc/testsuite/gcc.dg/simd-5.c b/gcc/testsuite/gcc.dg/simd-5.c index 37df370..0721625 100644 --- a/gcc/testsuite/gcc.dg/simd-5.c +++ b/gcc/testsuite/gcc.dg/simd-5.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/simd-6.c b/gcc/testsuite/gcc.dg/simd-6.c index a88f13f..386f02e 100644 --- a/gcc/testsuite/gcc.dg/simd-6.c +++ b/gcc/testsuite/gcc.dg/simd-6.c @@ -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 } */ diff --git a/gcc/testsuite/gcc.dg/va-arg-2.c b/gcc/testsuite/gcc.dg/va-arg-2.c index 2e2849c..597bf98 100644 --- a/gcc/testsuite/gcc.dg/va-arg-2.c +++ b/gcc/testsuite/gcc.dg/va-arg-2.c @@ -5,7 +5,7 @@ #include /* { 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 } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-outexists-exp-F.c b/gcc/testsuite/gcc.test-framework/dg-outexists-exp-F.c index d53a2f5..34968a5 100644 --- a/gcc/testsuite/gcc.test-framework/dg-outexists-exp-F.c +++ b/gcc/testsuite/gcc.test-framework/dg-outexists-exp-F.c @@ -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 *-*-* } } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-outexistsnot-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-outexistsnot-exp-P.c index 8d6bf97..0026006 100644 --- a/gcc/testsuite/gcc.test-framework/dg-outexistsnot-exp-P.c +++ b/gcc/testsuite/gcc.test-framework/dg-outexistsnot-exp-P.c @@ -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 *-*-* } } } */ diff --git a/gcc/testsuite/gcc.test-framework/test-framework.awk b/gcc/testsuite/gcc.test-framework/test-framework.awk index daefa0c..043e0c6 100644 --- a/gcc/testsuite/gcc.test-framework/test-framework.awk +++ b/gcc/testsuite/gcc.test-framework/test-framework.awk @@ -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. diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 98be07f..d12ff52 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -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 ""