Commit 09b82253 by Neil Booth Committed by Neil Booth

cpphash.h (struct cpp_reader): Remove import_warning.

	* cpphash.h (struct cpp_reader): Remove import_warning.
	* cpplib.c (skip_rest_of_line): Don't bother turning off
	macro expansion.
	(parse_include): Move include handling to...
	(do_include_common): ... here.  Move import warning from...
	(do_import): ... here.
	(do_pragma_poison): Don't do a callback for poison identifiers.
	* cpplib.h (struct cpp_callbacks): Don't do poison callbacks.
	* cppmain.c (setup_callbacks): Similarly.

From-SVN: r44466
parent 833366d6
2001-07-29 Neil Booth <neil@cat.daikokuya.demon.co.uk>
* cpphash.h (struct cpp_reader): Remove import_warning.
* cpplib.c (skip_rest_of_line): Don't bother turning off
macro expansion.
(parse_include): Move include handling to...
(do_include_common): ... here. Move import warning from...
(do_import): ... here.
(do_pragma_poison): Don't do a callback for poison identifiers.
* cpplib.h (struct cpp_callbacks): Don't do poison callbacks.
* cppmain.c (setup_callbacks): Similarly.
Sun Jul 29 23:26:50 CEST 2001 Jan Hubicka <jh@suse.cz> Sun Jul 29 23:26:50 CEST 2001 Jan Hubicka <jh@suse.cz>
* rtlanal.c (parms_set, find_first_parameter_load): Break out from...; * rtlanal.c (parms_set, find_first_parameter_load): Break out from...;
......
...@@ -333,9 +333,6 @@ struct cpp_reader ...@@ -333,9 +333,6 @@ struct cpp_reader
preprocessor. */ preprocessor. */
struct spec_nodes spec_nodes; struct spec_nodes spec_nodes;
/* We're printed a warning recommending against using #import. */
unsigned char import_warning;
/* Whether to print our version number. Done this way so /* Whether to print our version number. Done this way so
we don't get it twice for -v -version. */ we don't get it twice for -v -version. */
unsigned char print_version; unsigned char print_version;
......
...@@ -194,10 +194,8 @@ skip_rest_of_line (pfile) ...@@ -194,10 +194,8 @@ skip_rest_of_line (pfile)
_cpp_pop_context (pfile); _cpp_pop_context (pfile);
/* Sweep up all tokens remaining on the line. */ /* Sweep up all tokens remaining on the line. */
pfile->state.prevent_expansion++;
while (!pfile->state.next_bol) while (!pfile->state.next_bol)
_cpp_lex_token (pfile, &token); _cpp_lex_token (pfile, &token);
pfile->state.prevent_expansion--;
} }
/* Ensure there are no stray tokens at the end of a directive. */ /* Ensure there are no stray tokens at the end of a directive. */
...@@ -565,10 +563,9 @@ parse_include (pfile, header) ...@@ -565,10 +563,9 @@ parse_include (pfile, header)
cpp_reader *pfile; cpp_reader *pfile;
cpp_token *header; cpp_token *header;
{ {
int is_pragma = pfile->directive == &dtable[T_PRAGMA];
const unsigned char *dir; const unsigned char *dir;
if (is_pragma) if (pfile->directive == &dtable[T_PRAGMA])
dir = U"pragma dependency"; dir = U"pragma dependency";
else else
dir = pfile->directive->name; dir = pfile->directive->name;
...@@ -592,15 +589,6 @@ parse_include (pfile, header) ...@@ -592,15 +589,6 @@ parse_include (pfile, header)
return 1; return 1;
} }
if (!is_pragma)
{
check_eol (pfile);
/* Get out of macro context, if we are. */
skip_rest_of_line (pfile);
if (pfile->cb.include)
(*pfile->cb.include) (pfile, dir, header);
}
return 0; return 0;
} }
...@@ -612,22 +600,32 @@ do_include_common (pfile, type) ...@@ -612,22 +600,32 @@ do_include_common (pfile, type)
{ {
cpp_token header; cpp_token header;
/* For #include_next, if this is the primary source file, warn and
use the normal search logic. */
if (type == IT_INCLUDE_NEXT && ! pfile->buffer->prev)
{
cpp_warning (pfile, "#include_next in primary source file");
type = IT_INCLUDE;
}
else if (type == IT_IMPORT && CPP_OPTION (pfile, warn_import))
{
CPP_OPTION (pfile, warn_import) = 0;
cpp_warning (pfile,
"#import is obsolete, use an #ifndef wrapper in the header file");
}
if (!parse_include (pfile, &header)) if (!parse_include (pfile, &header))
{ {
/* Prevent #include recursion. */ /* Prevent #include recursion. */
if (pfile->buffer_stack_depth >= CPP_STACK_MAX) if (pfile->buffer_stack_depth >= CPP_STACK_MAX)
cpp_fatal (pfile, "#include nested too deeply"); cpp_fatal (pfile, "#include nested too deeply");
else if (pfile->context->prev)
cpp_ice (pfile, "attempt to push file buffer with contexts stacked");
else else
{ {
/* For #include_next, if this is the primary source file, check_eol (pfile);
warn and use the normal search logic. */ /* Get out of macro context, if we are. */
if (type == IT_INCLUDE_NEXT && ! pfile->buffer->prev) skip_rest_of_line (pfile);
{ if (pfile->cb.include)
cpp_warning (pfile, "#include_next in primary source file"); (*pfile->cb.include) (pfile, pfile->directive->name, &header);
type = IT_INCLUDE;
}
_cpp_execute_include (pfile, &header, type); _cpp_execute_include (pfile, &header, type);
} }
...@@ -645,13 +643,6 @@ static void ...@@ -645,13 +643,6 @@ static void
do_import (pfile) do_import (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
if (!pfile->import_warning && CPP_OPTION (pfile, warn_import))
{
pfile->import_warning = 1;
cpp_warning (pfile,
"#import is obsolete, use an #ifndef wrapper in the header file");
}
do_include_common (pfile, IT_IMPORT); do_include_common (pfile, IT_IMPORT);
} }
...@@ -1111,11 +1102,6 @@ do_pragma_poison (pfile) ...@@ -1111,11 +1102,6 @@ do_pragma_poison (pfile)
hp->flags |= NODE_POISONED | NODE_DIAGNOSTIC; hp->flags |= NODE_POISONED | NODE_DIAGNOSTIC;
} }
pfile->state.poisoned_ok = 0; pfile->state.poisoned_ok = 0;
#if 0 /* Doesn't quite work yet. */
if (tok.type == CPP_EOF && pfile->cb.poison)
(*pfile->cb.poison) (pfile);
#endif
} }
/* Mark the current header as a system header. This will suppress /* Mark the current header as a system header. This will suppress
......
...@@ -411,7 +411,6 @@ struct cpp_callbacks ...@@ -411,7 +411,6 @@ struct cpp_callbacks
const cpp_token *)); const cpp_token *));
void (*define) PARAMS ((cpp_reader *, cpp_hashnode *)); void (*define) PARAMS ((cpp_reader *, cpp_hashnode *));
void (*undef) PARAMS ((cpp_reader *, cpp_hashnode *)); void (*undef) PARAMS ((cpp_reader *, cpp_hashnode *));
void (*poison) PARAMS ((cpp_reader *));
void (*ident) PARAMS ((cpp_reader *, const cpp_string *)); void (*ident) PARAMS ((cpp_reader *, const cpp_string *));
void (*def_pragma) PARAMS ((cpp_reader *)); void (*def_pragma) PARAMS ((cpp_reader *));
}; };
......
...@@ -193,7 +193,6 @@ setup_callbacks () ...@@ -193,7 +193,6 @@ setup_callbacks ()
{ {
cb->define = cb_define; cb->define = cb_define;
cb->undef = cb_undef; cb->undef = cb_undef;
cb->poison = cb_def_pragma;
} }
} }
......
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