+2000-12-04 Neil Booth <neilb@earthling.net>
+
+ * gcc.dg/cpp/assert_trad1.c, assert_trad2.c, assert_trad3.c:
+ New tests.
+
2000-12-03 Kaveh R. Ghazi <ghazi@teal.rutgers.edu>
* gcc.c-torture/execute/string-opt-11.c: Add more strspn checks.
--- /dev/null
+/* Basic tests of the #assert preprocessor extension. */
+/* { dg-do compile } */
+/* { dg-options "-traditional" } */
+
+/* #define def unused expansion */ /* tradcpp can't handle macros in answers. */
+#define fail int failit
+
+#assert abc (def)
+#assert abc (ghi)
+#assert abc (jkl)
+#assert space ( s p a c e )
+
+/* Basic: */
+#if !#abc (def) || !#abc (ghi) || !#abc (jkl)
+fail
+#endif
+
+/* any answer for #abc */
+#if !#abc
+fail
+#endif
+
+/* internal whitespace is collapsed,
+ external whitespace is deleted */
+#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space)
+fail
+#endif
+
+/* removing assertions */
+#unassert abc (jkl)
+#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl)
+fail
+#endif
+
+#unassert abc
+#if #abc || #abc (def) || #abc (ghi) || #abc (jkl)
+fail
+#endif
+
+int gobble
+
+/* make sure it can succeed too.
+ also check space before open paren isn't significant */
+#if #space(s p a c e)
+;
+#endif
--- /dev/null
+/* Malformed assertion tests. */
+/* { dg-do preprocess } */
+/* { dg-options "-traditional" } */
+
+#assert /* { dg-error "without predicate" "assert w/o predicate" } */
+#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 "an identifier" "test punctuation" } */
+#endif /* { dg-error "parse error" "" { target *-*-* } 13 } */
+
+#if #12 /* { dg-error "an identifier" "test number" } */
+#endif /* { dg-error "parse error" "" { target *-*-* } 16 } */
+
+#if #abc
+#error /* { dg-bogus "error" "test w/o answer" } */
+#endif
+
+#if #abc[def] /* { dg-error "parse error" "bad syntax" } */
+#endif
--- /dev/null
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno -traditional" } */
+
+/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */
+
+#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno)
+#error Command line -A assertions
+#endif