mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-08 15:07:26 +08:00
c-opts.c (finish_options): New.
* c-opts.c (finish_options): New. (COMMAND_LINE_OPTIONS, c_common_decode_option): Add -imacros. (missing_arg): Handle OPT_include and OPT_imacros. (c_common_init, c_common_parse_file): Use finish_options. (handle_deferred_opts): Update. * cppinit.c (struct cpp_pending): Remove imacros_head and imacros_tail. (cpp_finish_options): Don't handle -imacros here. (no_fil): Remove. (COMMAND_LINE_OPTIONS, cpp_handle_option): Don't handle -imacros. From-SVN: r64378
This commit is contained in:
parent
027fbf43fb
commit
255c10b1a7
@ -1,3 +1,15 @@
|
||||
2003-03-14 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* c-opts.c (finish_options): New.
|
||||
(COMMAND_LINE_OPTIONS, c_common_decode_option): Add -imacros.
|
||||
(missing_arg): Handle OPT_include and OPT_imacros.
|
||||
(c_common_init, c_common_parse_file): Use finish_options.
|
||||
(handle_deferred_opts): Update.
|
||||
* cppinit.c (struct cpp_pending): Remove imacros_head and imacros_tail.
|
||||
(cpp_finish_options): Don't handle -imacros here.
|
||||
(no_fil): Remove.
|
||||
(COMMAND_LINE_OPTIONS, cpp_handle_option): Don't handle -imacros.
|
||||
|
||||
2003-03-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/rs6000/rs6000.c (rs6000_emit_load_toc_table): Don't call
|
||||
|
36
gcc/c-opts.c
36
gcc/c-opts.c
@ -104,6 +104,7 @@ static void sanitize_cpp_opts PARAMS ((void));
|
||||
static void add_prefixed_path PARAMS ((const char *, size_t));
|
||||
static void push_command_line_include PARAMS ((void));
|
||||
static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
|
||||
static void finish_options PARAMS ((void));
|
||||
|
||||
#ifndef STDC_0_IN_SYSTEM_HEADERS
|
||||
#define STDC_0_IN_SYSTEM_HEADERS 0
|
||||
@ -297,6 +298,7 @@ static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
|
||||
OPT("fxref", CL_CXX, OPT_fxref) \
|
||||
OPT("gen-decls", CL_OBJC, OPT_gen_decls) \
|
||||
OPT("idirafter", CL_ALL | CL_ARG, OPT_idirafter) \
|
||||
OPT("imacros", CL_ALL | CL_ARG, OPT_imacros) \
|
||||
OPT("include", CL_ALL | CL_ARG, OPT_include) \
|
||||
OPT("iprefix", CL_ALL | CL_ARG, OPT_iprefix) \
|
||||
OPT("isysroot", CL_ALL | CL_ARG, OPT_isysroot) \
|
||||
@ -421,6 +423,8 @@ missing_arg (opt_index)
|
||||
case OPT_MF:
|
||||
case OPT_MD:
|
||||
case OPT_MMD:
|
||||
case OPT_include:
|
||||
case OPT_imacros:
|
||||
case OPT_o:
|
||||
error ("missing filename after \"-%s\"", opt_text);
|
||||
break;
|
||||
@ -1333,6 +1337,7 @@ c_common_decode_option (argc, argv)
|
||||
add_path (xstrdup (arg), AFTER, 0);
|
||||
break;
|
||||
|
||||
case OPT_imacros:
|
||||
case OPT_include:
|
||||
defer_opt (code, arg);
|
||||
break;
|
||||
@ -1566,8 +1571,7 @@ c_common_init ()
|
||||
|
||||
if (flag_preprocess_only)
|
||||
{
|
||||
cpp_finish_options (parse_in);
|
||||
push_command_line_include ();
|
||||
finish_options ();
|
||||
preprocess_file (parse_in);
|
||||
return false;
|
||||
}
|
||||
@ -1593,8 +1597,7 @@ c_common_parse_file (set_yydebug)
|
||||
#endif
|
||||
|
||||
(*debug_hooks->start_source_file) (lineno, input_filename);
|
||||
cpp_finish_options (parse_in);
|
||||
push_command_line_include ();
|
||||
finish_options();
|
||||
pch_init();
|
||||
yyparse ();
|
||||
free_parser_stacks ();
|
||||
@ -1694,6 +1697,7 @@ handle_deferred_opts ()
|
||||
break;
|
||||
|
||||
case OPT_include:
|
||||
case OPT_imacros:
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1757,6 +1761,30 @@ add_prefixed_path (suffix, chain)
|
||||
add_path (path, chain, 0);
|
||||
}
|
||||
|
||||
/* Handle -D, -U, -A, -imacros, and the first -include. */
|
||||
static void
|
||||
finish_options ()
|
||||
{
|
||||
cpp_finish_options (parse_in);
|
||||
|
||||
if (!cpp_opts->preprocessed)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Handle -imacros after -D, -U and -A. */
|
||||
for (i = 0; i < deferred_count; i++)
|
||||
{
|
||||
struct deferred_opt *opt = &deferred_opts[i];
|
||||
|
||||
if (opt->code == OPT_imacros
|
||||
&& cpp_push_include (parse_in, opt->arg))
|
||||
cpp_scan_nooutput (parse_in);
|
||||
}
|
||||
}
|
||||
|
||||
push_command_line_include ();
|
||||
}
|
||||
|
||||
/* Give CPP the next file given by -include, if any. */
|
||||
static void
|
||||
push_command_line_include ()
|
||||
|
@ -47,7 +47,6 @@ struct pending_option
|
||||
struct cpp_pending
|
||||
{
|
||||
struct pending_option *directive_head, *directive_tail;
|
||||
struct pending_option *imacros_head, *imacros_tail;
|
||||
};
|
||||
|
||||
#ifdef __STDC__
|
||||
@ -606,16 +605,8 @@ cpp_finish_options (pfile)
|
||||
_cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0);
|
||||
for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next)
|
||||
(*p->handler) (pfile, p->arg);
|
||||
|
||||
/* Scan -imacros files after -D, -U, but before -include.
|
||||
pfile->next_include_file is NULL, so _cpp_pop_buffer does not
|
||||
push -include files. */
|
||||
for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next)
|
||||
if (cpp_push_include (pfile, p->arg))
|
||||
cpp_scan_nooutput (pfile);
|
||||
}
|
||||
|
||||
free_chain (CPP_OPTION (pfile, pending)->imacros_head);
|
||||
free_chain (CPP_OPTION (pfile, pending)->directive_head);
|
||||
}
|
||||
|
||||
@ -679,7 +670,6 @@ new_pending_directive (pend, text, handler)
|
||||
I.e. a const string initializer with parens around it. That is
|
||||
what N_("string") resolves to, so we make no_* be macros instead. */
|
||||
#define no_ass N_("assertion missing after %s")
|
||||
#define no_fil N_("file name missing after %s")
|
||||
#define no_mac N_("macro name missing after %s")
|
||||
|
||||
/* This is the list of all command line options, with the leading
|
||||
@ -688,7 +678,6 @@ new_pending_directive (pend, text, handler)
|
||||
DEF_OPT("A", no_ass, OPT_A) \
|
||||
DEF_OPT("D", no_mac, OPT_D) \
|
||||
DEF_OPT("U", no_mac, OPT_U) \
|
||||
DEF_OPT("imacros", no_fil, OPT_imacros) \
|
||||
|
||||
|
||||
#define DEF_OPT(text, msg, code) code,
|
||||
@ -853,16 +842,6 @@ cpp_handle_option (pfile, argc, argv)
|
||||
case OPT_U:
|
||||
new_pending_directive (pend, arg, cpp_undef);
|
||||
break;
|
||||
case OPT_imacros:
|
||||
{
|
||||
struct pending_option *o = (struct pending_option *)
|
||||
xmalloc (sizeof (struct pending_option));
|
||||
o->arg = arg;
|
||||
o->next = NULL;
|
||||
|
||||
APPEND (pend, imacros, o);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user