diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2003-06-30 19:36:25 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2003-06-30 19:36:25 +0000 |
commit | 37fa72e9d359a0c00c3b62e9aabd74276daa6602 (patch) | |
tree | 01d40120cc52c2574f790a44609bf19f0551b019 /gcc/c-opts.c | |
parent | 4497827651d07fa10006fbac4cf63a92cf83c2a2 (diff) | |
download | gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.zip gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.gz gcc-37fa72e9d359a0c00c3b62e9aabd74276daa6602.tar.bz2 |
c-common.c (enum c_language_kind, flag_objc): Remove.
* c-common.c (enum c_language_kind, flag_objc): Remove.
(fix_string_type, check_case_value, c_common_nodes_and_builtins,
c_add_case_label, finish_label_addr_expr, boolean_increment):
Use c_dialect_ macros.
* c-common.h (enum c_language_kind): Extend.
(c_dialect_cxx, c_dialect_objc): New.
(flag_objc): Remove.
(c_common_init_options): Update prototype.
* c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_
macros.
* c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_
macros.
* c-format.c (C_STD_VER, C_STD_NAME): Similarly.
* c-lang.c (c_init_options): Remove.
(c_language): Define.
(LANG_HOOKS_INIT_OPTIONS): Use common hook.
* c-lex.c (lex_charconst): Use c_dialect_cxx().
* c-opts.c (lang_flags): Make function-local.
(c_common_init_options): Use c_dialect_ macros. Handle
C++ diagnostic requirements.
(c_common_handle_option, c_common_post_options): Use flag_cxx.
* c-parse.in (init_reswords): Use c_dialect_objc ().
* c-pch.c (get_ident): Use c_language.
* c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros.
* c-typeck.c (comptypes, build_c_cast): Similarly.
* objc/objc-lang.c (c_language): Define.
(LANG_HOOKS_INIT_OPTIONS): Use common hook.
(objc_init_options): Remove.
cp:
* Make-lang.in: Update.
* cp-lang.c (c_language): Define.
(LANG_HOOKS_INIT_OPTIONS): Use common hook.
* cp-tree.h (cxx_init_options): Remove.
* lex.c: Don't include diagnostic.h.
(cxx_init_options): Remove.
From-SVN: r68734
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r-- | gcc/c-opts.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c index dbe7e90..09c58b9 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -50,8 +50,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA # define TARGET_EBCDIC 0 #endif -static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX}; - static int saved_lineno; /* CPP's options. */ @@ -213,25 +211,38 @@ defer_opt (enum opt_code code, const char *arg) /* Common initialization before parsing options. */ int -c_common_init_options (enum c_language_kind lang) +c_common_init_options (void) { - c_language = lang; - parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89 : CLK_GNUCXX, + static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX}; + + /* This is conditionalized only because that is the way the front + ends used to do it. Maybe this should be unconditional? */ + if (c_dialect_cxx ()) + { + /* By default wrap lines at 80 characters. Is getenv + ("COLUMNS") preferable? */ + diagnostic_line_cutoff (global_dc) = 80; + /* By default, emit location information once for every + diagnostic message. */ + diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE; + } + + parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89, ident_hash); + cpp_opts = cpp_get_options (parse_in); cpp_opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS; + cpp_opts->objc = c_dialect_objc (); /* Reset to avoid warnings on internal definitions. We set it just before passing on command-line options to cpplib. */ cpp_opts->warn_dollars = 0; - if (flag_objc) - cpp_opts->objc = 1; - - flag_const_strings = (lang == clk_cplusplus); - warn_pointer_arith = (lang == clk_cplusplus); + flag_const_strings = c_dialect_cxx (); + flag_exceptions = c_dialect_cxx (); + warn_pointer_arith = c_dialect_cxx (); - return lang_flags[(c_language << 1) + flag_objc]; + return lang_flags[c_language]; } /* Handle switch SCODE with argument ARG. ON is true, unless no- @@ -366,7 +377,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) warn_parentheses = value; warn_return_type = value; warn_sequence_point = value; /* Was C only. */ - if (c_language == clk_cplusplus) + if (c_dialect_cxx ()) warn_sign_compare = value; warn_switch = value; warn_strict_aliasing = value; @@ -381,7 +392,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) if (warn_uninitialized != 1) warn_uninitialized = (value ? 2 : 0); - if (c_language == clk_c) + if (!c_dialect_cxx ()) /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn it off only if it's not explicit. */ warn_main = value * 2; @@ -644,14 +655,14 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_Wwrite_strings: - if (c_language == clk_c) + if (!c_dialect_cxx ()) flag_const_strings = value; else warn_write_strings = value; break; case OPT_ansi: - if (c_language == clk_c) + if (!c_dialect_cxx ()) set_std_c89 (false, true); else set_std_cxx98 (true); @@ -662,7 +673,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_fcond_mismatch: - if (c_language == clk_c) + if (!c_dialect_cxx ()) { flag_cond_mismatch = value; break; @@ -1053,8 +1064,7 @@ c_common_post_options (const char **pfilename) sanitize_cpp_opts (); register_include_chains (parse_in, sysroot, iprefix, - std_inc, std_cxx_inc && c_language == clk_cplusplus, - verbose); + std_inc, std_cxx_inc && c_dialect_cxx (), verbose); flag_inline_trees = 1; |