Commit b42115f7 by Zack Weinberg Committed by Zack Weinberg

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
parent 1a03d967
2000-06-25 Zack Weinberg <zack@wolery.cumb.org>
* 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.
2000-06-23 Geoffrey Keating <geoffk@cygnus.com> 2000-06-23 Geoffrey Keating <geoffk@cygnus.com>
* gcc.dg/20000623-1.c: New test. * gcc.dg/20000623-1.c: New test.
......
/* Regression test for paste corner cases. Distilled from
syscall stub logic in glibc. */
/* { dg-do run } */
#include <stdlib.h>
#define ENTRY(name) name##:
#define socket bind
int
main(void)
{
goto socket;
ENTRY(socket)
return 0;
}
/* More paste corner cases from glibc. */
/* { dg-do run } */
#define symbol_version(name, version) name##@##version
#define str(x) xstr(x)
#define xstr(x) #x
const char a[] = str(symbol_version(getrlimit, GLIBC_2.0));
const char b[] = str(getrlimit@GLIBC_2.0);
const char c[] = "getrlimit@GLIBC_2.0";
#include <stdlib.h>
#include <string.h>
int
main(void)
{
if(strcmp(a, b))
abort();
if(strcmp(b, c))
abort();
if(strcmp(c, a))
abort();
return 0;
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "" } */ /* { dg-options "" } */
#define def unused expansion
#define fail int fail #define fail int fail
#assert abc (def) #assert abc (def)
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
/* { dg-options "-fno-show-column" } */ /* { dg-options "-fno-show-column" } */
#assert /* { dg-error "without predicate" "assert w/o predicate" } */ #assert /* { dg-error "without predicate" "assert w/o predicate" } */
#assert % /* { dg-error "not an identifier" "assert punctuation" } */ #assert % /* { dg-error "an identifier" "assert punctuation" } */
#assert 12 /* { dg-error "not an identifier" "assert number" } */ #assert 12 /* { dg-error "an identifier" "assert number" } */
#assert abc /* { dg-error "missing token-sequence" "assert w/o answer" } */ #assert abc /* { dg-error "missing" "assert w/o answer" } */
#if # /* { dg-error "without predicate" "test w/o predicate" } */ #if # /* { dg-error "without predicate" "test w/o predicate" } */
#endif #endif
#if #% /* { dg-error "not an identifier" "test punctuation" } */ #if #% /* { dg-error "an identifier" "test punctuation" } */
#endif #endif
#if #12 /* { dg-error "not an identifier" "test number" } */ #if #12 /* { dg-error "an identifier" "test number" } */
#endif #endif
#if #abc #if #abc
......
/* Test "ignore redundant include" facility. /* Test "ignore redundant include" facility.
We must test with C and C++ comments outside the guard conditional; 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 } The disgusting regexp in the dg-error line, when stuck into
{ dg-options "" } */ 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"
#include "cpp-mic.h" #include "cpp-mic.h"
...@@ -26,15 +35,3 @@ main (void) ...@@ -26,15 +35,3 @@ main (void)
{ {
return a + b + c + d; 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 { \} } }
*/
/* Another test case for over-eager multiple include optimization.
This one distilled from glibc's setlocale.c and categories.def. */
/* { dg-do compile } */
#define X a
#include "cpp-mi3.def"
#undef X
#define X b
#include "cpp-mi3.def"
#undef X
int
main(void)
{
return a + b;
}
/* Another test case for over-eager multiple include optimization.
This one distilled from glibc's setlocale.c and categories.def.
The #ifdef block doesn't cover the entire file, so it must not be
taken for a reinclude guard. */
#ifndef NO_POSTLOAD
#define NO_POSTLOAD NULL
#endif
int X;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#ifndef CPP_MICC_H #ifndef CPP_MICC_H
#define CPP_MICC_H #define CPP_MICC_H
int a; int b;
#endif #endif
......
/* { dg-do preprocess }
{ dg-options "-fno-show-column" } */
#pragma poison foo #pragma poison foo
foo /* { dg-error "foo" "use of foo" } */ foo /* { dg-error "foo" "use of foo" } */
#pragma poison foo2 foo3 #pragma poison foo2 foo3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment