Commit c1bad961 by Neil Booth Committed by Neil Booth

Makefile.in: Update.

	* Makefile.in: Update.
	* c-common.h (cb_register_builtins): Rename c_cpp_builtins.
	* c-lex.c (init_c_lex): Register builtins hook is dead.
	* c-opts.c (COMMAND_LINE_OPTIONS, missing_arg): Handle -A, -D and -U.
	(c_common_decode_option): Don't call cpp_handle_option.
	Handle -A, -D and -U.
	(handle_deferred_opts): Simplify.
	(finish_options): Define builtins and command line macros.
	* c-ppoutput.c (init_pp_output): Register builtins hook is dead.
	* cppinit.c: Don't include intl.h.
	(init_builtins): Rename cpp_init_builtins.  No hook to call.
	(init_library): Don't need to sort options.
	(cpp_create_reader): Don't set pending.
	(cpp_destroy): Don't free pending.
	(struct pending_option, cl_directive_handler, struct cpp_pending,
	APPEND, free_chain, new_pending_directive, parse_option, opt_comp,
	cpp_finish_options, COMMAND_LINE_OPTIONS, DEF_OPT, struct cl_option,
	cl_options, cpp_handle_option): Remove.
	* cpplib.h (struct cpp_pending, register_builtins, cpp_handle_option,
	cpp_finish_options): Remove.
	(cpp_init_builtins): New.
	* fix-header.c (read_scan_file): Update to handle -D.  Fix
	handling of -I.  Replace call to cpp_finish_options.
cp:
	* Make-lang.in: Update.

