blob: 2cb772d123300e156c1f3d7248b0bf7bedbc4fcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* Copyright (C) 2000 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options -pedantic } */
/* Tests general directive syntax, and directive error recovery. */
/* Test directive name is not expanded. */
#define foo define
#foo EMPTY /* { dg-error "invalid" } */
/* Test # must be first on line. */
EMPTY #define bar
#ifdef bar
#error bar is defined
#endif
/* Test form feed and vertical tab warn pedantically, see 6.10
paragraph 5. Tab is OK. */
#define something /* { dg-warning "form feed" } */
#define something_else /* { dg-warning "vertical tab" } */
#define some thing /* Tab OK, as is form feed before #. */
/* Our friend the null directive OK? */
#
/* Check that directives always start a line, even if in middle of
macro expansion. */
#define func(x) x
func (2 /* { dg-error "unterminated" "" { target *-*-* } 32 } */
#define foobar /* { dg-error "directives may not" } */
/* For tidiness, I think the directive should still be processed
above. Certainly, continuing to try to find the closing ')' can
lead to some really confusing error messages. Hence this test. */
#ifndef foobar
#error It is nice if the directive is processed!
#endif
/* Check newlines end directives, even in function-like macro
invocations. 6.10 paragraph 1.
Note that the #if is still treated as a conditional, so there
should be no errors about #endif without #if. */
#if func ( /* { dg-error "unterminated argument" } */
#endif
|