diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-09-16 11:23:56 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-09-16 11:23:56 +0000 |
commit | 18a9d8ff7f06fbdc3ea635c8d55ea4023bad0dd8 (patch) | |
tree | b5637b92895c1d89a6ebec87518678bddc00a55f /gcc/cppmacro.c | |
parent | 27553bf3253625f6c3e56d36599b9e7cf188bfe8 (diff) | |
download | gcc-18a9d8ff7f06fbdc3ea635c8d55ea4023bad0dd8.zip gcc-18a9d8ff7f06fbdc3ea635c8d55ea4023bad0dd8.tar.gz gcc-18a9d8ff7f06fbdc3ea635c8d55ea4023bad0dd8.tar.bz2 |
cppmain.c (scan_translation_unit): Don't worry about putting a space after hashes.
* cppmain.c (scan_translation_unit): Don't worry about
putting a space after hashes.
* cpplib.c (directive_diagnostics): New.
(_cpp_handle_directive): Update to use directive_diagnostics.
(run_directive): Don't toggle prevent_expansion.
(do_line): Backup in case of the line extension.
* cpplib.h (cpp_lexer_pos): Remove.
* cppmacro.c (_cpp_create_definition): Precede a leading #
with whitespace.
* gcc.dg/cpp/line5.c: New testcase.
From-SVN: r45645
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r-- | gcc/cppmacro.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 5c64767..80c0154 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -1321,8 +1321,12 @@ _cpp_create_definition (pfile, node) /* Don't count the CPP_EOF. */ macro->count--; - /* Clear the whitespace flag from the leading token. */ - macro->expansion[0].flags &= ~PREV_WHITE; + /* Clear the whitespace flag from the leading token, but put a space + in front of a leading # which might be used to fake a directive. */ + if (macro->expansion[0].type == CPP_HASH) + macro->expansion[0].flags |= PREV_WHITE; + else + macro->expansion[0].flags &= ~PREV_WHITE; /* Implement the macro-defined-to-itself optimisation. */ macro->disabled = (macro->count == 1 && !macro->fun_like |