OSDN Git Service

* mi6.c, mi6a.h, mi6b.h, mi6c.h, mi6d.h, mi6e.h: New test.
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Sep 2001 12:02:22 +0000 (12:02 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 30 Sep 2001 12:02:22 +0000 (12:02 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45900 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/mi6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/mi6a.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/mi6b.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/mi6c.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/mi6d.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/mi6e.h [new file with mode: 0644]

index 0e8f92e..b4506b4 100644 (file)
@@ -1,5 +1,9 @@
 2001-09-30  Neil Booth  <neil@daikokuya.demon.co.uk>
 
+       * mi6.c, mi6a.h, mi6b.h, mi6c.h, mi6d.h, mi6e.h: New test.
+
+2001-09-30  Neil Booth  <neil@daikokuya.demon.co.uk>
+
        * gcc.dg/cpp/redef2.c: Add test.
 
 2001-09-27  Geoffrey Keating  <geoffk@redhat.com>
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6.c b/gcc/testsuite/gcc.dg/cpp/mi6.c
new file mode 100644 (file)
index 0000000..8895706
--- /dev/null
@@ -0,0 +1,44 @@
+/* Another test case for over-eager multiple include optimization,
+   where the leading "#if !defined" expression is obtained partially,
+   or wholly, from macros.  Neil Booth, 30 Sep 2001.  */
+
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Each include file should not be subject to MI optimisation, since
+   macro definitions can change.  Each header increments the variable
+   VAR if it is defined.
+
+   The first set of inclusions gets the headers into CPP's cache, but
+   does nothing since VAR is not defined.  The second set should each
+   increment VAR, since none of the initial set should have been
+   flagged as optimizable.  */
+
+#define EMPTY
+#define NOT !
+#define DEFINED defined (macro)
+#define IND ! defined (macro)
+
+#include "mi6a.h"
+#include "mi6b.h"
+#include "mi6c.h"
+#include "mi6d.h"
+#include "mi6e.h"
+
+#define VAR five
+
+int
+main(void)
+{
+  unsigned int five = 0;
+
+#include "mi6a.h"
+#include "mi6b.h"
+#include "mi6c.h"
+#include "mi6d.h"
+#include "mi6e.h"
+
+  if (five != 5)
+    abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6a.h b/gcc/testsuite/gcc.dg/cpp/mi6a.h
new file mode 100644 (file)
index 0000000..b11021c
--- /dev/null
@@ -0,0 +1,5 @@
+#if IND
+ #ifdef VAR
+   VAR++;
+ #endif
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6b.h b/gcc/testsuite/gcc.dg/cpp/mi6b.h
new file mode 100644 (file)
index 0000000..0d89ddf
--- /dev/null
@@ -0,0 +1,5 @@
+#if NOT defined (macro)
+ #ifdef VAR
+   VAR++;
+ #endif
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6c.h b/gcc/testsuite/gcc.dg/cpp/mi6c.h
new file mode 100644 (file)
index 0000000..d19cb54
--- /dev/null
@@ -0,0 +1,5 @@
+#if !DEFINED
+ #ifdef VAR
+   VAR++;
+ #endif
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6d.h b/gcc/testsuite/gcc.dg/cpp/mi6d.h
new file mode 100644 (file)
index 0000000..7cb4b6b
--- /dev/null
@@ -0,0 +1,5 @@
+#if EMPTY !defined (macro)
+ #ifdef VAR
+   VAR++;
+ #endif
+#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/mi6e.h b/gcc/testsuite/gcc.dg/cpp/mi6e.h
new file mode 100644 (file)
index 0000000..e60ca44
--- /dev/null
@@ -0,0 +1,5 @@
+#if !defined (macro) EMPTY
+ #ifdef VAR
+   VAR++;
+ #endif
+#endif