From b42115f711f164a05b1e9f3ca5565eb74ab3964b Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sun, 25 Jun 2000 23:31:02 +0000 Subject: 20000625-1.c, [...]: New tests. * gcc.dg/20000625-1.c, gcc.dg/20000625-2.c, gcc.dg/cpp-mi3.c: New tests. * gcc.dg/cpp-mi3.def: New file. * gcc.dg/cpp-as1.c: Also test that macro expansion does not occur inside assertions. * gcc.dg/cpp-as2.c: Make error regexps match either old or new lexer's error messages. * gcc.dg/cpp-mi.c: Use -H and examine the output, don't try to divine anything from the linemarkers. * gcc.dg/cpp-micc.h: Fix typo (declare int b, not int a); * gcc.dg/poison-1.c: Preprocess only; apply -fno-show-column. From-SVN: r34701 --- gcc/testsuite/gcc.dg/cpp-mi.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'gcc/testsuite/gcc.dg/cpp-mi.c') diff --git a/gcc/testsuite/gcc.dg/cpp-mi.c b/gcc/testsuite/gcc.dg/cpp-mi.c index f83a64d..3d05587 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi.c +++ b/gcc/testsuite/gcc.dg/cpp-mi.c @@ -1,9 +1,18 @@ /* Test "ignore redundant include" facility. We must test with C and C++ comments outside the guard conditional; - also, we test guarding with #ifndef and #if !defined. */ + also, we test guarding with #ifndef and #if !defined. + -H is used because cpp might confuse the issue by optimizing out + #line markers. This test only passes if each of the headers is + read exactly once. -/* { dg-do preprocess } - { dg-options "" } */ + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do compile } + { dg-options "-H" } + { dg-error "mic\.h\n\[^\n\]*micc\.h\n\[^\n\]*mind\.h\n\[^\n\]*mindp\.h\n\[^\n\]*mix\.h" "redundant include check" { target native } 0 } */ #include "cpp-mic.h" #include "cpp-mic.h" @@ -26,15 +35,3 @@ main (void) { return a + b + c + d; } - -/* - { dg-final { if ![file exists cpp-mi.i] { return } } } - - { dg-final { set tmp [grep cpp-mi.i {cpp-mi.*\.h} line] } } - { dg-final { # send_user "$tmp\n" } } - { dg-final { if [regexp "^{\[0-9\]+ cpp-mic\.h} {\[0-9\]+ cpp-micc\.h} {\[0-9\]+ cpp-mind\.h} {\[0-9\]+ cpp-mindp\.h} {\[0-9]+ cpp-mix\.h}$" $tmp] \{ } } - { dg-final { pass "cpp-mi.c: redundant include check" } } - { dg-final { \} else \{ } } - { dg-final { fail "cpp-mi.c: redundant include check" } } - { dg-final { \} } } -*/ -- cgit v1.1