aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@bitmover.com>1999-08-04 20:39:33 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-08-04 20:39:33 +0000
commit5d83f44baa49fbeadb9b5c35cb15e3f8a860802f (patch)
tree7dea07caa27d775c7af2d93e14dea09352a6d2e9 /gcc/cpplib.c
parent2a94e396c65da274a48a7d572d3e229dace92308 (diff)
downloadgcc-5d83f44baa49fbeadb9b5c35cb15e3f8a860802f.zip
gcc-5d83f44baa49fbeadb9b5c35cb15e3f8a860802f.tar.gz
gcc-5d83f44baa49fbeadb9b5c35cb15e3f8a860802f.tar.bz2
cpphash.c (macroexpand): Delete leading whitespace when arg is concatenated before.
Wed Aug 4 13:29:23 1999 Zack Weinberg <zack@bitmover.com> * cpphash.c (macroexpand): Delete leading whitespace when arg is concatenated before. (unsafe_chars): Correct test for whether + and - can extend a token. * cppinit.c (cpp_start_read): Do dependencies for -include/-imacros files also. * cpplib.c (cpp_scan_buffer): In no-output mode, don't bother tokenizing non-directive lines. (cpp_expand_to_buffer): Temporarily disable no-output mode. * cppmain.c: In no-output mode, just call cpp_scan_buffer for the input file. From-SVN: r28512
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 2718b08..ab2e203 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -731,15 +731,42 @@ cpp_scan_buffer (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = CPP_BUFFER (pfile);
- for (;;)
+ enum cpp_token token;
+ if (CPP_OPTIONS (pfile)->no_output)
{
- enum cpp_token token = cpp_get_token (pfile);
- if (token == CPP_EOF) /* Should not happen ... */
- break;
- if (token == CPP_POP && CPP_BUFFER (pfile) == buffer)
+ long old_written = CPP_WRITTEN (pfile);
+ /* In no-output mode, we can ignore everything but directives. */
+ for (;;)
{
- cpp_pop_buffer (pfile);
- break;
+ if (! pfile->only_seen_white)
+ skip_rest_of_line (pfile);
+ token = cpp_get_token (pfile);
+ if (token == CPP_EOF) /* Should not happen ... */
+ break;
+ if (token == CPP_POP && CPP_BUFFER (pfile) == buffer)
+ {
+ if (CPP_PREV_BUFFER (CPP_BUFFER (pfile))
+ != CPP_NULL_BUFFER (pfile))
+ cpp_pop_buffer (pfile);
+ break;
+ }
+ }
+ CPP_SET_WRITTEN (pfile, old_written);
+ }
+ else
+ {
+ for (;;)
+ {
+ token = cpp_get_token (pfile);
+ if (token == CPP_EOF) /* Should not happen ... */
+ break;
+ if (token == CPP_POP && CPP_BUFFER (pfile) == buffer)
+ {
+ if (CPP_PREV_BUFFER (CPP_BUFFER (pfile))
+ != CPP_NULL_BUFFER (pfile))
+ cpp_pop_buffer (pfile);
+ break;
+ }
}
}
}
@@ -760,13 +787,8 @@ cpp_expand_to_buffer (pfile, buf, length)
int length;
{
register cpp_buffer *ip;
-#if 0
- cpp_buffer obuf;
-#endif
U_CHAR *buf1;
-#if 0
- int odepth = indepth;
-#endif
+ int save_no_output;
if (length < 0)
{
@@ -784,12 +806,12 @@ cpp_expand_to_buffer (pfile, buf, length)
if (ip == NULL)
return;
ip->has_escapes = 1;
-#if 0
- ip->lineno = obuf.lineno = 1;
-#endif
/* Scan the input, create the output. */
+ save_no_output = CPP_OPTIONS (pfile)->no_output;
+ CPP_OPTIONS (pfile)->no_output = 0;
cpp_scan_buffer (pfile);
+ CPP_OPTIONS (pfile)->no_output = save_no_output;
CPP_NUL_TERMINATE (pfile);
}