* 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
+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
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
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) \
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;
add_path (xstrdup (arg), AFTER, 0);
break;
+ case OPT_imacros:
case OPT_include:
defer_opt (code, arg);
break;
if (flag_preprocess_only)
{
- cpp_finish_options (parse_in);
- push_command_line_include ();
+ finish_options ();
preprocess_file (parse_in);
return false;
}
#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 ();
break;
case OPT_include:
+ case OPT_imacros:
break;
default:
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 ()
struct cpp_pending
{
struct pending_option *directive_head, *directive_tail;
- struct pending_option *imacros_head, *imacros_tail;
};
#ifdef __STDC__
_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);
}
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
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,
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;