summaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-09 21:30:35 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-09 21:30:35 +0000
commitb3e83e1eba81e04927df58e8a69338d9cb4fa9d4 (patch)
tree58b85f972de94f99b74cfcf79c3da6dcde633962 /gcc/c-opts.c
parentc1a3b6650d36a1defa9e50049828459716dbc661 (diff)
downloadgcc-b3e83e1eba81e04927df58e8a69338d9cb4fa9d4.tar.gz
2004-07-09 Zack Weinberg <zack@codesourcery.com>
Andrew Pinski <apinski@apple.com> * c-opts.c (c_common_post_options): Force unit-at-a-time mode on when we have more than one input file. (c_common_parse_file): Restore loop over all input files. Clarify diagnostic for -dy when YYDEBUG wasn't defined. * c-decl.c (set_type_context): New function. (pop_scope): Use it to set context of types. When we encounter a TYPE_DECL, set the context of the attached type too. (pop_file_scope): Don't call cpp_undef_all here. (diagnose_mismatched_decls): Do not complain about a second definition of an 'extern inline' function if it's not in the same translation unit. Do not complain about inline declaration after use if the use was in a different translation unit. (merge_decls): Don't clobber olddecl's DECL_CONTEXT. (pushdecl): Do not put DECL_EXTERNAL, !TREE_PUBLIC decls in the external scope. (pushdecl_top_level): Likewise. (grokdeclarator): Clarify what is going on with setting DECL_EXTERNAL on function types, a little. (c_write_global_declarations): Don't do anything if -fsyntax-only or errors have been encountered. testsuite: * gcc.dg/noncompile/init-4.c: Remove bogus dg-error marker. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84402 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 6ae668b1a6c..da35c5327fa 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -943,6 +943,11 @@ c_common_post_options (const char **pfilename)
flag_inline_functions = 0;
}
+ /* If we are given more than one input file, we must use
+ unit-at-a-time mode. */
+ if (num_in_fnames > 1)
+ flag_unit_at_a_time = 1;
+
/* Default to ObjC sjlj exception handling if NeXT runtime. */
if (flag_objc_sjlj_exceptions < 0)
flag_objc_sjlj_exceptions = flag_next_runtime;
@@ -1061,22 +1066,37 @@ c_common_init (void)
void
c_common_parse_file (int set_yydebug)
{
+ unsigned int i;
+
+ /* Enable parser debugging, if requested and we can. If requested
+ and we can't, notify the user. */
#if YYDEBUG != 0
yydebug = set_yydebug;
#else
if (set_yydebug)
- warning ("YYDEBUG not defined");
+ warning ("YYDEBUG was not defined at build time, -dy ignored");
#endif
- if (num_in_fnames > 1)
- fatal_error ("sorry, inter-module analysis temporarily out of commission");
-
- finish_options ();
- pch_init ();
- push_file_scope ();
- c_parse_file ();
- finish_file ();
- pop_file_scope ();
+ i = 0;
+ for (;;)
+ {
+ finish_options ();
+ pch_init ();
+ push_file_scope ();
+ c_parse_file ();
+ finish_file ();
+ pop_file_scope ();
+
+ if (++i >= num_in_fnames)
+ break;
+ cpp_undef_all (parse_in);
+ this_input_filename
+ = cpp_read_main_file (parse_in, in_fnames[i]);
+ /* If an input file is missing, abandon further compilation.
+ cpplib has issued a diagnostic. */
+ if (!this_input_filename)
+ break;
+ }
}
/* Common finish hook for the C, ObjC and C++ front ends. */