Commit d1d9a6bd by Neil Booth Committed by Neil Booth

cppexp.c (parse_assertion): Supply extra argument to _cpp_init_toklist.

	* cppexp.c (parse_assertion): Supply extra argument to
	_cpp_init_toklist.
	* cpplib.c (do_assert, do_unassert): Similarly.
	* cpphash.h (_cpp_init_toklist) Update.
	(_cpp_expand_token_space): New.
	(DUMMY_TOKEN, NO_DUMMY_TOKEN): New.
	* cpplex.c (_cpp_init_toklist): New argument.
	(parse_string2): New argument multiline_ok.
	(spell_token): Take a const cpp_token *.
	(INIT_NAME): Replace with INIT_TOKEN_NAME.  Update tokens_used.
	(SPELL_ macros): Replace with enum.
	(expand_token_space): Replace with _cpp_expand_token_space.
	Take COUNT argument.
	(IS_DIRECTIVE): Update.
	(_cpp_lex_line): Update token structure before parsing number.
	Don't assume start at beginning of token list.
	(save_comment): Use INIT_TOKEN_NAME.

From-SVN: r34214
parent f45c9d95
2000-05-28 Neil Booth <NeilB@earthling.net>
* cppexp.c (parse_assertion): Supply extra argument to
_cpp_init_toklist.
* cpplib.c (do_assert, do_unassert): Similarly.
* cpphash.h (_cpp_init_toklist) Update.
(_cpp_expand_token_space): New.
(DUMMY_TOKEN, NO_DUMMY_TOKEN): New.
* cpplex.c (_cpp_init_toklist): New argument.
(parse_string2): New argument multiline_ok.
(spell_token): Take a const cpp_token *.
(INIT_NAME): Replace with INIT_TOKEN_NAME. Update tokens_used.
(SPELL_ macros): Replace with enum.
(expand_token_space): Replace with _cpp_expand_token_space.
Take COUNT argument.
(IS_DIRECTIVE): Update.
(_cpp_lex_line): Update token structure before parsing number.
Don't assume start at beginning of token list.
(save_comment): Use INIT_TOKEN_NAME.
2000-05-27 Zack Weinberg <zack@wolery.cumb.org> 2000-05-27 Zack Weinberg <zack@wolery.cumb.org>
* configure.in (stage1_warn_cflags): Add -Wstrict-prototypes * configure.in (stage1_warn_cflags): Add -Wstrict-prototypes
...@@ -423,7 +423,7 @@ parse_assertion (pfile) ...@@ -423,7 +423,7 @@ parse_assertion (pfile)
if (_cpp_get_directive_token (pfile) != CPP_OPEN_PAREN) if (_cpp_get_directive_token (pfile) != CPP_OPEN_PAREN)
CPP_ICE ("impossible token, expecting ( in parse_assertion"); CPP_ICE ("impossible token, expecting ( in parse_assertion");
_cpp_init_toklist (&query); _cpp_init_toklist (&query, NO_DUMMY_TOKEN);
specific = 1; specific = 1;
if (_cpp_scan_until (pfile, &query, CPP_CLOSE_PAREN) != CPP_CLOSE_PAREN) if (_cpp_scan_until (pfile, &query, CPP_CLOSE_PAREN) != CPP_CLOSE_PAREN)
SYNTAX_ERROR ("missing close paren on assertion answer"); SYNTAX_ERROR ("missing close paren on assertion answer");
......
...@@ -218,6 +218,10 @@ extern unsigned char _cpp_IStable[256]; ...@@ -218,6 +218,10 @@ extern unsigned char _cpp_IStable[256];
#define ADJACENT_TO_MARK(PFILE) \ #define ADJACENT_TO_MARK(PFILE) \
(CPP_BUFFER(PFILE)->cur - CPP_BUFFER(PFILE)->mark == 1) (CPP_BUFFER(PFILE)->cur - CPP_BUFFER(PFILE)->mark == 1)
/* Flags for _cpp_init_toklist. */
#define DUMMY_TOKEN 0
#define NO_DUMMY_TOKEN 1
/* In cpphash.c */ /* In cpphash.c */
extern unsigned int _cpp_calc_hash PARAMS ((const U_CHAR *, size_t)); extern unsigned int _cpp_calc_hash PARAMS ((const U_CHAR *, size_t));
extern HASHNODE *_cpp_lookup PARAMS ((cpp_reader *, extern HASHNODE *_cpp_lookup PARAMS ((cpp_reader *,
...@@ -260,7 +264,7 @@ extern enum cpp_ttype _cpp_get_define_token ...@@ -260,7 +264,7 @@ extern enum cpp_ttype _cpp_get_define_token
PARAMS ((cpp_reader *)); PARAMS ((cpp_reader *));
extern enum cpp_ttype _cpp_scan_until PARAMS ((cpp_reader *, cpp_toklist *, extern enum cpp_ttype _cpp_scan_until PARAMS ((cpp_reader *, cpp_toklist *,
enum cpp_ttype)); enum cpp_ttype));
extern void _cpp_init_toklist PARAMS ((cpp_toklist *)); extern void _cpp_init_toklist PARAMS ((cpp_toklist *, int));
extern void _cpp_clear_toklist PARAMS ((cpp_toklist *)); extern void _cpp_clear_toklist PARAMS ((cpp_toklist *));
extern void _cpp_free_toklist PARAMS ((cpp_toklist *)); extern void _cpp_free_toklist PARAMS ((cpp_toklist *));
extern void _cpp_slice_toklist PARAMS ((cpp_toklist *, extern void _cpp_slice_toklist PARAMS ((cpp_toklist *,
...@@ -271,7 +275,7 @@ extern int _cpp_equiv_tokens PARAMS ((const cpp_token *, ...@@ -271,7 +275,7 @@ extern int _cpp_equiv_tokens PARAMS ((const cpp_token *,
const cpp_token *)); const cpp_token *));
extern int _cpp_equiv_toklists PARAMS ((const cpp_toklist *, extern int _cpp_equiv_toklists PARAMS ((const cpp_toklist *,
const cpp_toklist *)); const cpp_toklist *));
extern void _cpp_expand_token_space PARAMS ((cpp_toklist *, unsigned int));
/* In cpplib.c */ /* In cpplib.c */
extern int _cpp_handle_directive PARAMS ((cpp_reader *)); extern int _cpp_handle_directive PARAMS ((cpp_reader *));
......
...@@ -54,7 +54,6 @@ static void output_line_command PARAMS ((cpp_reader *, cpp_printer *, ...@@ -54,7 +54,6 @@ static void output_line_command PARAMS ((cpp_reader *, cpp_printer *,
static void bump_column PARAMS ((cpp_printer *, unsigned int, static void bump_column PARAMS ((cpp_printer *, unsigned int,
unsigned int)); unsigned int));
static void expand_name_space PARAMS ((cpp_toklist *, unsigned int)); static void expand_name_space PARAMS ((cpp_toklist *, unsigned int));
static void expand_token_space PARAMS ((cpp_toklist *));
static void pedantic_whitespace PARAMS ((cpp_reader *, U_CHAR *, static void pedantic_whitespace PARAMS ((cpp_reader *, U_CHAR *,
unsigned int)); unsigned int));
...@@ -75,7 +74,7 @@ static void skip_whitespace PARAMS ((cpp_reader *, int)); ...@@ -75,7 +74,7 @@ static void skip_whitespace PARAMS ((cpp_reader *, int));
static void parse_name PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *)); static void parse_name PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *));
static void parse_number PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *)); static void parse_number PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *));
static void parse_string2 PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *, static void parse_string2 PARAMS ((cpp_reader *, cpp_toklist *, cpp_name *,
unsigned int)); unsigned int, int));
static int trigraph_ok PARAMS ((cpp_reader *, const unsigned char *)); static int trigraph_ok PARAMS ((cpp_reader *, const unsigned char *));
static void save_comment PARAMS ((cpp_toklist *, const unsigned char *, static void save_comment PARAMS ((cpp_toklist *, const unsigned char *,
unsigned int, unsigned int, unsigned int)); unsigned int, unsigned int, unsigned int));
...@@ -83,18 +82,18 @@ void _cpp_lex_line PARAMS ((cpp_reader *, cpp_toklist *)); ...@@ -83,18 +82,18 @@ void _cpp_lex_line PARAMS ((cpp_reader *, cpp_toklist *));
static void _cpp_output_list PARAMS ((cpp_reader *, cpp_toklist *)); static void _cpp_output_list PARAMS ((cpp_reader *, cpp_toklist *));
static unsigned char * spell_token PARAMS ((cpp_reader *, cpp_token *, static unsigned char * spell_token PARAMS ((cpp_reader *, const cpp_token *,
unsigned char *, int)); unsigned char *, int));
typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *, typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *,
cpp_token *)); cpp_token *));
/* Macros on a cpp_name. */ /* Macros on a cpp_name. */
#define INIT_NAME(list, name) \ #define INIT_TOKEN_NAME(list, token) \
do {(name).len = 0; \ do {(token)->val.name.len = 0; \
(name).text = (list)->namebuf + (list)->name_used;} while (0) (token)->val.name.text = (list)->namebuf + (list)->name_used; \
(list)->tokens_used = token - (list)->tokens + 1; \
#define IS_DIRECTIVE(list) (TOK_TYPE (list, 0) == CPP_HASH) } while (0)
/* Maybe put these in the ISTABLE eventually. */ /* Maybe put these in the ISTABLE eventually. */
#define IS_HSPACE(c) ((c) == ' ' || (c) == '\t') #define IS_HSPACE(c) ((c) == ' ' || (c) == '\t')
...@@ -128,11 +127,14 @@ typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *, ...@@ -128,11 +127,14 @@ typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *,
/* Order here matters. Those beyond SPELL_NONE store their spelling /* Order here matters. Those beyond SPELL_NONE store their spelling
in the token list, and it's length in the token->val.name.len. */ in the token list, and it's length in the token->val.name.len. */
#define SPELL_OPERATOR 0 enum spell_type
#define SPELL_CHAR 2 /* FIXME: revert order after transition. */ {
#define SPELL_NONE 1 SPELL_OPERATOR = 0,
#define SPELL_IDENT 3 SPELL_NONE,
#define SPELL_STRING 4 SPELL_CHAR, /* FIXME: revert order of NONE and CHAR after transition. */
SPELL_IDENT,
SPELL_STRING
};
#define T(e, s) {SPELL_OPERATOR, (const U_CHAR *) s}, #define T(e, s) {SPELL_OPERATOR, (const U_CHAR *) s},
#define I(e, s) {SPELL_IDENT, s}, #define I(e, s) {SPELL_IDENT, s},
...@@ -142,7 +144,7 @@ typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *, ...@@ -142,7 +144,7 @@ typedef unsigned int (* speller) PARAMS ((unsigned char *, cpp_toklist *,
static const struct token_spelling static const struct token_spelling
{ {
U_CHAR type; ENUM_BITFIELD(spell_type) type : CHAR_BIT;
const U_CHAR *spelling; const U_CHAR *spelling;
} token_spellings [N_TTYPES + 1] = {TTYPE_TABLE {0, 0} }; } token_spellings [N_TTYPES + 1] = {TTYPE_TABLE {0, 0} };
...@@ -518,7 +520,8 @@ cpp_file_buffer (pfile) ...@@ -518,7 +520,8 @@ cpp_file_buffer (pfile)
/* Token-buffer helper functions. */ /* Token-buffer helper functions. */
/* Expand a token list's string space. */ /* Expand a token list's string space. It is *vital* that
list->tokens_used is correct, to get pointer fix-up right. */
static void static void
expand_name_space (list, len) expand_name_space (list, len)
cpp_toklist *list; cpp_toklist *list;
...@@ -542,26 +545,44 @@ expand_name_space (list, len) ...@@ -542,26 +545,44 @@ expand_name_space (list, len)
} }
/* Expand the number of tokens in a list. */ /* Expand the number of tokens in a list. */
static void void
expand_token_space (list) _cpp_expand_token_space (list, count)
cpp_toklist *list; cpp_toklist *list;
unsigned int count;
{ {
list->tokens_cap *= 2; unsigned int n;
list->tokens_cap += count;
n = list->tokens_cap;
if (list->flags & LIST_OFFSET) if (list->flags & LIST_OFFSET)
list->tokens--; list->tokens--, n++;
list->tokens = (cpp_token *) list->tokens = (cpp_token *)
xrealloc (list->tokens, (list->tokens_cap + 1) * sizeof (cpp_token)); xrealloc (list->tokens, n * sizeof (cpp_token));
if (list->flags & LIST_OFFSET) if (list->flags & LIST_OFFSET)
list->tokens++; /* Skip the dummy. */ list->tokens++; /* Skip the dummy. */
} }
/* Initialize a token list. We allocate an extra token in front of /* Initialize a token list. If flags is DUMMY_TOKEN, we allocate
the token list, as this allows us to always peek at the previous an extra token in front of the token list, as this allows the lexer
token without worrying about underflowing the list. */ to always peek at the previous token without worrying about
underflowing the list, and some initial space. Otherwise, no
token- or name-space is allocated, and there is no dummy token. */
void void
_cpp_init_toklist (list) _cpp_init_toklist (list, flags)
cpp_toklist *list; cpp_toklist *list;
int flags;
{ {
/* We malloc zero bytes because we may want to realloc later, and
some old implementations don't like realloc-ing a null pointer. */
if (flags == NO_DUMMY_TOKEN)
{
list->tokens_cap = 0;
list->tokens = (cpp_token *) malloc (0);
list->name_cap = 0;
list->flags = 0;
}
else
{
/* Initialize token space. Put a dummy token before the start /* Initialize token space. Put a dummy token before the start
that will fail matches. */ that will fail matches. */
list->tokens_cap = 256; /* 4K's worth. */ list->tokens_cap = 256; /* 4K's worth. */
...@@ -572,13 +593,16 @@ _cpp_init_toklist (list) ...@@ -572,13 +593,16 @@ _cpp_init_toklist (list)
/* Initialize name space. */ /* Initialize name space. */
list->name_cap = 1024; list->name_cap = 1024;
list->flags = LIST_OFFSET;
}
/* Allocate name space. */
list->namebuf = (unsigned char *) xmalloc (list->name_cap); list->namebuf = (unsigned char *) xmalloc (list->name_cap);
/* Only create a comment space on demand. */ /* Only create a comment space on demand. */
list->comments_cap = 0; list->comments_cap = 0;
list->comments = 0; list->comments = 0;
list->flags = LIST_OFFSET;
_cpp_clear_toklist (list); _cpp_clear_toklist (list);
} }
...@@ -777,7 +801,7 @@ _cpp_scan_until (pfile, list, stop) ...@@ -777,7 +801,7 @@ _cpp_scan_until (pfile, list, stop)
continue; continue;
if (list->tokens_used >= list->tokens_cap) if (list->tokens_used >= list->tokens_cap)
expand_token_space (list); _cpp_expand_token_space (list, 256);
if (list->name_used + len >= list->name_cap) if (list->name_used + len >= list->name_cap)
expand_name_space (list, list->name_used + len + 1 - list->name_cap); expand_name_space (list, list->name_used + len + 1 - list->name_cap);
...@@ -2194,7 +2218,7 @@ _cpp_init_input_buffer (pfile) ...@@ -2194,7 +2218,7 @@ _cpp_init_input_buffer (pfile)
U_CHAR *tmp; U_CHAR *tmp;
init_chartab (); init_chartab ();
_cpp_init_toklist (&pfile->directbuf); _cpp_init_toklist (&pfile->directbuf, NO_DUMMY_TOKEN);
/* Determine the appropriate size for the input buffer. Normal C /* Determine the appropriate size for the input buffer. Normal C
source files are smaller than eight K. */ source files are smaller than eight K. */
...@@ -2702,11 +2726,12 @@ parse_number (pfile, list, name) ...@@ -2702,11 +2726,12 @@ parse_number (pfile, list, name)
allowed, except for within directives. */ allowed, except for within directives. */
static void static void
parse_string2 (pfile, list, name, terminator) parse_string2 (pfile, list, name, terminator, multiline_ok)
cpp_reader *pfile; cpp_reader *pfile;
cpp_toklist *list; cpp_toklist *list;
cpp_name *name; cpp_name *name;
unsigned int terminator; unsigned int terminator;
int multiline_ok;
{ {
cpp_buffer *buffer = pfile->buffer; cpp_buffer *buffer = pfile->buffer;
register const unsigned char *cur = buffer->cur; register const unsigned char *cur = buffer->cur;
...@@ -2766,7 +2791,7 @@ parse_string2 (pfile, list, name, terminator) ...@@ -2766,7 +2791,7 @@ parse_string2 (pfile, list, name, terminator)
extend over multiple lines. In Standard C, neither extend over multiple lines. In Standard C, neither
may strings. We accept multiline strings as an may strings. We accept multiline strings as an
extension, but not in directives. */ extension, but not in directives. */
if (terminator != '"' || IS_DIRECTIVE (list)) if (!multiline_ok)
goto unterminated; goto unterminated;
cur++; /* Move forwards again. */ cur++; /* Move forwards again. */
...@@ -2857,14 +2882,16 @@ save_comment (list, from, len, tok_no, type) ...@@ -2857,14 +2882,16 @@ save_comment (list, from, len, tok_no, type)
if (list->name_used + len > list->name_cap) if (list->name_used + len > list->name_cap)
expand_name_space (list, len); expand_name_space (list, len);
buffer = list->namebuf + list->name_used;
comment = &list->comments[list->comments_used++]; comment = &list->comments[list->comments_used++];
INIT_TOKEN_NAME (list, comment);
comment->type = CPP_COMMENT; comment->type = CPP_COMMENT;
comment->aux = tok_no; comment->aux = tok_no;
comment->val.name.len = len; comment->val.name.len = len;
comment->val.name.text = buffer;
buffer = list->namebuf + list->name_used;
list->name_used += len;
/* Copy the comment. */
if (type == '*') if (type == '*')
{ {
*buffer++ = '/'; *buffer++ = '/';
...@@ -2875,9 +2902,7 @@ save_comment (list, from, len, tok_no, type) ...@@ -2875,9 +2902,7 @@ save_comment (list, from, len, tok_no, type)
*buffer++ = type; *buffer++ = type;
*buffer++ = type; *buffer++ = type;
} }
memcpy (buffer, from, len - COMMENT_START_LEN); memcpy (buffer, from, len - COMMENT_START_LEN);
list->name_used += len;
} }
/* /*
...@@ -2894,6 +2919,8 @@ save_comment (list, from, len, tok_no, type) ...@@ -2894,6 +2919,8 @@ save_comment (list, from, len, tok_no, type)
* even when enabled. * even when enabled.
*/ */
#define IS_DIRECTIVE() (list->tokens[first_token].type == CPP_HASH)
void void
_cpp_lex_line (pfile, list) _cpp_lex_line (pfile, list)
cpp_reader *pfile; cpp_reader *pfile;
...@@ -2903,6 +2930,7 @@ _cpp_lex_line (pfile, list) ...@@ -2903,6 +2930,7 @@ _cpp_lex_line (pfile, list)
cpp_buffer *buffer = pfile->buffer; cpp_buffer *buffer = pfile->buffer;
register const unsigned char *cur = buffer->cur; register const unsigned char *cur = buffer->cur;
unsigned char flags = 0; unsigned char flags = 0;
unsigned int first_token = list->tokens_used;
pfile->col_adjust = 0; pfile->col_adjust = 0;
expanded: expanded:
...@@ -2920,7 +2948,7 @@ _cpp_lex_line (pfile, list) ...@@ -2920,7 +2948,7 @@ _cpp_lex_line (pfile, list)
{ {
/* Step back to get the null warning and tab correction. */ /* Step back to get the null warning and tab correction. */
buffer->cur = cur - 1; buffer->cur = cur - 1;
skip_whitespace (pfile, IS_DIRECTIVE (list)); skip_whitespace (pfile, IS_DIRECTIVE ());
cur = buffer->cur; cur = buffer->cur;
flags = PREV_WHITESPACE; flags = PREV_WHITESPACE;
...@@ -2938,27 +2966,31 @@ _cpp_lex_line (pfile, list) ...@@ -2938,27 +2966,31 @@ _cpp_lex_line (pfile, list)
{ {
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
cur--; /* Backup character. */
if (PREV_TOKEN_TYPE == CPP_DOT && IMMED_TOKEN ())
{ {
/* Prepend an immediately previous CPP_DOT token. */ int prev_dot;
cur--; /* Backup character. */
prev_dot = PREV_TOKEN_TYPE == CPP_DOT && IMMED_TOKEN ();
if (prev_dot)
cur_token--; cur_token--;
INIT_TOKEN_NAME (list, cur_token);
/* Prepend an immediately previous CPP_DOT token. */
if (prev_dot)
{
if (list->name_cap == list->name_used) if (list->name_cap == list->name_used)
auto_expand_name_space (list); auto_expand_name_space (list);
cur_token->val.name.len = 1; cur_token->val.name.len = 1;
cur_token->val.name.text = list->namebuf + list->name_used;
list->namebuf[list->name_used++] = '.'; list->namebuf[list->name_used++] = '.';
} }
else
INIT_NAME (list, cur_token->val.name);
continue_number: continue_number:
cur_token->type = CPP_NUMBER; /* Before parse_number. */
buffer->cur = cur; buffer->cur = cur;
parse_number (pfile, list, &cur_token->val.name); parse_number (pfile, list, &cur_token->val.name);
cur = buffer->cur; cur = buffer->cur;
cur_token++;
PUSH_TOKEN (CPP_NUMBER); /* Number not yet interpreted. */ }
break; break;
letter: letter:
...@@ -2974,7 +3006,7 @@ _cpp_lex_line (pfile, list) ...@@ -2974,7 +3006,7 @@ _cpp_lex_line (pfile, list)
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z': case 'Y': case 'Z':
cur--; /* Backup character. */ cur--; /* Backup character. */
INIT_NAME (list, cur_token->val.name); INIT_TOKEN_NAME (list, cur_token);
cur_token->type = CPP_NAME; /* Identifier, macro etc. */ cur_token->type = CPP_NAME; /* Identifier, macro etc. */
continue_name: continue_name:
...@@ -2983,7 +3015,7 @@ _cpp_lex_line (pfile, list) ...@@ -2983,7 +3015,7 @@ _cpp_lex_line (pfile, list)
cur = buffer->cur; cur = buffer->cur;
/* Find handler for newly created / extended directive. */ /* Find handler for newly created / extended directive. */
if (IS_DIRECTIVE (list) && cur_token == &list->tokens[1]) if (IS_DIRECTIVE () && cur_token == &list->tokens[first_token + 1])
_cpp_check_directive (list, cur_token); _cpp_check_directive (list, cur_token);
cur_token++; cur_token++;
break; break;
...@@ -3005,9 +3037,10 @@ _cpp_lex_line (pfile, list) ...@@ -3005,9 +3037,10 @@ _cpp_lex_line (pfile, list)
do_parse_string: do_parse_string:
/* Here c is one of ' " or >. */ /* Here c is one of ' " or >. */
INIT_NAME (list, cur_token->val.name); INIT_TOKEN_NAME (list, cur_token);
buffer->cur = cur; buffer->cur = cur;
parse_string2 (pfile, list, &cur_token->val.name, c); parse_string2 (pfile, list, &cur_token->val.name, c,
c == '"' && !IS_DIRECTIVE());
cur = buffer->cur; cur = buffer->cur;
cur_token++; cur_token++;
break; break;
...@@ -3325,14 +3358,14 @@ _cpp_lex_line (pfile, list) ...@@ -3325,14 +3358,14 @@ _cpp_lex_line (pfile, list)
if (cur_token == token_limit) if (cur_token == token_limit)
{ {
list->tokens_used = cur_token - list->tokens; list->tokens_used = cur_token - list->tokens;
expand_token_space (list); _cpp_expand_token_space (list, 256);
goto expanded; goto expanded;
} }
cur_token->type = CPP_EOF; cur_token->type = CPP_EOF;
cur_token->flags = flags; cur_token->flags = flags;
if (cur_token != &list->tokens[0]) if (cur_token != &list->tokens[first_token])
{ {
/* Next call back will get just a CPP_EOF. */ /* Next call back will get just a CPP_EOF. */
buffer->cur = cur; buffer->cur = cur;
...@@ -3369,7 +3402,7 @@ _cpp_lex_line (pfile, list) ...@@ -3369,7 +3402,7 @@ _cpp_lex_line (pfile, list)
static unsigned char * static unsigned char *
spell_token (pfile, token, buffer, whitespace) spell_token (pfile, token, buffer, whitespace)
cpp_reader *pfile; /* Would be nice to be rid of this... */ cpp_reader *pfile; /* Would be nice to be rid of this... */
cpp_token *token; const cpp_token *token;
unsigned char *buffer; unsigned char *buffer;
int whitespace; int whitespace;
{ {
...@@ -3438,7 +3471,7 @@ _cpp_lex_file (pfile) ...@@ -3438,7 +3471,7 @@ _cpp_lex_file (pfile)
init_trigraph_map (); init_trigraph_map ();
list = (cpp_toklist *) xmalloc (sizeof (cpp_toklist)); list = (cpp_toklist *) xmalloc (sizeof (cpp_toklist));
_cpp_init_toklist (list); _cpp_init_toklist (list, DUMMY_TOKEN);
for (;;) for (;;)
{ {
......
...@@ -1550,7 +1550,7 @@ do_assert (pfile) ...@@ -1550,7 +1550,7 @@ do_assert (pfile)
ERROR ("missing token-sequence in #assert"); ERROR ("missing token-sequence in #assert");
pred = (struct predicate *) xmalloc (sizeof (struct predicate)); pred = (struct predicate *) xmalloc (sizeof (struct predicate));
_cpp_init_toklist (&pred->answer); _cpp_init_toklist (&pred->answer, NO_DUMMY_TOKEN);
if (_cpp_scan_until (pfile, &pred->answer, CPP_CLOSE_PAREN) if (_cpp_scan_until (pfile, &pred->answer, CPP_CLOSE_PAREN)
!= CPP_CLOSE_PAREN) != CPP_CLOSE_PAREN)
...@@ -1626,7 +1626,7 @@ do_unassert (pfile) ...@@ -1626,7 +1626,7 @@ do_unassert (pfile)
if (type == CPP_OPEN_PAREN) if (type == CPP_OPEN_PAREN)
{ {
specific = 1; specific = 1;
_cpp_init_toklist (&ans); _cpp_init_toklist (&ans, NO_DUMMY_TOKEN);
if (_cpp_scan_until (pfile, &ans, CPP_CLOSE_PAREN) if (_cpp_scan_until (pfile, &ans, CPP_CLOSE_PAREN)
!= CPP_CLOSE_PAREN) != CPP_CLOSE_PAREN)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment