aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2001-05-10 00:07:23 +0000
committerZack Weinberg <zack@gcc.gnu.org>2001-05-10 00:07:23 +0000
commit6d4587f7359a633dc610f5d0ad95c023f672c5d9 (patch)
treedbbe9eb784b1862db1081f71d85145cf0a696198 /gcc/cppmain.c
parent6ebe3121aa8e693a53f4964bd9b058bf73cb54bf (diff)
downloadgcc-6d4587f7359a633dc610f5d0ad95c023f672c5d9.zip
gcc-6d4587f7359a633dc610f5d0ad95c023f672c5d9.tar.gz
gcc-6d4587f7359a633dc610f5d0ad95c023f672c5d9.tar.bz2
cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed.
* cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed. * cpplib.c (_cpp_handle_directive): If -fpreprocessed, accept IN_I directives only if the # is in column 1 and the directive name begins in column 2. * cppmain.c (scan_buffer): Insert a space between # and an identifier, when that identifier is a directive name. * tradcpp.c (struct file_buf): Add a pointer to the next entry in the header search path. (enum node_type): Add T_INCLUDE_NEXT. (directive_table): Add entry for include_next. (do_include_next): New function. (process_include): New routine, broken out of do_include. (finclude): Insert 'nhd' argument, to be copied into next_header_dir of the new buffer. (main): Adjust to match. * gsyslimits.h, limity.h: Un-indent #include_next. testsuite: * gcc.dg/cpp/direct2.c: New test. * gcc.dg/cpp/direct2s.c: New test. * gcc.c-torture/execute/920730-1t.c: #undef __GNUC__ at head. From-SVN: r41932
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index ceab9c9..db7f073 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -238,6 +238,13 @@ scan_buffer (pfile)
== AVOID_LPASTE
&& cpp_avoid_paste (pfile, &tokens[1 - index], token))
token->flags |= PREV_WHITE;
+ /* Special case '# <directive name>': insert a space between
+ the # and the token. This will prevent it from being
+ treated as a directive when this code is re-preprocessed.
+ XXX Should do this only at the beginning of a line, but how? */
+ else if (token->type == CPP_NAME && token->val.node->directive_index
+ && tokens[1 - index].type == CPP_HASH)
+ token->flags |= PREV_WHITE;
cpp_output_token (token, print.outf);
print.printed = 1;