summaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-16 11:23:56 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-09-16 11:23:56 +0000
commitd0d481d78be7b2adf26289b40b5c53abcc9f7206 (patch)
treeb5637b92895c1d89a6ebec87518678bddc00a55f /gcc/cppmacro.c
parent97ae6ad55d84e55171435b6690fede9b881ea807 (diff)
downloadgcc-d0d481d78be7b2adf26289b40b5c53abcc9f7206.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45645 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index 5c64767b656..80c01541cef 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