diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-20 09:00:53 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-20 09:00:53 +0000 |
commit | 1e0ef2fd0dfa941141148032c7f056f087c046f3 (patch) | |
tree | f6d06251cda814a30b50a23cf4acd25227570f5e /gcc/cpplib.c | |
parent | 3dcfd332b870a88ad960f4c40e6658e723b2292c (diff) | |
download | ppe42-gcc-1e0ef2fd0dfa941141148032c7f056f087c046f3.tar.gz ppe42-gcc-1e0ef2fd0dfa941141148032c7f056f087c046f3.zip |
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_block_comment, skip_line_comment,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Update to do more stepping back.
(trigraph_ok): Similarly. Rename trigraph_p.
(SAVE_STATE, RESTORE_STATE): Remove.
(BUFF_SIZE_UPPER_BOUND): Tweak. Add sanity check.
* cpplib.c (destringize): Rename destringize_and_run, and
call run_directive directly.
(_cpp_do__Pragma): Simplify.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 093c9dc806f..11c3b6c4aff 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -120,8 +120,7 @@ static void do_pragma_system_header PARAMS ((cpp_reader *)); static void do_pragma_dependency PARAMS ((cpp_reader *)); static const cpp_token *get_token_no_padding PARAMS ((cpp_reader *)); static const cpp_token *get__Pragma_string PARAMS ((cpp_reader *)); -static unsigned char *destringize PARAMS ((const cpp_string *, - unsigned int *)); +static void destringize_and_run PARAMS ((cpp_reader *, const cpp_string *)); static int parse_answer PARAMS ((cpp_reader *, struct answer **, int)); static cpp_hashnode *parse_assertion PARAMS ((cpp_reader *, struct answer **, int)); @@ -1149,17 +1148,17 @@ get__Pragma_string (pfile) return string; } -/* Returns a malloced buffer containing a destringized cpp_string by - removing the first \ of \" and \\ sequences. */ -static unsigned char * -destringize (in, len) +/* Destringize IN into a temporary buffer, by removing the first \ of + \" and \\ sequences, and process the result as a #pragma directive. */ +static void +destringize_and_run (pfile, in) + cpp_reader *pfile; const cpp_string *in; - unsigned int *len; { const unsigned char *src, *limit; - unsigned char *dest, *result; + char *dest, *result; - dest = result = (unsigned char *) xmalloc (in->len); + dest = result = alloca (in->len); for (src = in->text, limit = src + in->len; src < limit;) { /* We know there is a character following the backslash. */ @@ -1168,17 +1167,15 @@ destringize (in, len) *dest++ = *src++; } - *len = dest - result; - return result; + run_directive (pfile, T_PRAGMA, result, dest - result); } +/* Handle the _Pragma operator. */ void _cpp_do__Pragma (pfile) cpp_reader *pfile; { const cpp_token *string = get__Pragma_string (pfile); - unsigned char *buffer; - unsigned int len; if (!string) cpp_error (pfile, "_Pragma takes a parenthesized string literal"); @@ -1195,9 +1192,7 @@ _cpp_do__Pragma (pfile) Getting these correct line markers is a little tricky. */ unsigned int orig_line = pfile->line; - buffer = destringize (&string->val.str, &len); - run_directive (pfile, T_PRAGMA, (char *) buffer, len); - free ((PTR) buffer); + destringize_and_run (pfile, &string->val.str); pfile->line = orig_line; pfile->buffer->saved_flags = BOL; } |