diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-07-11 08:33:21 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-07-11 08:33:21 +0000 |
commit | d1bd0ded61f9444ff6350fc7db89d04e72ca1108 (patch) | |
tree | 9b4a93a8c6ef46d7812bac262156dcddbbcf0593 /gcc/c-opts.c | |
parent | 6eeba0cc4337f356d68974b8341e84879ec6cd93 (diff) | |
download | gcc-d1bd0ded61f9444ff6350fc7db89d04e72ca1108.zip gcc-d1bd0ded61f9444ff6350fc7db89d04e72ca1108.tar.gz gcc-d1bd0ded61f9444ff6350fc7db89d04e72ca1108.tar.bz2 |
Index: ChangeLog
2003-07-10 Geoffrey Keating <geoffk@apple.com>
* c-decl.c (finish_decl): Handle 'used' here...
* cgraphunit.c (cgraph_finalize_function): ... and here ...
* c-common.c: (handle_used_attribute): ... not here.
* configure.in (onstep): Support --enable-intermodule.
* Makefile.in (OBJS-common): New.
(OBJS-md): New.
(OBJS-archive): New.
(OBJS): Build from OBJS-common, OBJS-md, OBJS-archive.
(OBJS-onestep): New.
(libbackend.a): Support @onestep@.
(libbackend.o): New.
* configure: Regenerate.
* c-common.h (c_reset_state): New prototype.
(c_parse_file): New prototype.
(finish_file): Move prototype from c-tree.h.
* c-decl.c: Include <hashtab.h>.
(builtin_decls): New.
(current_file_decl): New.
(duplicate_decls): Add extra parameter. Change all callers. Don't
output duplicate common symbols.
(link_hash_hash): New.
(link_hash_eq): New.
(poplevel): Handle popping of the top level.
(warn_if_shadowing): Handle TRANSLATION_UNIT_DECL.
(pushdecl): Set DECL_CONTEXT to TRANSLATION_UNIT_DECL if appropriate.
(pushdecl_top_level): Likewise.
(redeclaration_error_message): Handle TRANSLATION_UNIT_DECL.
(c_init_decl_processing): Create TRANSLATION_UNIT_DECL.
(finish_decl): Handle TRANSLATION_UNIT_DECL.
(merge_translation_unit_decls): New.
(c_write_global_declarations): New.
(c_reset_state): New.
(implicitly_declare): Handle TRANSLATION_UNIT_DECL.
* c-lang.c (LANG_HOOKS_WRITE_GLOBALS): New.
* c-objc-common.c (c_cannot_inline_tree_fn): Handle
TRANSLATION_UNIT_DECL.
(c_objc_common_finish_file): Call merge_translation_unit_decls.
* c-opts.c (in_fnames): Rename from in_fname.
(c_common_decode_option): Handle multiple input filenames.
(c_common_post_options): Likewise.
(c_common_parse_file): Likewise; also, call c_parse_file rather than
yyparse.
* c-parse.in: Move cleanup code to c_parse_file.
(free_parser_stacks): Move contents to c_parse_file.
(c_parse_file): New.
* c-tree.h (union lang_tree_node): Chain along TYPE_NEXT_VARIANT
for integer types.
(C_DECL_FILE_SCOPE): New.
(finish_file): Move prototype to c-common.h.
(merge_translation_unit_decls): New prototype.
(comptypes): Add extra parameter to prototype.
(c_write_global_declarations): New prototype.
* c-typeck.c (tagged_types_tu_compatible_p): New.
(function_types_compatible_p): Add extra parameter, change all callers.
(type_lists_compatible_p): Likewise.
(comptypes): Likewise.
(struct tagged_tu_seen): New.
(tagged_tu_seen_base): New.
(build_unary_op): Handle TRANSLATION_UNIT_DECL.
(c_mark_addressable): Remove #if 0 code.
* calls.c (special_function_p): Handle TRANSLATION_UNIT_DECL, add
comment explaining why it shouldn't have to.
* cgraph.h (struct cgraph_node): Add chain_next and chain_prev GTY
options.
* cppinit.c (cpp_read_next_file): New.
(cpp_read_main_file): Use it.
* cpplib.c (undefine_macros): New.
(cpp_undef_all): New.
* cpplib.h (cpp_read_next_file): Prototype.
(cpp_undef_all): Prototype.
* langhooks-def.h (write_global_declarations): Remove prototype.
* toplev.h (write_global_declarations): Add prototype.
* tree.c (decl_type_context): Use switch statement, handle
TRANSLATION_UNIT_DECL.
* tree.def: Update documentation for TRANSLATION_UNIT_DECL.
(TRANSLATION_UNIT_DECL): New kind of tree.
* tree.h: Update documentation for TRANSLATION_UNIT_DECL.
* Makefile.in (c-decl.o): Add $(HASHTAB_H) to dependencies.
* doc/invoke.texi: Make attempt to document new functionality.
2003-05-19 Per Bothner <bothner@apple.com>
* gcc.c (combine_inputs): New.
(process_command): Set combine_inputs.
(do_spec_1): Handle combine_inputs.
(main): Likewise.
Index: cp/ChangeLog
2003-07-10 Geoffrey Keating <geoffk@apple.com>
* decl.c (cp_finish_decl): Handle 'used' attribute.
* cp-lang.c (c_reset_state): New dummy routine.
* cp-tree.h (finish_file): Move prototype to c-common.h.
* parser.c (c_parse_file): Rename from yyparse; don't call finish_file.
From-SVN: r69224
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index a12ced1..bf60504 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -52,7 +52,8 @@ static int saved_lineno; static cpp_options *cpp_opts; /* Input filename. */ -static const char *in_fname; +static const char **in_fnames; +static unsigned num_in_fnames; /* Filename and stream for preprocessed output. */ static const char *out_fname; @@ -1039,12 +1040,9 @@ c_common_handle_option (size_t scode, const char *arg, int value) void c_common_handle_filename (const char *filename) { - if (!in_fname) - in_fname = filename; - else if (!out_fname) - out_fname = filename; - else - error ("output filename specified twice"); + num_in_fnames++; + in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0])); + in_fnames[num_in_fnames - 1] = filename; } /* Post-switch processing. */ @@ -1052,8 +1050,13 @@ bool c_common_post_options (const char **pfilename) { /* Canonicalize the input and output filenames. */ - if (in_fname == NULL || !strcmp (in_fname, "-")) - in_fname = ""; + if (in_fnames == NULL) + { + in_fnames = xmalloc (sizeof (in_fnames[0])); + in_fnames[0] = ""; + } + else if (strcmp (in_fnames[0], "-") == 0) + in_fnames[0] = ""; if (out_fname == NULL || !strcmp (out_fname, "-")) out_fname = ""; @@ -1119,6 +1122,10 @@ c_common_post_options (const char **pfilename) return false; } + if (num_in_fnames > 1) + error ("too many filenames given. Type %s --help for usage", + progname); + init_pp_output (out_stream); } else @@ -1132,7 +1139,7 @@ c_common_post_options (const char **pfilename) cpp_get_callbacks (parse_in)->file_change = cb_file_change; /* NOTE: we use in_fname here, not the one supplied. */ - *pfilename = cpp_read_main_file (parse_in, in_fname); + *pfilename = cpp_read_main_file (parse_in, in_fnames[0]); saved_lineno = input_line; input_line = 0; @@ -1176,23 +1183,43 @@ c_common_init (void) return true; } -/* A thin wrapper around the real parser that initializes the - integrated preprocessor after debug output has been initialized. - Also, make sure the start_source_file debug hook gets called for - the primary source file. */ +/* Initialize the integrated preprocessor after debug output has been + initialized; loop over each input file. */ void c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED) { + unsigned file_index; + #if YYDEBUG != 0 yydebug = set_yydebug; #else warning ("YYDEBUG not defined"); #endif - finish_options(); - pch_init(); - yyparse (); + file_index = 0; + + do + { + if (file_index > 0) + { + /* Reset the state of the parser. */ + c_reset_state(); + + /* Reset cpplib's macros and start a new file. */ + cpp_undef_all (parse_in); + cpp_read_next_file (parse_in, in_fnames[file_index]); + } + + finish_options(); + if (file_index == 0) + pch_init(); + c_parse_file (); + + file_index++; + } while (file_index < num_in_fnames); + free_parser_stacks (); + finish_file (); } /* Common finish hook for the C, ObjC and C++ front ends. */ |