This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Digraphs test cases


This patch adds testcases for digraph support with different -std
options to gcc.dg.

A separate PR will be submitted for the XFAIL in c90-digraph-1.c.

2000-06-27  Joseph S. Myers  <jsm28@cam.ac.uk>

	* gcc.dg/c90-digraph-1.c, gcc.dg/c94-digraph.c,
	gcc.dg/c99-digraph.c: New tests.

diff -ruN gcc.dg.old/c90-digraph-1.c gcc.dg/c90-digraph-1.c
--- gcc.dg.old/c90-digraph-1.c	Thu Jan  1 00:00:00 1970
+++ gcc.dg/c90-digraph-1.c	Tue Jun 27 12:24:19 2000
@@ -0,0 +1,24 @@
+/* Test for recognition of digraphs: should be recognised in C94 and C99
+   mode, but not in C90 mode.  Also check correct stringizing.
+*/
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-do run { xfail *-*-* } } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+#define foo(p, q) str(p %:%: q)
+
+extern void abort (void);
+extern int strcmp (const char *, const char *);
+
+int
+main (void)
+{
+  const char *t = foo (1, 2);
+  const char *u = str (<:);
+  if (strcmp (t, "1 %:%: 2") || strcmp (u, "<:"))
+    abort ();
+  else
+    return 0;
+}
diff -ruN gcc.dg.old/c94-digraph-1.c gcc.dg/c94-digraph-1.c
--- gcc.dg.old/c94-digraph-1.c	Thu Jan  1 00:00:00 1970
+++ gcc.dg/c94-digraph-1.c	Tue Jun 27 12:24:19 2000
@@ -0,0 +1,24 @@
+/* Test for recognition of digraphs: should be recognised in C94 and C99
+   mode, but not in C90 mode.  Also check correct stringizing.
+*/
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-do run } */
+/* { dg-options "-std=iso9899:199409 -pedantic-errors" } */
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+#define foo(p, q) str(p %:%: q)
+
+extern void abort (void);
+extern int strcmp (const char *, const char *);
+
+int
+main (void)
+{
+  const char *t = foo (1, 2);
+  const char *u = str (<:);
+  if (strcmp (t, "12") || strcmp (u, "<:"))
+    abort ();
+  else
+    return 0;
+}
diff -ruN gcc.dg.old/c99-digraph-1.c gcc.dg/c99-digraph-1.c
--- gcc.dg.old/c99-digraph-1.c	Thu Jan  1 00:00:00 1970
+++ gcc.dg/c99-digraph-1.c	Tue Jun 27 12:24:19 2000
@@ -0,0 +1,24 @@
+/* Test for recognition of digraphs: should be recognised in C94 and C99
+   mode, but not in C90 mode.  Also check correct stringizing.
+*/
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-do run } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+#define foo(p, q) str(p %:%: q)
+
+extern void abort (void);
+extern int strcmp (const char *, const char *);
+
+int
+main (void)
+{
+  const char *t = foo (1, 2);
+  const char *u = str (<:);
+  if (strcmp (t, "12") || strcmp (u, "<:"))
+    abort ();
+  else
+    return 0;
+}

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]