* 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
+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>
* gcc.dg/20000623-1.c: New test.
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
/* { dg-do compile } */
/* { dg-options "" } */
+#define def unused expansion
#define fail int fail
#assert abc (def)
/* { dg-options "-fno-show-column" } */
#assert /* { dg-error "without predicate" "assert w/o predicate" } */
-#assert % /* { dg-error "not an identifier" "assert punctuation" } */
-#assert 12 /* { dg-error "not an identifier" "assert number" } */
-#assert abc /* { dg-error "missing token-sequence" "assert w/o answer" } */
+#assert % /* { dg-error "an identifier" "assert punctuation" } */
+#assert 12 /* { dg-error "an identifier" "assert number" } */
+#assert abc /* { dg-error "missing" "assert w/o answer" } */
#if # /* { dg-error "without predicate" "test w/o predicate" } */
#endif
-#if #% /* { dg-error "not an identifier" "test punctuation" } */
+#if #% /* { dg-error "an identifier" "test punctuation" } */
#endif
-#if #12 /* { dg-error "not an identifier" "test number" } */
+#if #12 /* { dg-error "an identifier" "test number" } */
#endif
#if #abc
/* 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"
{
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 { \} } }
-*/
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
#ifndef CPP_MICC_H
#define CPP_MICC_H
-int a;
+int b;
#endif
+/* { dg-do preprocess }
+ { dg-options "-fno-show-column" } */
+
#pragma poison foo
foo /* { dg-error "foo" "use of foo" } */
#pragma poison foo2 foo3