Commit bb0067f2 by Neil Booth Committed by Neil Booth

assert_trad1.c, [...]: New tests.

        * gcc.dg/cpp/assert_trad1.c, assert_trad2.c, assert_trad3.c:
        New tests.

From-SVN: r38012
parent 7682e7bc
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.
......
/* 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
/* 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
/* 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
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