1 /* Copyright 2007 Free Software Foundation, Inc.
2 Contributed by Ollie Wild <aaw@google.com>. */
4 /* { dg-do preprocess } */
5 /* { dg-options -fdirectives-only } */
7 /* Tests scan_translation_unit_directives_only()'s handling of corner cases. */
9 /* Ignore directives inside block comments...
10 #error directive inside block comment
13 // Escaped newline doesn't terminate line comment \
14 #error directive inside line comment
16 /* A comment canot start inside a string. */
17 const char *c1 = "/*";
18 #define NOT_IN_COMMENT
19 const char *c2 = "*/";
20 #ifndef NOT_IN_COMMENT
21 #error Comment started inside a string literal
24 /* Escaped newline handling. */
26 #error ignored escaped newline
31 #error escaped newline did not preserve beginning of line
34 /* Handles \\ properly at the end of a string. */
36 #error Missed string terminator.
39 /* Handles macro expansion in preprocessing directives. */
40 #define HEADER "dir-only-1.h"
43 #error Failed to include header.
51 #error Escaped newline breaks block comment initiator.
57 #define NOT_IN_COMMENT2
59 #ifndef NOT_IN_COMMENT2
60 #error Escaped newline breaks block comment terminator.
63 /* Test escaped newline inside character escape sequence. */
66 #error Missed string terminator
69 /* Block comments don't mask trailing preprocessing
70 directive. */ #define NOT_MASKED
72 #error Comment masks trailing directive.