diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2002-08-07 18:32:13 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-08-07 18:32:13 +0000 |
commit | 0b6f2917cfcbfbaccca804e0f038ac8c4457f772 (patch) | |
tree | f482610e2d7395c411d78c8b0b4b49417cca0344 /gcc/cp | |
parent | e49ec17d553e4c1e5c3a18a6bb15627959c5a313 (diff) | |
download | gcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.zip gcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.tar.gz gcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.tar.bz2 |
Makefile.in (c-opts.o, [...]): Update.
* Makefile.in (c-opts.o, c-common.o, C_AND_OBJC_OBJS): Update.
* c-common.c: Don't include tree-inline.h.
(c_common_init_options, c_common_post_options): Move to c-opts.c.
* c-common.h (c_common_decode_option): New.
* c-decl.c (c_decode_option): Remove.
* c-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option.
* c-opts.c: New file.
* c-tree.h (c_decode_option): Remove.
* doc/passes.texi: Update.
* objc/objc-act.c (objc_decode_option): Remove.
* objc/objc-act.h (objc_decode_option): Remove.
* objc/ojbc-lang.c (LANG_HOOKS_DECODE_OPTION): Use
c_common_decode_option.
cp:
* Make-lang.in (CXX_C_OBJS): Update.
* cp-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option.
* cp-tree.h (cxx_decode_option): Remove.
* decl2.c (compare_options, lang_f_options, unsupported_options,
cxx_decode_option): Remove.
testsuite:
* objc.dg/const-str-2.m: Update.
* gcc.dg/cpp/c++98.c: Change to C extension.
* gcc.dg/cpp/c++98-pedantic.c: Similarly.
* gcc.dg/cpp/cpp.exp: Process .C extensions too.
From-SVN: r56105
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 2 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 318 |
5 files changed, 10 insertions, 321 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 60b6cb2..f5fe87b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2002-08-07 Neil Booth <neil@daikokuya.co.uk> + + * Make-lang.in (CXX_C_OBJS): Update. + * cp-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option. + * cp-tree.h (cxx_decode_option): Remove. + * decl2.c (compare_options, lang_f_options, unsupported_options, + cxx_decode_option): Remove. + 2002-08-06 Gabriel Dos Reis <gdr@nerim.net> * typeck.c (build_x_unary_op): Handle pointer-to-member. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index c3fd19b..738331f 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -96,7 +96,7 @@ $(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS) # The compiler itself. # 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 \ - c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o + c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o # Language-specific object files. CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 024534e..f2689b5 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -44,7 +44,7 @@ static tree cp_expr_size PARAMS ((tree)); #undef LANG_HOOKS_INIT_OPTIONS #define LANG_HOOKS_INIT_OPTIONS cxx_init_options #undef LANG_HOOKS_DECODE_OPTION -#define LANG_HOOKS_DECODE_OPTION cxx_decode_option +#define LANG_HOOKS_DECODE_OPTION c_common_decode_option #undef LANG_HOOKS_POST_OPTIONS #define LANG_HOOKS_POST_OPTIONS c_common_post_options #undef LANG_HOOKS_GET_ALIAS_SET diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5bdd419..b1af9fb 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3744,7 +3744,6 @@ extern bool have_extern_spec; /* in decl2.c */ extern int check_java_method PARAMS ((tree)); -extern int cxx_decode_option PARAMS ((int, char **)); extern int grok_method_quals PARAMS ((tree, tree, tree)); extern void warn_if_unknown_interface PARAMS ((tree)); extern void grok_x_components PARAMS ((tree)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 3f2fa1e..2644206 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -89,7 +89,6 @@ static tree prune_vars_needing_no_initialization PARAMS ((tree)); static void write_out_vars PARAMS ((tree)); static void import_export_class PARAMS ((tree)); static tree key_method PARAMS ((tree)); -static int compare_options PARAMS ((const PTR, const PTR)); static tree get_guard_bits PARAMS ((tree)); /* A list of static class variables. This is needed, because a @@ -122,323 +121,6 @@ tree static_dtors; tree global_namespace; -/* Table of language-dependent -f options. - STRING is the option name. VARIABLE is the address of the variable. - ON_VALUE is the value to store in VARIABLE - if `-fSTRING' is seen as an option. - (If `-fno-STRING' is seen as an option, the opposite value is stored.) */ - -static const struct { const char *const string; int *const variable; const int on_value;} -lang_f_options[] = -{ - /* C/C++ options. */ - {"signed-char", &flag_signed_char, 1}, - {"unsigned-char", &flag_signed_char, 0}, - {"signed-bitfields", &flag_signed_bitfields, 1}, - {"unsigned-bitfields", &flag_signed_bitfields, 0}, - {"short-enums", &flag_short_enums, 1}, - {"short-double", &flag_short_double, 1}, - {"short-wchar", &flag_short_wchar, 1}, - {"asm", &flag_no_asm, 0}, - {"builtin", &flag_no_builtin, 0}, - - /* C++-only options. */ - {"access-control", &flag_access_control, 1}, - {"check-new", &flag_check_new, 1}, - {"conserve-space", &flag_conserve_space, 1}, - {"const-strings", &flag_const_strings, 1}, - {"default-inline", &flag_default_inline, 1}, - {"dollars-in-identifiers", &dollars_in_ident, 1}, - {"elide-constructors", &flag_elide_constructors, 1}, - {"enforce-eh-specs", &flag_enforce_eh_specs, 1}, - {"external-templates", &flag_external_templates, 1}, - {"for-scope", &flag_new_for_scope, 2}, - {"gnu-keywords", &flag_no_gnu_keywords, 0}, - {"handle-exceptions", &flag_exceptions, 1}, - {"implement-inlines", &flag_implement_inlines, 1}, - {"implicit-inline-templates", &flag_implicit_inline_templates, 1}, - {"implicit-templates", &flag_implicit_templates, 1}, - {"ms-extensions", &flag_ms_extensions, 1}, - {"nonansi-builtins", &flag_no_nonansi_builtin, 0}, - {"optional-diags", &flag_optional_diags, 1}, - {"permissive", &flag_permissive, 1}, - {"repo", &flag_use_repository, 1}, - {"rtti", &flag_rtti, 1}, - {"stats", &flag_detailed_statistics, 1}, - {"vtable-gc", &flag_vtable_gc, 1}, - {"use-cxa-atexit", &flag_use_cxa_atexit, 1}, - {"weak", &flag_weak, 1} -}; - -/* The list of `-f' options that we no longer support. The `-f' - prefix is not given in this table. The `-fno-' variants are not - listed here. This table must be kept in alphabetical order. */ -static const char * const unsupported_options[] = { - "all-virtual", - "cond-mismatch", - "enum-int-equiv", - "guiding-decls", - "honor-std", - "huge-objects", - "labels-ok", - "new-abi", - "nonnull-objects", - "squangle", - "strict-prototype", - "this-is-variable", - "vtable-thunks", - "xref" -}; - -/* Compare two option strings, pointed two by P1 and P2, for use with - bsearch. */ - -static int -compare_options (p1, p2) - const PTR p1; - const PTR p2; -{ - return strcmp (*((const char *const *) p1), *((const char *const *) p2)); -} - -/* Decode the string P as a language-specific option. - Return the number of strings consumed for a valid option. - Otherwise return 0. Should not complain if it does not - recognise the option. */ - -int -cxx_decode_option (argc, argv) - int argc; - char **argv; -{ - int strings_processed; - const char *p = argv[0]; - - strings_processed = cpp_handle_option (parse_in, argc, argv); - - if (p[0] == '-' && p[1] == 'f') - { - /* Some kind of -f option. - P's value is the option sans `-f'. - Search for it in the table of options. */ - const char *option_value = NULL; - const char *positive_option; - size_t j; - - p += 2; - /* Try special -f options. */ - - /* See if this is one of the options no longer supported. We - used to support these options, so we continue to accept them, - with a warning. */ - if (strncmp (p, "no-", strlen ("no-")) == 0) - positive_option = p + strlen ("no-"); - else - positive_option = p; - - /* If the option is present, issue a warning. Indicate to our - caller that the option was processed successfully. */ - if (bsearch (&positive_option, - unsupported_options, - ARRAY_SIZE (unsupported_options), - sizeof (unsupported_options[0]), - compare_options)) - { - warning ("-f%s is no longer supported", p); - return 1; - } - - if (!strcmp (positive_option, "handle-exceptions")) - warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)"); - else if (!strcmp (p, "alt-external-templates")) - { - flag_external_templates = 1; - flag_alt_external_templates = 1; - cp_deprecated ("-falt-external-templates"); - } - else if (!strcmp (p, "no-alt-external-templates")) - flag_alt_external_templates = 0; - else if (!strcmp (p, "repo")) - { - flag_use_repository = 1; - flag_implicit_templates = 0; - } - else if (!strcmp (p, "external-templates")) - { - flag_external_templates = 1; - cp_deprecated ("-fexternal-templates"); - } - else if ((option_value - = skip_leading_substring (p, "template-depth-"))) - max_tinst_depth - = read_integral_parameter (option_value, p - 2, max_tinst_depth); - else if ((option_value - = skip_leading_substring (p, "name-mangling-version-"))) - { - warning ("-fname-mangling-version is no longer supported"); - return 1; - } - else if ((option_value = skip_leading_substring (p, "no-builtin-"))) - disable_builtin_function (option_value); - else if (dump_switch_p (p)) - ; - else - { - int found = 0; - - for (j = 0; !found && j < ARRAY_SIZE (lang_f_options); j++) - { - if (!strcmp (p, lang_f_options[j].string)) - { - *lang_f_options[j].variable = lang_f_options[j].on_value; - /* A goto here would be cleaner, - but breaks the VAX pcc. */ - found = 1; - } - else if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' - && ! strcmp (p+3, lang_f_options[j].string)) - { - *lang_f_options[j].variable = ! lang_f_options[j].on_value; - found = 1; - } - } - - return found; - } - } - else if (p[0] == '-' && p[1] == 'W') - { - int setting = 1; - - /* The -W options control the warning behavior of the compiler. */ - p += 2; - - if (p[0] == 'n' && p[1] == 'o' && p[2] == '-') - setting = 0, p += 3; - - if (!strcmp (p, "implicit")) - warn_implicit = setting; - else if (!strcmp (p, "long-long")) - warn_long_long = setting; - else if (!strcmp (p, "return-type")) - warn_return_type = setting; - else if (!strcmp (p, "ctor-dtor-privacy")) - warn_ctor_dtor_privacy = setting; - else if (!strcmp (p, "write-strings")) - warn_write_strings = setting; - else if (!strcmp (p, "cast-qual")) - warn_cast_qual = setting; - else if (!strcmp (p, "char-subscripts")) - warn_char_subscripts = setting; - else if (!strcmp (p, "pointer-arith")) - warn_pointer_arith = setting; - else if (!strcmp (p, "missing-prototypes")) - warn_missing_prototypes = setting; - else if (!strcmp (p, "strict-prototypes")) - { - if (setting == 0) - warning ("-Wno-strict-prototypes is not supported in C++"); - } - else if (!strcmp (p, "redundant-decls")) - warn_redundant_decls = setting; - else if (!strcmp (p, "missing-braces")) - warn_missing_braces = setting; - else if (!strcmp (p, "sign-compare")) - warn_sign_compare = setting; - else if (!strcmp (p, "float-equal")) - warn_float_equal = setting; - else if (!strcmp (p, "format")) - set_Wformat (setting); - else if (!strcmp (p, "format=2")) - set_Wformat (2); - else if (!strcmp (p, "format-y2k")) - warn_format_y2k = setting; - else if (!strcmp (p, "format-extra-args")) - warn_format_extra_args = setting; - else if (!strcmp (p, "format-nonliteral")) - warn_format_nonliteral = setting; - else if (!strcmp (p, "format-security")) - warn_format_security = setting; - else if (!strcmp (p, "missing-format-attribute")) - warn_missing_format_attribute = setting; - else if (!strcmp (p, "conversion")) - warn_conversion = setting; - else if (!strcmp (p, "parentheses")) - warn_parentheses = setting; - else if (!strcmp (p, "non-virtual-dtor")) - warn_nonvdtor = setting; - else if (!strcmp (p, "reorder")) - warn_reorder = setting; - else if (!strcmp (p, "synth")) - warn_synth = setting; - else if (!strcmp (p, "pmf-conversions")) - warn_pmf2ptr = setting; - else if (!strcmp (p, "effc++")) - warn_ecpp = setting; - else if (!strcmp (p, "sign-promo")) - warn_sign_promo = setting; - else if (!strcmp (p, "old-style-cast")) - warn_old_style_cast = setting; - else if (!strcmp (p, "overloaded-virtual")) - warn_overloaded_virtual = setting; - else if (!strcmp (p, "multichar")) - warn_multichar = setting; - else if (!strcmp (p, "unknown-pragmas")) - /* Set to greater than 1, so that even unknown pragmas in - system headers will be warned about. */ - warn_unknown_pragmas = setting * 2; - else if (!strcmp (p, "non-template-friend")) - warn_nontemplate_friend = setting; - else if (!strcmp (p, "deprecated")) - warn_deprecated = setting; - else if (!strcmp (p, "all")) - { - warn_return_type = setting; - set_Wunused (setting); - warn_implicit = setting; - warn_switch = setting; - set_Wformat (setting); - warn_parentheses = setting; - warn_missing_braces = setting; - warn_sign_compare = setting; - warn_multichar = setting; - /* We save the value of warn_uninitialized, since if they put - -Wuninitialized on the command line, we need to generate a - warning about not using it without also specifying -O. */ - if (warn_uninitialized != 1) - warn_uninitialized = (setting ? 2 : 0); - /* Only warn about unknown pragmas that are not in system - headers. */ - warn_unknown_pragmas = 1; - - /* C++-specific warnings. */ - warn_ctor_dtor_privacy = setting; - warn_nonvdtor = setting; - warn_reorder = setting; - warn_nontemplate_friend = setting; - } - else return strings_processed; - } - else if (!strcmp (p, "-E")) - flag_preprocess_only = 1; - else if (!strcmp (p, "-undef")) - flag_undef = 1; - else if (!strcmp (p, "-ansi")) - flag_no_nonansi_builtin = 1, flag_iso = 1, - flag_noniso_default_format_attributes = 0, flag_no_gnu_keywords = 1; -#ifdef SPEW_DEBUG - /* Undocumented, only ever used when you're invoking cc1plus by hand, since - it's probably safe to assume no sane person would ever want to use this - under normal circumstances. */ - else if (!strcmp (p, "-spew-debug")) - spew_debug = 1; -#endif - else - return strings_processed; - - return 1; -} - /* Incorporate `const' and `volatile' qualifiers for member functions. FUNCTION is a TYPE_DECL or a FUNCTION_DECL. QUALS is a list of qualifiers. Returns any explicit |