* 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
+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.
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
*** 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.
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)
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);
}
: 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
|| 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,
/* 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 *'. */
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;
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
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;
/* 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 *'. */
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;
{"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
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
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;
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;
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;
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;
@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
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,
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
+++ /dev/null
-// 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;
-}
-
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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");
-}
-