mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-11 05:23:55 +08:00
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
This commit is contained in:
parent
3bdf5ad138
commit
2228d450a9
@ -1,3 +1,7 @@
|
||||
2000-05-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* invoke.texi: Remove documentation for -fguiding-decls.
|
||||
|
||||
2000-05-31 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* configure.in: Fix typo last change.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -105,7 +105,7 @@ in the following sections.
|
||||
@smallexample
|
||||
-fno-access-control -fcheck-new -fconserve-space
|
||||
-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
|
||||
-fno-implement-inlines -fname-mangling-version-@var{n}
|
||||
-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
|
||||
word as an identifier. You can use the keyword @code{__typeof__} instead.
|
||||
@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
|
||||
Treat the @code{namespace std} as a namespace, instead of ignoring
|
||||
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
|
||||
function. Because this non-conforming behavior is no longer the default
|
||||
behavior for g++, @samp{-Wnon-template-friend} allows the compiler to
|
||||
check existing code for potential trouble spots, and is on by default.
|
||||
This new compiler behavior can also be turned off with the flag
|
||||
@samp{-fguiding-decls}, which activates the older, non-specification
|
||||
compiler code, or with @samp{-Wno-non-template-friend} which keeps the
|
||||
conformant compiler code but disables the helpful warning.
|
||||
This new compiler behavior can be turned off with
|
||||
@samp{-Wno-non-template-friend} which keeps the conformant compiler code
|
||||
but disables the helpful warning.
|
||||
|
||||
@item -Wold-style-cast (C++ only)
|
||||
Warn if an old-style (C-style) cast is used within a C++ program. The
|
||||
|
@ -1,20 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
// 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
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
// 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);
|
||||
}
|
@ -1,18 +0,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;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
// 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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user