Commit 2228d450 by Mark Mitchell Committed by Mark Mitchell

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
parent 3bdf5ad1
2000-05-31 Mark Mitchell <mark@codesourcery.com>
* invoke.texi: Remove documentation for -fguiding-decls.
2000-05-31 Richard Henderson <rth@cygnus.com> 2000-05-31 Richard Henderson <rth@cygnus.com>
* configure.in: Fix typo last change. * configure.in: Fix typo last change.
......
...@@ -9,6 +9,23 @@ Wed May 31 14:09:00 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> ...@@ -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> 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. * decl.c (build_cp_library_fn): Set DECL_CONTEXT.
* method.c (mangle_expression): Adjust test for legal expression * method.c (mangle_expression): Adjust test for legal expression
......
*** Changes since GCC 2.95: *** Changes since GCC 2.95:
* Support for guiding declarations has been removed.
* G++ now supports importing member functions from base classes with a * G++ now supports importing member functions from base classes with a
using-declaration. using-declaration.
......
...@@ -2470,14 +2470,6 @@ build_user_type_conversion_1 (totype, expr, flags) ...@@ -2470,14 +2470,6 @@ build_user_type_conversion_1 (totype, expr, flags)
for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; ) for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; )
p = &(TREE_OPERAND (*p, 0)); 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 *p = build
(USER_CONV, (USER_CONV,
(DECL_CONSTRUCTOR_P (cand->fn) (DECL_CONSTRUCTOR_P (cand->fn)
...@@ -2593,13 +2585,6 @@ build_new_function_call (fn, args) ...@@ -2593,13 +2585,6 @@ build_new_function_call (fn, args)
return error_mark_node; 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); return build_over_call (cand, args, LOOKUP_NORMAL);
} }
...@@ -3388,14 +3373,6 @@ build_new_op (code, flags, arg1, arg2, arg3) ...@@ -3388,14 +3373,6 @@ build_new_op (code, flags, arg1, arg2, arg3)
: candidates->fn); : 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 return build_over_call
(cand, (cand,
TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
...@@ -4461,13 +4438,6 @@ build_new_method_call (instance, name, args, basetype_path, flags) ...@@ -4461,13 +4438,6 @@ build_new_method_call (instance, name, args, basetype_path, flags)
|| resolves_to_fixed_type_p (instance, 0))) || resolves_to_fixed_type_p (instance, 0)))
flags |= LOOKUP_NONVIRTUAL; 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 return build_over_call
(cand, (cand,
TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args, TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args,
......
...@@ -1066,7 +1066,7 @@ extern int flag_const_strings; ...@@ -1066,7 +1066,7 @@ extern int flag_const_strings;
/* If non-NULL, dump the tree structure for the entire translation /* If non-NULL, dump the tree structure for the entire translation
unit to this file. */ 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 /* Nonzero means warn about deprecated conversion from string constant to
`char *'. */ `char *'. */
...@@ -1178,9 +1178,6 @@ extern int flag_default_inline; ...@@ -1178,9 +1178,6 @@ extern int flag_default_inline;
version 0. */ version 0. */
extern int name_mangling_version; 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 /* Nonzero if wchar_t should be `unsigned short' instead of whatever it
would normally be, for use with WINE. */ would normally be, for use with WINE. */
extern int flag_short_wchar; extern int flag_short_wchar;
......
...@@ -13671,8 +13671,7 @@ start_function (declspecs, declarator, attrs, flags) ...@@ -13671,8 +13671,7 @@ start_function (declspecs, declarator, attrs, flags)
if (!processing_template_decl && !(flags & SF_PRE_PARSED)) if (!processing_template_decl && !(flags & SF_PRE_PARSED))
{ {
/* A specialization is not used to guide overload resolution. */ /* A specialization is not used to guide overload resolution. */
if ((flag_guiding_decls if (!DECL_TEMPLATE_SPECIALIZATION (decl1)
|| !DECL_TEMPLATE_SPECIALIZATION (decl1))
&& ! DECL_FUNCTION_MEMBER_P (decl1)) && ! DECL_FUNCTION_MEMBER_P (decl1))
decl1 = pushdecl (decl1); decl1 = pushdecl (decl1);
else else
......
...@@ -95,6 +95,7 @@ static tree prune_vars_needing_no_initialization PARAMS ((tree)); ...@@ -95,6 +95,7 @@ static tree prune_vars_needing_no_initialization PARAMS ((tree));
static void write_out_vars PARAMS ((tree)); static void write_out_vars PARAMS ((tree));
static void import_export_class PARAMS ((tree)); static void import_export_class PARAMS ((tree));
static tree key_method PARAMS ((tree)); static tree key_method PARAMS ((tree));
static int compare_options PARAMS ((const PTR, const PTR));
extern int current_class_depth; extern int current_class_depth;
...@@ -247,7 +248,7 @@ int flag_const_strings = 1; ...@@ -247,7 +248,7 @@ int flag_const_strings = 1;
/* If non-NULL, dump the tree structure for the entire translation /* If non-NULL, dump the tree structure for the entire translation
unit to this file. */ 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 /* Nonzero means warn about deprecated conversion from string constant to
`char *'. */ `char *'. */
...@@ -471,9 +472,6 @@ int max_tinst_depth = 17; ...@@ -471,9 +472,6 @@ int max_tinst_depth = 17;
arguments. */ arguments. */
int name_mangling_version = 2; 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 /* Nonzero if wchar_t should be `unsigned short' instead of whatever it
would normally be, for use with WINE. */ would normally be, for use with WINE. */
int flag_short_wchar; int flag_short_wchar;
...@@ -561,6 +559,28 @@ lang_f_options[] = ...@@ -561,6 +559,28 @@ lang_f_options[] =
{"xref", &flag_gnu_xref, 1} {"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. /* Decode the string P as a language-specific option.
Return the number of strings consumed for a valid option. Return the number of strings consumed for a valid option.
Otherwise return 0. Should not complain if it does not Otherwise return 0. Should not complain if it does not
...@@ -576,7 +596,7 @@ lang_decode_option (argc, argv) ...@@ -576,7 +596,7 @@ lang_decode_option (argc, argv)
char **argv; char **argv;
{ {
int strings_processed; int strings_processed;
char *p = argv[0]; const char *p = argv[0];
#if USE_CPPLIB #if USE_CPPLIB
strings_processed = cpp_handle_option (&parse_in, argc, argv); strings_processed = cpp_handle_option (&parse_in, argc, argv);
#else #else
...@@ -591,19 +611,36 @@ lang_decode_option (argc, argv) ...@@ -591,19 +611,36 @@ lang_decode_option (argc, argv)
P's value is the option sans `-f'. P's value is the option sans `-f'.
Search for it in the table of options. */ Search for it in the table of options. */
const char *option_value = NULL; const char *option_value = NULL;
const char *positive_option;
size_t j; size_t j;
p += 2; p += 2;
/* Try special -f options. */ /* 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") if (!strcmp (p, "handle-exceptions")
|| !strcmp (p, "no-handle-exceptions")) || !strcmp (p, "no-handle-exceptions"))
warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)"); 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")) else if (! strcmp (p, "alt-external-templates"))
{ {
flag_external_templates = 1; flag_external_templates = 1;
...@@ -617,13 +654,6 @@ lang_decode_option (argc, argv) ...@@ -617,13 +654,6 @@ lang_decode_option (argc, argv)
flag_use_repository = 1; flag_use_repository = 1;
flag_implicit_templates = 0; 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")) else if (!strcmp (p, "external-templates"))
{ {
flag_external_templates = 1; flag_external_templates = 1;
......
...@@ -63,19 +63,12 @@ is_friend (type, supplicant) ...@@ -63,19 +63,12 @@ is_friend (type, supplicant)
if (supplicant == TREE_VALUE (friends)) if (supplicant == TREE_VALUE (friends))
return 1; return 1;
/* With -fguiding-decls we are more lenient about /* Temporarily, we are more lenient to deal with
friendship. This is bogus in general since two nested friend functions, for which there can be
specializations of a template with non-type more than one FUNCTION_DECL, despite being the
template parameters may have the same type, but same function. When that's fixed, this bit can
be different. go. */
if (DECL_FUNCTION_MEMBER_P (supplicant)
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))
&& same_type_p (TREE_TYPE (supplicant), && same_type_p (TREE_TYPE (supplicant),
TREE_TYPE (TREE_VALUE (friends)))) TREE_TYPE (TREE_VALUE (friends))))
return 1; return 1;
...@@ -402,7 +395,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, ...@@ -402,7 +395,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
decl = push_template_decl_real (decl, /*is_friend=*/1); decl = push_template_decl_real (decl, /*is_friend=*/1);
if (warn_nontemplate_friend if (warn_nontemplate_friend
&& ! funcdef_flag && ! flag_guiding_decls && ! is_friend_template && ! funcdef_flag && ! is_friend_template
&& current_template_parms && uses_template_parms (decl)) && current_template_parms && uses_template_parms (decl))
{ {
static int explained; static int explained;
......
...@@ -105,7 +105,7 @@ in the following sections. ...@@ -105,7 +105,7 @@ in the following sections.
@smallexample @smallexample
-fno-access-control -fcheck-new -fconserve-space -fno-access-control -fcheck-new -fconserve-space
-fdollars-in-identifiers -fno-elide-constructors -fexternal-templates -fdollars-in-identifiers -fno-elide-constructors -fexternal-templates
-ffor-scope -fno-for-scope -fno-gnu-keywords -fguiding-decls -fhonor-std -ffor-scope -fno-for-scope -fno-gnu-keywords -fhonor-std
-fhuge-objects -fno-implicit-templates -finit-priority -fhuge-objects -fno-implicit-templates -finit-priority
-fno-implement-inlines -fname-mangling-version-@var{n} -fno-implement-inlines -fname-mangling-version-@var{n}
-fno-default-inline -fno-operator-names -fno-optional-diags -fpermissive -fno-default-inline -fno-operator-names -fno-optional-diags -fpermissive
...@@ -1103,20 +1103,6 @@ Do not recognize @code{typeof} as a keyword, so that code can use this ...@@ -1103,20 +1103,6 @@ Do not recognize @code{typeof} as a keyword, so that code can use this
word as an identifier. You can use the keyword @code{__typeof__} instead. word as an identifier. You can use the keyword @code{__typeof__} instead.
@samp{-ansi} implies @samp{-fno-gnu-keywords}. @samp{-ansi} implies @samp{-fno-gnu-keywords}.
@item -fguiding-decls
Treat a function declaration with the same type as a potential function
template instantiation as though it declares that instantiation, not a
normal function. If a definition is given for the function later in the
translation unit (or another translation unit if the target supports
weak symbols), that definition will be used; otherwise the template will
be instantiated. This behavior reflects the C++ language prior to
September 1996, when guiding declarations were removed.
This option implies @samp{-fname-mangling-version-0}, and will not work
with other name mangling versions. Like all options that change the
ABI, all C++ code, @emph{including libgcc.a} must be built with the same
setting of this option.
@item -fhonor-std @item -fhonor-std
Treat the @code{namespace std} as a namespace, instead of ignoring Treat the @code{namespace std} as a namespace, instead of ignoring
it. For compatibility with earlier versions of g++, the compiler will, it. For compatibility with earlier versions of g++, the compiler will,
...@@ -1328,10 +1314,9 @@ could be interpreted as a particular specialization of a templatized ...@@ -1328,10 +1314,9 @@ could be interpreted as a particular specialization of a templatized
function. Because this non-conforming behavior is no longer the default function. Because this non-conforming behavior is no longer the default
behavior for g++, @samp{-Wnon-template-friend} allows the compiler to behavior for g++, @samp{-Wnon-template-friend} allows the compiler to
check existing code for potential trouble spots, and is on by default. check existing code for potential trouble spots, and is on by default.
This new compiler behavior can also be turned off with the flag This new compiler behavior can be turned off with
@samp{-fguiding-decls}, which activates the older, non-specification @samp{-Wno-non-template-friend} which keeps the conformant compiler code
compiler code, or with @samp{-Wno-non-template-friend} which keeps the but disables the helpful warning.
conformant compiler code but disables the helpful warning.
@item -Wold-style-cast (C++ only) @item -Wold-style-cast (C++ only)
Warn if an old-style (C-style) cast is used within a C++ program. The Warn if an old-style (C-style) cast is used within a C++ program. The
......
// GROUPS passed templates
// Test that the compiler will emit the definition of min given just
// the declaration. At one point in the past, it did not.
// Special g++ Options: -fguiding-decls
#include <iostream.h>
template <class T> inline T min(T a, T b) { return (a < b) ? a : b;};
double min(double,double); // this should expand the template
main () {
int a = 1, b = 2;
double aa = 2.0, bb = 1.2;
cout << min(a,b) << ", " << min(aa,bb) << "\n";
if (min (a, aa) == a)
cout << "PASS" << endl;
else
cout << "FAIL" << endl;
}
// PRMS Id: 4257 (second bug)
// Bug: g++ fails to recognize multiple previous instantiations of a function
// template.
// Build don't link:
// Special g++ Options: -fguiding-decls
template <class T>
class A {
int i;
friend int foo (A<T>&);
};
template <class T> int foo (A<T>& a) { return a.i; }
A<int> a;
A<char> dummy;
void bar ()
{
foo (a); // gets bogus error - two foo(A<int>&)'s
}
// Bug: g++ fails to actually instantiate templates to the specifications of
// guiding decls.
// Special g++ Options: -g -ansi -pedantic-errors -fguiding-decls
template <class T> inline T min (T a, T b) { return a<b?a:b; }
double min (double, double);
int main () {
return (int) min (0, 1.0);
}
// Special g++ Options: -fguiding-decls
struct A {
friend int operator== (const A&, const A&);
A (int) { }
};
template <class T> int
operator== (const T&, const T&)
{
return 0;
}
main ()
{
A a (1);
return a == 1;
}
// GROUPS passed templates
// Special g++ Options: -fguiding-decls
extern "C" int printf (const char *, ...);
template<class T> T max(T a, T b) { return a > b ? a : b; }
int max(int, int);
main()
{
int j;
j = max(1,2);
j = max (1, 'c');
printf ("PASS\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment