Commit cbcff6df by Neil Booth Committed by Neil Booth

cpphash.h (CPP_RESERVE, [...]): Delete.

	* cpphash.h (CPP_RESERVE, CPP_PUTS_Q, CPP_PUTS, CPP_PUTC_Q,
	CPP_PUTC, DUMMY_TOKEN, NO_DUMMY_TOKEN): Delete.
	* cpplex.c (_cpp_expand_token_space, _cpp_init_toklist,
	_cpp_free_toklist): No need to worry about extra dummy token
	at the start of token lists any more.
	(trigraph_ok): Only warn outside comments.
	(skip_block_comment): Set and clear lexing_comment.
	(skip_line_comment): Take a cpp_reader not cpp_buffer.
	Set and clear lexing_comment.
	(parse_number): Handle leading '.' indicated by pfile->seen_dot.
	(check_long_token): Delete.
	(lex_percent, lex_dot): New subroutines of lex_token to
	handle lexing of '.' and '%' without lookback.
	(lex_token): Use lex_dot and lex_percent.
	(lex_line): Don't check for LIST_OFFSET.
	(_cpp_init_input_buffer): Update for new _cpp_init_toklist.
	* cpplib.c (_cpp_parse_assertion): Similarly.
	(cpp_push_buffer): Initialize extra_char.
	* cpplib.h (LIST_OFFSET): Delete.
	(struct cpp_buffer): New member extra_char.
	(struct lexer_state): New members lexing_comment and seen_dot.

From-SVN: r36582
parent 19e223db
Sat 23-Sep-2000 22:39:18 BST Neil Booth <NeilB@earthling.net>
* cpphash.h (CPP_RESERVE, CPP_PUTS_Q, CPP_PUTS, CPP_PUTC_Q,
CPP_PUTC, DUMMY_TOKEN, NO_DUMMY_TOKEN): Delete.
* cpplex.c (_cpp_expand_token_space, _cpp_init_toklist,
_cpp_free_toklist): No need to worry about extra dummy token
at the start of token lists any more.
(trigraph_ok): Only warn outside comments.
(skip_block_comment): Set and clear lexing_comment.
(skip_line_comment): Take a cpp_reader not cpp_buffer.
Set and clear lexing_comment.
(parse_number): Handle leading '.' indicated by pfile->seen_dot.
(check_long_token): Delete.
(lex_percent, lex_dot): New subroutines of lex_token to
handle lexing of '.' and '%' without lookback.
(lex_token): Use lex_dot and lex_percent.
(lex_line): Don't check for LIST_OFFSET.
(_cpp_init_input_buffer): Update for new _cpp_init_toklist.
* cpplib.c (_cpp_parse_assertion): Similarly.
(cpp_push_buffer): Initialize extra_char.
* cpplib.h (LIST_OFFSET): Delete.
(struct cpp_buffer): New member extra_char.
(struct lexer_state): New members lexing_comment and seen_dot.
2000-09-23 Jason Merrill <jason@redhat.com>
* config/rs6000/x-aix41 (CLIB): Define here.
......
......@@ -183,22 +183,6 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
/* Macros. */
/* Make sure PFILE->token_buffer has space for at least N more characters. */
#define CPP_RESERVE(PFILE, N) \
(CPP_WRITTEN (PFILE) + (size_t)(N) > (PFILE)->token_buffer_size \
&& (_cpp_grow_token_buffer (PFILE, N), 0))
/* Append string STR (of length N) to PFILE's output buffer.
Assume there is enough space. */
#define CPP_PUTS_Q(PFILE, STR, N) \
(memcpy ((PFILE)->limit, STR, (N)), (PFILE)->limit += (N))
/* Append string STR (of length N) to PFILE's output buffer. Make space. */
#define CPP_PUTS(PFILE, STR, N) CPP_RESERVE(PFILE, N), CPP_PUTS_Q(PFILE, STR,N)
/* Append character CH to PFILE's output buffer. Assume sufficient space. */
#define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
/* Append character CH to PFILE's output buffer. Make space if need be. */
#define CPP_PUTC(PFILE, CH) (CPP_RESERVE (PFILE, 1), CPP_PUTC_Q (PFILE, CH))
#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)->prev)
#define CPP_PRINT_DEPS(PFILE) CPP_OPTION (PFILE, print_deps)
#define CPP_IN_SYSTEM_HEADER(PFILE) \
......@@ -213,10 +197,6 @@ extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
parse_name. */
#define HASHSTEP(r, c) ((r) * 67 + (c - 113));
/* Flags for _cpp_init_toklist. */
#define DUMMY_TOKEN 0
#define NO_DUMMY_TOKEN 1
/* In cpperror.c */
enum error_type { WARNING = 0, PEDWARN, ERROR, FATAL, ICE };
extern int _cpp_begin_message PARAMS ((cpp_reader *, enum error_type,
......
......@@ -1247,7 +1247,7 @@ _cpp_parse_assertion (pfile, answerp)
/* Allocate a struct answer, and copy the answer to it. */
answer = (struct answer *) xmalloc (sizeof (struct answer));
list = &answer->list;
_cpp_init_toklist (list, NO_DUMMY_TOKEN);
_cpp_init_toklist (list, 1); /* Empty. */
for (;;)
{
......@@ -1516,7 +1516,9 @@ cpp_push_buffer (pfile, buffer, length)
new->rlimit = buffer + length;
new->prev = buf;
new->pfile = pfile;
/* No read ahead or extra char initially. */
new->read_ahead = EOF;
new->extra_char = EOF;
CPP_BUFFER (pfile) = new;
return new;
......
......@@ -182,9 +182,8 @@ struct cpp_token
};
/* cpp_toklist flags. */
#define LIST_OFFSET (1 << 0)
#define VAR_ARGS (1 << 1)
#define BEG_OF_FILE (1 << 2)
#define VAR_ARGS (1 << 0)
#define BEG_OF_FILE (1 << 1)
struct directive; /* These are deliberately incomplete. */
struct answer;
......@@ -225,6 +224,7 @@ struct cpp_buffer
const unsigned char *rlimit; /* end of valid data */
const unsigned char *line_base; /* start of current line */
cppchar_t read_ahead; /* read ahead character */
cppchar_t extra_char; /* extra read-ahead for long tokens. */
struct cpp_reader *pfile; /* Owns this buffer. */
struct cpp_buffer *prev;
......@@ -460,8 +460,14 @@ struct lexer_state
/* Nonzero to get force the lexer to skip newlines. */
unsigned char skip_newlines;
/* If we're in the subroutine lex_line. */
/* Nonzero if we're in the subroutine lex_line. */
unsigned char in_lex_line;
/* Nonzero if we're mid-comment. */
unsigned char lexing_comment;
/* Tells parse_number we saw a leading period. */
unsigned char seen_dot;
};
#define IN_DIRECTIVE(pfile) (pfile->state.in_directive)
#define KNOWN_DIRECTIVE(list) (list->directive != 0)
......
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