From-SVN: r64398
parent 6e049fcd
2003-03-15 Neil Booth <neil@daikokuya.co.uk>
* Makefile.in: Update.
* c-common.h (cb_register_builtins): Rename c_cpp_builtins.
* c-lex.c (init_c_lex): Register builtins hook is dead.
* c-opts.c (COMMAND_LINE_OPTIONS, missing_arg): Handle -A, -D and -U.
(c_common_decode_option): Don't call cpp_handle_option.
Handle -A, -D and -U.
(handle_deferred_opts): Simplify.
(finish_options): Define builtins and command line macros.
* c-ppoutput.c (init_pp_output): Register builtins hook is dead.
* cppinit.c: Don't include intl.h.
(init_builtins): Rename cpp_init_builtins. No hook to call.
(init_library): Don't need to sort options.
(cpp_create_reader): Don't set pending.
(cpp_destroy): Don't free pending.
(struct pending_option, cl_directive_handler, struct cpp_pending,
APPEND, free_chain, new_pending_directive, parse_option, opt_comp,
cpp_finish_options, COMMAND_LINE_OPTIONS, DEF_OPT, struct cl_option,
cl_options, cpp_handle_option): Remove.
* cpplib.h (struct cpp_pending, register_builtins, cpp_handle_option,
cpp_finish_options): Remove.
(cpp_init_builtins): New.
* fix-header.c (read_scan_file): Update to handle -D. Fix
handling of -I. Replace call to cpp_finish_options.
2003-03-15 Michael Hayes <m.hayes@elec.canterbury.ac.nz> 2003-03-15 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
PR optimization/9387 PR optimization/9387
......
...@@ -789,7 +789,7 @@ CXX_TARGET_OBJS=@cxx_target_objs@ ...@@ -789,7 +789,7 @@ CXX_TARGET_OBJS=@cxx_target_objs@
# Language-specific object files for C and Objective C. # Language-specific object files for C and Objective C.
C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \ C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \ c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o \ c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
c-objc-common.o c-dump.o c-pch.o libcpp.a $(C_TARGET_OBJS) c-objc-common.o c-dump.o c-pch.o libcpp.a $(C_TARGET_OBJS)
# Language-specific object files for C. # Language-specific object files for C.
...@@ -2315,7 +2315,7 @@ PREPROCESSOR_DEFINES = \ ...@@ -2315,7 +2315,7 @@ PREPROCESSOR_DEFINES = \
LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \ LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \
cpphash.o cpperror.o cppinit.o \ cpphash.o cpperror.o cppinit.o \
hashtable.o line-map.o mkdeps.o prefix.o mbchar.o cpppch.o hashtable.o line-map.o mkdeps.o mbchar.o cpppch.o
LIBCPP_DEPS = $(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \ LIBCPP_DEPS = $(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \
$(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
...@@ -2335,7 +2335,7 @@ cpplib.o: cpplib.c $(LIBCPP_DEPS) ...@@ -2335,7 +2335,7 @@ cpplib.o: cpplib.c $(LIBCPP_DEPS)
cpphash.o: cpphash.c $(LIBCPP_DEPS) cpphash.o: cpphash.c $(LIBCPP_DEPS)
cpptrad.o: cpptrad.c $(LIBCPP_DEPS) cpptrad.o: cpptrad.c $(LIBCPP_DEPS)
cppfiles.o: cppfiles.c $(LIBCPP_DEPS) $(SPLAY_TREE_H) mkdeps.h cppfiles.o: cppfiles.c $(LIBCPP_DEPS) $(SPLAY_TREE_H) mkdeps.h
cppinit.o: cppinit.c $(LIBCPP_DEPS) mkdeps.h prefix.h cppinit.o: cppinit.c $(LIBCPP_DEPS) mkdeps.h
cpppch.o: cpppch.c $(LIBCPP_DEPS) mkdeps.h cpppch.o: cpppch.c $(LIBCPP_DEPS) mkdeps.h
cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
...@@ -2553,9 +2553,9 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_ ...@@ -2553,9 +2553,9 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_
# This is nominally a 'build' program, but it's run only when host==build, # This is nominally a 'build' program, but it's run only when host==build,
# so we can (indeed, must) use $(LIBDEPS) and $(LIBS). # so we can (indeed, must) use $(LIBDEPS) and $(LIBS).
fix-header$(build_exeext): fix-header.o scan-decls.o scan.o xsys-protos.h \ fix-header$(build_exeext): fix-header.o scan-decls.o scan.o xsys-protos.h \
c-incpath.o cppdefault.o $(LIBDEPS) libcpp.a c-incpath.o cppdefault.o prefix.o $(LIBDEPS) libcpp.a
$(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \ $(BUILD_CC) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \
c-incpath.o cppdefault.o scan-decls.o scan.o libcpp.a $(LIBS) c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o libcpp.a $(LIBS)
fix-header.o: fix-header.c $(OBSTACK_H) scan.h \ fix-header.o: fix-header.c $(OBSTACK_H) scan.h \
xsys-protos.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(CPPLIB_H) xsys-protos.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(CPPLIB_H)
......
...@@ -1263,7 +1263,7 @@ extern int c_common_unsafe_for_reeval PARAMS ((tree)); ...@@ -1263,7 +1263,7 @@ extern int c_common_unsafe_for_reeval PARAMS ((tree));
extern void init_c_lex PARAMS ((void)); extern void init_c_lex PARAMS ((void));
extern void cb_register_builtins PARAMS ((cpp_reader *)); extern void c_cpp_builtins PARAMS ((cpp_reader *));
/* Positive if an implicit `extern "C"' scope has just been entered; /* Positive if an implicit `extern "C"' scope has just been entered;
negative if such a scope has just been exited. */ negative if such a scope has just been exited. */
......
...@@ -281,7 +281,7 @@ define__GNUC__ () ...@@ -281,7 +281,7 @@ define__GNUC__ ()
/* Hook that registers front end and target-specific built-ins. */ /* Hook that registers front end and target-specific built-ins. */
void void
cb_register_builtins (pfile) c_cpp_builtins (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
/* -undef turns off target-specific built-ins. */ /* -undef turns off target-specific built-ins. */
......
...@@ -112,7 +112,6 @@ init_c_lex () ...@@ -112,7 +112,6 @@ init_c_lex ()
cb = cpp_get_callbacks (parse_in); cb = cpp_get_callbacks (parse_in);
cb->register_builtins = cb_register_builtins;
cb->line_change = cb_line_change; cb->line_change = cb_line_change;
cb->ident = cb_ident; cb->ident = cb_ident;
cb->def_pragma = cb_def_pragma; cb->def_pragma = cb_def_pragma;
......
...@@ -149,8 +149,10 @@ static void finish_options PARAMS ((void)); ...@@ -149,8 +149,10 @@ static void finish_options PARAMS ((void));
#define COMMAND_LINE_OPTIONS \ #define COMMAND_LINE_OPTIONS \
OPT("-help", CL_ALL, OPT__help) \ OPT("-help", CL_ALL, OPT__help) \
OPT("-output-pch=", CL_ALL | CL_ARG, OPT__output_pch) \ OPT("-output-pch=", CL_ALL | CL_ARG, OPT__output_pch) \
OPT("A", CL_ALL | CL_ARG, OPT_A) \
OPT("C", CL_ALL, OPT_C) \ OPT("C", CL_ALL, OPT_C) \
OPT("CC", CL_ALL, OPT_CC) \ OPT("CC", CL_ALL, OPT_CC) \
OPT("D", CL_ALL | CL_ARG, OPT_D) \
OPT("E", CL_ALL, OPT_E) \ OPT("E", CL_ALL, OPT_E) \
OPT("H", CL_ALL, OPT_H) \ OPT("H", CL_ALL, OPT_H) \
OPT("I", CL_ALL | CL_ARG, OPT_I) \ OPT("I", CL_ALL | CL_ARG, OPT_I) \
...@@ -164,6 +166,7 @@ static void finish_options PARAMS ((void)); ...@@ -164,6 +166,7 @@ static void finish_options PARAMS ((void));
OPT("MQ", CL_ALL | CL_ARG, OPT_MQ) \ OPT("MQ", CL_ALL | CL_ARG, OPT_MQ) \
OPT("MT", CL_ALL | CL_ARG, OPT_MT) \ OPT("MT", CL_ALL | CL_ARG, OPT_MT) \
OPT("P", CL_ALL, OPT_P) \ OPT("P", CL_ALL, OPT_P) \
OPT("U", CL_ALL | CL_ARG, OPT_U) \
OPT("Wabi", CL_CXX, OPT_Wabi) \ OPT("Wabi", CL_CXX, OPT_Wabi) \
OPT("Wall", CL_ALL, OPT_Wall) \ OPT("Wall", CL_ALL, OPT_Wall) \
OPT("Wbad-function-cast", CL_C, OPT_Wbad_function_cast) \ OPT("Wbad-function-cast", CL_C, OPT_Wbad_function_cast) \
...@@ -413,6 +416,15 @@ missing_arg (opt_index) ...@@ -413,6 +416,15 @@ missing_arg (opt_index)
error ("no class name specified with \"-%s\"", opt_text); error ("no class name specified with \"-%s\"", opt_text);
break; break;
case OPT_A:
error ("assertion missing after \"-%s\"", opt_text);
break;
case OPT_D:
case OPT_U:
error ("macro name missing after \"-%s\"", opt_text);
break;
case OPT_I: case OPT_I:
case OPT_idirafter: case OPT_idirafter:
case OPT_isysroot: case OPT_isysroot:
...@@ -595,7 +607,7 @@ c_common_decode_option (argc, argv) ...@@ -595,7 +607,7 @@ c_common_decode_option (argc, argv)
const char *opt, *arg = 0; const char *opt, *arg = 0;
char *dup = 0; char *dup = 0;
bool on = true; bool on = true;
int result, lang_flag; int result = 0, lang_flag;
const struct cl_option *option; const struct cl_option *option;
enum opt_code code; enum opt_code code;
...@@ -632,8 +644,6 @@ c_common_decode_option (argc, argv) ...@@ -632,8 +644,6 @@ c_common_decode_option (argc, argv)
on = false; on = false;
} }
result = cpp_handle_option (parse_in, argc, argv);
/* Skip over '-'. */ /* Skip over '-'. */
lang_flag = lang_flags[(c_language << 1) + flag_objc]; lang_flag = lang_flags[(c_language << 1) + flag_objc];
opt_index = find_opt (opt + 1, lang_flag); opt_index = find_opt (opt + 1, lang_flag);
...@@ -694,6 +704,10 @@ c_common_decode_option (argc, argv) ...@@ -694,6 +704,10 @@ c_common_decode_option (argc, argv)
pch_file = arg; pch_file = arg;
break; break;
case OPT_A:
defer_opt (code, arg);
break;
case OPT_C: case OPT_C:
cpp_opts->discard_comments = 0; cpp_opts->discard_comments = 0;
break; break;
...@@ -703,6 +717,10 @@ c_common_decode_option (argc, argv) ...@@ -703,6 +717,10 @@ c_common_decode_option (argc, argv)
cpp_opts->discard_comments_in_macro_exp = 0; cpp_opts->discard_comments_in_macro_exp = 0;
break; break;
case OPT_D:
defer_opt (code, arg);
break;
case OPT_E: case OPT_E:
flag_preprocess_only = 1; flag_preprocess_only = 1;
break; break;
...@@ -765,6 +783,10 @@ c_common_decode_option (argc, argv) ...@@ -765,6 +783,10 @@ c_common_decode_option (argc, argv)
flag_no_line_commands = 1; flag_no_line_commands = 1;
break; break;
case OPT_U:
defer_opt (code, arg);
break;
case OPT_Wabi: case OPT_Wabi:
warn_abi = on; warn_abi = on;
break; break;
...@@ -1689,20 +1711,8 @@ handle_deferred_opts () ...@@ -1689,20 +1711,8 @@ handle_deferred_opts ()
{ {
struct deferred_opt *opt = &deferred_opts[i]; struct deferred_opt *opt = &deferred_opts[i];
switch (opt->code) if (opt->code == OPT_MT || opt->code == OPT_MQ)
{
case OPT_MT:
case OPT_MQ:
cpp_add_dependency_target (parse_in, opt->arg, opt->code == OPT_MQ); cpp_add_dependency_target (parse_in, opt->arg, opt->code == OPT_MQ);
break;
case OPT_include:
case OPT_imacros:
break;
default:
abort ();
}
} }
} }
...@@ -1765,13 +1775,32 @@ add_prefixed_path (suffix, chain) ...@@ -1765,13 +1775,32 @@ add_prefixed_path (suffix, chain)
static void static void
finish_options () finish_options ()
{ {
cpp_finish_options (parse_in);
if (!cpp_opts->preprocessed) if (!cpp_opts->preprocessed)
{ {
unsigned int i; size_t i;
cpp_rename_file (parse_in, _("<built-in>"));
cpp_init_builtins (parse_in);
c_cpp_builtins (parse_in);
cpp_rename_file (parse_in, _("<command line>"));
for (i = 0; i < deferred_count; i++)
{
struct deferred_opt *opt = &deferred_opts[i];
if (opt->code == OPT_D)
cpp_define (parse_in, opt->arg);
else if (opt->code == OPT_U)
cpp_undef (parse_in, opt->arg);
else if (opt->code == OPT_A)
{
if (opt->arg[0] == '-')
cpp_unassert (parse_in, opt->arg + 1);
else
cpp_assert (parse_in, opt->arg);
}
}
/* Handle -imacros after -D, -U and -A. */ /* Handle -imacros after -D and -U. */
for (i = 0; i < deferred_count; i++) for (i = 0; i < deferred_count; i++)
{ {
struct deferred_opt *opt = &deferred_opts[i]; struct deferred_opt *opt = &deferred_opts[i];
......
...@@ -95,8 +95,6 @@ init_pp_output (out_stream) ...@@ -95,8 +95,6 @@ init_pp_output (out_stream)
{ {
cpp_callbacks *cb = cpp_get_callbacks (parse_in); cpp_callbacks *cb = cpp_get_callbacks (parse_in);
cb->register_builtins = cb_register_builtins;
if (!flag_no_output) if (!flag_no_output)
{ {
cb->line_change = cb_line_change; cb->line_change = cb_line_change;
......
2003-03-15 Neil Booth <neil@daikokuya.co.uk>
* Make-lang.in: Update.
2003-03-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2003-03-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/6440 PR c++/6440
......
...@@ -80,7 +80,7 @@ g++-cross$(exeext): g++$(exeext) ...@@ -80,7 +80,7 @@ g++-cross$(exeext): g++$(exeext)
# Shared with C front end: # Shared with C front end:
CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \ c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o
# Language-specific object files. # Language-specific object files.
CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
......
...@@ -213,9 +213,6 @@ struct cpp_options ...@@ -213,9 +213,6 @@ struct cpp_options
/* Characters between tab stops. */ /* Characters between tab stops. */
unsigned int tabstop; unsigned int tabstop;
/* Pending options - -D, -U, -A, -I, -ixxx. */
struct cpp_pending *pending;
/* Map between header names and file names, used only on DOS where /* Map between header names and file names, used only on DOS where
file names are limited in length. */ file names are limited in length. */
struct file_name_map_list *map_list; struct file_name_map_list *map_list;
...@@ -380,9 +377,6 @@ struct cpp_callbacks ...@@ -380,9 +377,6 @@ struct cpp_callbacks
void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *)); void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *));
void (*def_pragma) PARAMS ((cpp_reader *, unsigned int)); void (*def_pragma) PARAMS ((cpp_reader *, unsigned int));
/* Called when the client has a chance to properly register
built-ins with cpp_define() and cpp_assert(). */
void (*register_builtins) PARAMS ((cpp_reader *));
int (*valid_pch) PARAMS ((cpp_reader *, const char *, int)); int (*valid_pch) PARAMS ((cpp_reader *, const char *, int));
void (*read_pch) PARAMS ((cpp_reader *, const char *, int, const char *)); void (*read_pch) PARAMS ((cpp_reader *, const char *, int, const char *));
}; };
...@@ -517,11 +511,6 @@ extern const struct line_maps *cpp_get_line_maps PARAMS ((cpp_reader *)); ...@@ -517,11 +511,6 @@ extern const struct line_maps *cpp_get_line_maps PARAMS ((cpp_reader *));
extern cpp_callbacks *cpp_get_callbacks PARAMS ((cpp_reader *)); extern cpp_callbacks *cpp_get_callbacks PARAMS ((cpp_reader *));
extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *)); extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *));
/* Now call cpp_handle_option to handle 1 switch. The return value is
the number of arguments used. Options processing is not completed
until you call cpp_finish_options. */
extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
/* This function reads the file, but does not start preprocessing. It /* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the returns the name of the original file; this is the same as the
input file, except for preprocessed input. This will generate at input file, except for preprocessed input. This will generate at
...@@ -535,12 +524,8 @@ extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **)); ...@@ -535,12 +524,8 @@ extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *, extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *,
struct ht *)); struct ht *));
/* Deferred handling of command line options that can generate debug /* Set up built-ins like __FILE__. */
callbacks, such as -D and -imacros. Call this after extern void cpp_init_builtins PARAMS ((cpp_reader *));
cpp_read_main_file. The front ends need this separation so they
can initialize debug output with the original file name, returned
from cpp_read_main_file, before they get debug callbacks. */
extern void cpp_finish_options PARAMS ((cpp_reader *));
/* Call this to finish preprocessing. If you requested dependency /* Call this to finish preprocessing. If you requested dependency
generation, pass an open stream to write the information to, generation, pass an open stream to write the information to,
...@@ -578,7 +563,7 @@ extern cppchar_t ...@@ -578,7 +563,7 @@ extern cppchar_t
cpp_interpret_charconst PARAMS ((cpp_reader *, const cpp_token *, cpp_interpret_charconst PARAMS ((cpp_reader *, const cpp_token *,
unsigned int *, int *)); unsigned int *, int *));
/* Used to register builtins during the register_builtins callback. /* Used to register macros and assertions, perhaps from the command line.
The text is the same as the command line argument. */ The text is the same as the command line argument. */
extern void cpp_define PARAMS ((cpp_reader *, const char *)); extern void cpp_define PARAMS ((cpp_reader *, const char *));
extern void cpp_assert PARAMS ((cpp_reader *, const char *)); extern void cpp_assert PARAMS ((cpp_reader *, const char *));
......
/* fix-header.c - Make C header file suitable for C++. /* fix-header.c - Make C header file suitable for C++.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2003 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -67,7 +67,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -67,7 +67,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
* INFILE.H is a full pathname for the input file (e.g. /usr/include/stdio.h) * INFILE.H is a full pathname for the input file (e.g. /usr/include/stdio.h)
* OUTFILE.H is the full pathname for where to write the output file, * OUTFILE.H is the full pathname for where to write the output file,
if anything needs to be done. (e.g. ./include/stdio.h) if anything needs to be done. (e.g. ./include/stdio.h)
* OPTIONS are such as you would pass to cpp. * OPTIONS can be -D or -I switches as you would pass to cpp.
Written by Per Bothner <bothner@cygnus.com>, July 1993. */ Written by Per Bothner <bothner@cygnus.com>, July 1993. */
...@@ -634,17 +634,28 @@ read_scan_file (in_fname, argc, argv) ...@@ -634,17 +634,28 @@ read_scan_file (in_fname, argc, argv)
for (i = 0; i < argc; i += strings_processed) for (i = 0; i < argc; i += strings_processed)
{ {
if (argv[i][0] == 'I') strings_processed = 0;
if (argv[i][0] == '-')
{
if (argv[i][1] == 'I')
{ {
if (argv[i][1] != '\0') if (argv[i][2] != '\0')
strings_processed = 1, add_path (argv[i] + 1, BRACKET, false); strings_processed = 1, add_path (argv[i] + 2, BRACKET, false);
else if (i + 1 == argc) else if (i + 1 == argc)
strings_processed = 0; strings_processed = 0;
else else
strings_processed = 2, add_path (argv[i + 1], BRACKET, false); strings_processed = 2, add_path (argv[i + 2], BRACKET, false);
} }
else if (argv[i][1] == 'D')
{
if (argv[i][2] != '\0')
strings_processed = 1, cpp_define (scan_in, argv[i] + 2);
else if (i + 1 == argc)
strings_processed = 0;
else else
strings_processed = cpp_handle_option (scan_in, argc - i, argv + i); strings_processed = 2, cpp_define (scan_in, argv[i + 1]);
}
}
if (strings_processed == 0) if (strings_processed == 0)
break; break;
...@@ -661,7 +672,9 @@ read_scan_file (in_fname, argc, argv) ...@@ -661,7 +672,9 @@ read_scan_file (in_fname, argc, argv)
if (! cpp_read_main_file (scan_in, in_fname, NULL)) if (! cpp_read_main_file (scan_in, in_fname, NULL))
exit (FATAL_EXIT_CODE); exit (FATAL_EXIT_CODE);
cpp_finish_options (scan_in); cpp_rename_file (scan_in, "<built-in>");
cpp_init_builtins (scan_in);
cpp_rename_file (scan_in, in_fname);
/* We are scanning a system header, so mark it as such. */ /* We are scanning a system header, so mark it as such. */
cpp_make_system_header (scan_in, 1, 0); cpp_make_system_header (scan_in, 1, 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