diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-05-31 19:27:12 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-05-31 19:27:12 +0000 |
commit | 2228d450a9eb92ee5fea87df6ffe226130d4aa0c (patch) | |
tree | b899b234e97bbbd63e088407c775cb6a7ee8c844 /gcc/cp | |
parent | 3bdf5ad13852aaa871ab41a6e8f509809c8c104d (diff) | |
download | gcc-2228d450a9eb92ee5fea87df6ffe226130d4aa0c.zip gcc-2228d450a9eb92ee5fea87df6ffe226130d4aa0c.tar.gz gcc-2228d450a9eb92ee5fea87df6ffe226130d4aa0c.tar.bz2 |
invoke.texi: Remove documentation for -fguiding-decls.
* invoke.texi: Remove documentation for -fguiding-decls.
Remove guiding declaration support.
* cp/cp-tree.h (flag_dump_translation_unit): Make it const.
(flag_guiding_decls): Remove.
* call.c (build_user_type_conversion_1): Remove support for
guiding decls.
(build_new_function_call): Likewise.
(build_new_op): Likewise.
(build_new_method_call): Likewise.
* decl.c (start_function): Likewise.
* friend.c (is_friend): Likewise.
(do_friend): Likewise.
* decl2.c ((flag_dump_translation_unit): Make it const.
(flag_guiding_decls): Remove.
(unsupported_options): New variable
(compare_options): New function.
(lang_decode_option): Use them.
From-SVN: r34306
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/cp/NEWS | 2 | ||||
-rw-r--r-- | gcc/cp/call.c | 30 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 64 | ||||
-rw-r--r-- | gcc/cp/friend.c | 21 |
7 files changed, 75 insertions, 67 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ffe112a..d9b48f5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -9,6 +9,23 @@ Wed May 31 14:09:00 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2000-05-31 Mark Mitchell <mark@codesourcery.com> + Remove guiding declaration support. + * cp/cp-tree.h (flag_dump_translation_unit): Make it const. + (flag_guiding_decls): Remove. + * call.c (build_user_type_conversion_1): Remove support for + guiding decls. + (build_new_function_call): Likewise. + (build_new_op): Likewise. + (build_new_method_call): Likewise. + * decl.c (start_function): Likewise. + * friend.c (is_friend): Likewise. + (do_friend): Likewise. + * decl2.c ((flag_dump_translation_unit): Make it const. + (flag_guiding_decls): Remove. + (unsupported_options): New variable + (compare_options): New function. + (lang_decode_option): Use them. + * decl.c (build_cp_library_fn): Set DECL_CONTEXT. * method.c (mangle_expression): Adjust test for legal expression diff --git a/gcc/cp/NEWS b/gcc/cp/NEWS index c320e8e..3a8fc4c 100644 --- a/gcc/cp/NEWS +++ b/gcc/cp/NEWS @@ -1,5 +1,7 @@ *** Changes since GCC 2.95: +* Support for guiding declarations has been removed. + * G++ now supports importing member functions from base classes with a using-declaration. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index eea70a6..5cabf13 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2470,14 +2470,6 @@ build_user_type_conversion_1 (totype, expr, flags) for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; ) p = &(TREE_OPERAND (*p, 0)); - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && !DECL_INITIAL (cand->fn) - && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE) - add_maybe_template (cand->fn, templates); - *p = build (USER_CONV, (DECL_CONSTRUCTOR_P (cand->fn) @@ -2593,13 +2585,6 @@ build_new_function_call (fn, args) return error_mark_node; } - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn)) - add_maybe_template (cand->fn, templates); - return build_over_call (cand, args, LOOKUP_NORMAL); } @@ -3388,14 +3373,6 @@ build_new_op (code, flags, arg1, arg2, arg3) : candidates->fn); } - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn) - && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE) - add_maybe_template (cand->fn, templates); - return build_over_call (cand, TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE @@ -4461,13 +4438,6 @@ build_new_method_call (instance, name, args, basetype_path, flags) || resolves_to_fixed_type_p (instance, 0))) flags |= LOOKUP_NONVIRTUAL; - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn)) - add_maybe_template (cand->fn, templates); - return build_over_call (cand, TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args, diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6e53ff2..070f4a4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1066,7 +1066,7 @@ extern int flag_const_strings; /* If non-NULL, dump the tree structure for the entire translation unit to this file. */ -extern char *flag_dump_translation_unit; +extern const char *flag_dump_translation_unit; /* Nonzero means warn about deprecated conversion from string constant to `char *'. */ @@ -1178,9 +1178,6 @@ extern int flag_default_inline; version 0. */ extern int name_mangling_version; -/* Nonzero means that guiding declarations are allowed. */ -extern int flag_guiding_decls; - /* Nonzero if wchar_t should be `unsigned short' instead of whatever it would normally be, for use with WINE. */ extern int flag_short_wchar; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6640b90..85de6ae 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13671,8 +13671,7 @@ start_function (declspecs, declarator, attrs, flags) if (!processing_template_decl && !(flags & SF_PRE_PARSED)) { /* A specialization is not used to guide overload resolution. */ - if ((flag_guiding_decls - || !DECL_TEMPLATE_SPECIALIZATION (decl1)) + if (!DECL_TEMPLATE_SPECIALIZATION (decl1) && ! DECL_FUNCTION_MEMBER_P (decl1)) decl1 = pushdecl (decl1); else diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5ce75ef..9bf2276 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -95,6 +95,7 @@ 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)); extern int current_class_depth; @@ -247,7 +248,7 @@ int flag_const_strings = 1; /* If non-NULL, dump the tree structure for the entire translation unit to this file. */ -char *flag_dump_translation_unit = 0; +const char *flag_dump_translation_unit = 0; /* Nonzero means warn about deprecated conversion from string constant to `char *'. */ @@ -471,9 +472,6 @@ int max_tinst_depth = 17; arguments. */ int name_mangling_version = 2; -/* Nonzero means that guiding declarations are allowed. */ -int flag_guiding_decls; - /* Nonzero if wchar_t should be `unsigned short' instead of whatever it would normally be, for use with WINE. */ int flag_short_wchar; @@ -561,6 +559,28 @@ lang_f_options[] = {"xref", &flag_gnu_xref, 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 *unsupported_options[] = { + "all-virtual", + "enum-int-equiv", + "guiding-decls" + "nonnull-objects", + "this-is-variable", +}; + +/* 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 (*((char **) p1), *((char **) 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 @@ -576,7 +596,7 @@ lang_decode_option (argc, argv) char **argv; { int strings_processed; - char *p = argv[0]; + const char *p = argv[0]; #if USE_CPPLIB strings_processed = cpp_handle_option (&parse_in, argc, argv); #else @@ -591,19 +611,36 @@ lang_decode_option (argc, argv) 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, + sizeof (unsupported_options[0]), + (sizeof (unsupported_options) + / sizeof (unsupported_options[0])), + compare_options)) + { + warning ("-f%s is no longer supported", p); + return 1; + } + if (!strcmp (p, "handle-exceptions") || !strcmp (p, "no-handle-exceptions")) warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)"); - else if (!strcmp (p, "all-virtual") - || !strcmp (p, "enum-int-equiv") - || !strcmp (p, "no-nonnull-objects") - || !strcmp (p, "this-is-variable")) - warning ("-f%s is no longer supported", p); else if (! strcmp (p, "alt-external-templates")) { flag_external_templates = 1; @@ -617,13 +654,6 @@ lang_decode_option (argc, argv) flag_use_repository = 1; flag_implicit_templates = 0; } - else if (!strcmp (p, "guiding-decls")) - { - flag_guiding_decls = 1; - name_mangling_version = 0; - } - else if (!strcmp (p, "no-guiding-decls")) - flag_guiding_decls = 0; else if (!strcmp (p, "external-templates")) { flag_external_templates = 1; diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index fee00a8..f4a5a57 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -63,19 +63,12 @@ is_friend (type, supplicant) if (supplicant == TREE_VALUE (friends)) return 1; - /* With -fguiding-decls we are more lenient about - friendship. This is bogus in general since two - specializations of a template with non-type - template parameters may have the same type, but - be different. - - Temporarily, we are also more lenient to deal - with nested friend functions, for which there can - be more than one FUNCTION_DECL, despite being the - same function. When that's fixed, the - FUNCTION_MEMBER_P bit can go. */ - if ((flag_guiding_decls - || DECL_FUNCTION_MEMBER_P (supplicant)) + /* Temporarily, we are more lenient to deal with + nested friend functions, for which there can be + more than one FUNCTION_DECL, despite being the + same function. When that's fixed, this bit can + go. */ + if (DECL_FUNCTION_MEMBER_P (supplicant) && same_type_p (TREE_TYPE (supplicant), TREE_TYPE (TREE_VALUE (friends)))) return 1; @@ -402,7 +395,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, decl = push_template_decl_real (decl, /*is_friend=*/1); if (warn_nontemplate_friend - && ! funcdef_flag && ! flag_guiding_decls && ! is_friend_template + && ! funcdef_flag && ! is_friend_template && current_template_parms && uses_template_parms (decl)) { static int explained; |