aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-03-08 21:12:26 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-03-08 21:12:26 +0000
commit4bfec48308a39e8ba1af2ebca9cbcddfac231b22 (patch)
tree6dbda9aef13aa04d7c15b46cb0bda16747482b8d /gcc/c-opts.c
parent9dd04ab53c8790dcb12aa7d4a0396a5ca58432da (diff)
downloadgcc-4bfec48308a39e8ba1af2ebca9cbcddfac231b22.zip
gcc-4bfec48308a39e8ba1af2ebca9cbcddfac231b22.tar.gz
gcc-4bfec48308a39e8ba1af2ebca9cbcddfac231b22.tar.bz2
c-common.h (c_common_init, [...]): Update.
* c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index ebf22d7..7f902ee9 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -39,6 +39,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# define TARGET_SYSTEM_ROOT NULL
#endif
+static int saved_lineno;
+
/* CPP's options. */
static cpp_options *cpp_opts;
@@ -1442,7 +1444,8 @@ c_common_decode_option (argc, argv)
/* Post-switch processing. */
bool
-c_common_post_options ()
+c_common_post_options (pfilename)
+ const char **pfilename;
{
/* Canonicalize the input and output filenames. */
if (in_fname == NULL || !strcmp (in_fname, "-"))
@@ -1492,26 +1495,6 @@ c_common_post_options ()
if (warn_missing_format_attribute && !warn_format)
warning ("-Wmissing-format-attribute ignored without -Wformat");
- /* If an error has occurred in cpplib, note it so we fail
- immediately. */
- errorcount += cpp_errors (parse_in);
-
- return flag_preprocess_only;
-}
-
-/* Front end initialization common to C, ObjC and C++. */
-const char *
-c_common_init (filename)
- const char *filename;
-{
- /* Set up preprocessor arithmetic. Must be done after call to
- c_common_nodes_and_builtins for type nodes to be good. */
- cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
- cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
- cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
- cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
- cpp_opts->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
-
if (flag_preprocess_only)
{
/* Open the output now. We must do so even if flag_no_output is
@@ -1539,19 +1522,43 @@ c_common_init (filename)
}
/* NOTE: we use in_fname here, not the one supplied. */
- filename = cpp_read_main_file (parse_in, in_fname, ident_hash);
+ *pfilename = cpp_read_main_file (parse_in, in_fname, ident_hash);
+
+ saved_lineno = lineno;
+ lineno = 0;
+
+ /* If an error has occurred in cpplib, note it so we fail
+ immediately. */
+ errorcount += cpp_errors (parse_in);
+
+ return flag_preprocess_only;
+}
+
+/* Front end initialization common to C, ObjC and C++. */
+bool
+c_common_init ()
+{
+ lineno = saved_lineno;
+
+ /* Set up preprocessor arithmetic. Must be done after call to
+ c_common_nodes_and_builtins for type nodes to be good. */
+ cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
+ cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
+ cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
+ cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
+ cpp_opts->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
if (flag_preprocess_only)
{
- if (filename)
+ if (main_input_filename)
preprocess_file (parse_in);
- return NULL;
+ return false;
}
/* Has to wait until now so that cpplib has its hash table. */
init_pragma ();
- return filename;
+ return true;
}
/* Common finish hook for the C, ObjC and C++ front ends. */