Commit 4c2b647d by Neil Booth Committed by Neil Booth

Remove CPP_PLACEMARKERs

	* cppexp.c (lex): Don't handle CPP_PLACEMARKER.
	* cpplex.c (_cpp_lex_token): Rename skip_newlines to next_bol
	* cpplib.c (skip_rest_of_line, check_eol, cpp_push_buffer):
	           Similarly.
	* cpplib.h: Remove CPP_PLACEMARKER.
	(struct lexer_state): Rename skip_newlines to next_bol.
	* cppmacro.c (stringify_arg): Don't handle CPP_PLACEMARKER.
	Simplify prev_white handling as a result.
	(paste_all_tokens): Don't worry about CPP_PLACEMARKERs.
	(parse_arg): Empty arguments are now empty, not CPP_PLACEMARKERs.
	(parse_args): Similarly.  Update argument count tests.
	(enter_macro_context): Return 2 to indicate an empty macro.
	(replace_args): Don't bother pre-expanding an empty argument.
	Handle placemarkers and ## extension during pre-expansion.
	(cpp_get_token): Handle empty macro expansions.  Don't worry
	about CPP_PLACEMARKERs.
	(_cpp_create_definition): Empty macros are now empty.
	(cpp_macro_defintion): Don't special case empty macros.
	* scan-decls.c: Don't bother with CPP_PLACEMARKERs.
	* c-lex.c: Similarly.

From-SVN: r37385
parent 1e8ba2a3
2000-11-11 Neil Booth <neilb@earthling.net>
Remove CPP_PLACEMARKERs.
* cppexp.c (lex): Don't handle CPP_PLACEMARKER.
* cpplex.c (_cpp_lex_token): Rename skip_newlines to next_bol
* cpplib.c (skip_rest_of_line, check_eol, cpp_push_buffer):
Similarly.
* cpplib.h: Remove CPP_PLACEMARKER.
(struct lexer_state): Rename skip_newlines to next_bol.
* cppmacro.c (stringify_arg): Don't handle CPP_PLACEMARKER.
Simplify prev_white handling as a result.
(paste_all_tokens): Don't worry about CPP_PLACEMARKERs.
(parse_arg): Empty arguments are now empty, not CPP_PLACEMARKERs.
(parse_args): Similarly. Update argument count tests.
(enter_macro_context): Return 2 to indicate an empty macro.
(replace_args): Don't bother pre-expanding an empty argument.
Handle placemarkers and ## extension during pre-expansion.
(cpp_get_token): Handle empty macro expansions. Don't worry
about CPP_PLACEMARKERs.
(_cpp_create_definition): Empty macros are now empty.
(cpp_macro_defintion): Don't special case empty macros.
* scan-decls.c: Don't bother with CPP_PLACEMARKERs.
* c-lex.c: Similarly.
2000-11-11 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.texi, invoke.texi: Add new section discussing language
......
......@@ -1475,7 +1475,6 @@ c_lex (value)
case CPP_HEADER_NAME:
case CPP_COMMENT:
case CPP_MACRO_ARG:
case CPP_PLACEMARKER:
abort ();
default: break;
......
......@@ -378,14 +378,10 @@ lex (pfile, skip_evaluation, token)
{
struct op op;
retry:
_cpp_get_token (pfile, token);
switch (token->type)
{
case CPP_PLACEMARKER:
goto retry;
case CPP_INT:
case CPP_NUMBER:
return parse_number (pfile, token);
......
......@@ -846,11 +846,11 @@ _cpp_lex_token (pfile, result)
cppchar_t c;
cpp_buffer *buffer;
const unsigned char *comment_start;
unsigned char bol = pfile->state.skip_newlines;
unsigned char bol = pfile->state.next_bol;
done_directive:
buffer = pfile->buffer;
pfile->state.skip_newlines = 0;
pfile->state.next_bol = 0;
result->flags = 0;
next_char:
pfile->lexer_pos.line = buffer->lineno;
......@@ -873,7 +873,7 @@ _cpp_lex_token (pfile, result)
line and _Pragma buffers. */
if (pfile->lexer_pos.col != 0 && !buffer->from_stage3)
cpp_pedwarn (pfile, "no newline at end of file");
pfile->state.skip_newlines = 1;
pfile->state.next_bol = 1;
result->type = CPP_EOF;
break;
......@@ -900,7 +900,7 @@ _cpp_lex_token (pfile, result)
/* Don't let directives spill over to the next line. */
buffer->read_ahead = c;
pfile->state.skip_newlines = 1;
pfile->state.next_bol = 1;
result->type = CPP_EOF;
break;
......@@ -1186,7 +1186,7 @@ _cpp_lex_token (pfile, result)
/* Put a '#' in lookahead, return CPP_EOF for parse_arg. */
buffer->extra_char = buffer->read_ahead;
buffer->read_ahead = '#';
pfile->state.skip_newlines = 1;
pfile->state.next_bol = 1;
result->type = CPP_EOF;
/* Get whitespace right - newline_in_args sets it. */
......
......@@ -194,7 +194,7 @@ skip_rest_of_line (pfile)
because they may be saving tokens prior to this directive for an
external client. So we use _cpp_get_token, with macros disabled. */
pfile->state.prevent_expansion++;
while (!pfile->state.skip_newlines)
while (!pfile->state.next_bol)
_cpp_get_token (pfile, &token);
pfile->state.prevent_expansion--;
}
......@@ -204,7 +204,7 @@ static void
check_eol (pfile)
cpp_reader *pfile;
{
if (!pfile->state.skip_newlines)
if (!pfile->state.next_bol)
{
cpp_token token;
......@@ -1728,7 +1728,7 @@ cpp_push_buffer (pfile, buffer, length)
/* No read ahead or extra char initially. */
new->read_ahead = EOF;
new->extra_char = EOF;
pfile->state.skip_newlines = 1;
pfile->state.next_bol = 1;
CPP_BUFFER (pfile) = new;
return new;
......
......@@ -140,7 +140,6 @@ struct htab;
\
TK(CPP_COMMENT, SPELL_STRING) /* Only if output comments. */ \
TK(CPP_MACRO_ARG, SPELL_NONE) /* Macro argument. */ \
TK(CPP_PLACEMARKER, SPELL_NONE) /* Placemarker token. */ \
OP(CPP_EOF, "EOL") /* End of line or file. */
#define OP(e, s) e,
......@@ -488,8 +487,8 @@ struct lexer_state
all directives apart from #define. */
unsigned char save_comments;
/* If nonzero the lexer skips newlines. Internal to the lexer. */
unsigned char skip_newlines;
/* If nonzero the next token is at the beginning of the line. */
unsigned char next_bol;
/* Nonzero if we're mid-comment. */
unsigned char lexing_comment;
......
......@@ -133,7 +133,6 @@ scan_decls (pfile, argc, argv)
goto handle_statement;
case CPP_MULT:
case CPP_AND:
case CPP_PLACEMARKER:
/* skip */
break;
......
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