Commit 2de45c06 by Martin v. Löwis Committed by Martin v. Löwis

extend.texi (Deprecated Features): New node.

	* extend.texi (Deprecated Features): New node.
	* invoke.texi (-Wdeprecated): Document.
	* cp/lang-options.h (-Wdeprecated): New flag.
	* cp/decl2.c (warn_deprecated): New flag.
	(lang_decode_option): Deprecated this-is-variable,
	external-templates, alt-external-templates.
	Support -Wdeprecated.
	* cp/errfn.c (cp_deprecated): New function.

From-SVN: r26438
parent 853c37e3
Wed Apr 14 13:59:27 1999 Martin von Loewis <loewis@informatik.hu-berlin.de>
* extend.texi (Deprecated Features): New node.
* invoke.texi (-Wdeprecated): Document.
Wed Apr 14 00:18:22 1999 Jan Hubicka <hubicka@freesoft.cz> Wed Apr 14 00:18:22 1999 Jan Hubicka <hubicka@freesoft.cz>
* i386.md (SImode logical compare): Avoid outputing non-pariable testw * i386.md (SImode logical compare): Avoid outputing non-pariable testw
......
1999-04-13 Martin von Loewis <loewis@informatik.hu-berlin.de>
* lang-options.h (-Wdeprecated): New flag.
* decl2.c (warn_deprecated): New flag.
(lang_decode_option): Deprecated this-is-variable,
external-templates, alt-external-templates.
Support -Wdeprecated.
* errfn.c (cp_deprecated): New function.
1999-04-13 Jason Merrill <jason@yorick.cygnus.com> 1999-04-13 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (setup_initp): Compare DECL_ASSEMBLER_NAME instead * decl2.c (setup_initp): Compare DECL_ASSEMBLER_NAME instead
......
...@@ -2959,6 +2959,7 @@ extern void cp_pedwarn PVPROTO((const char *, ...)); ...@@ -2959,6 +2959,7 @@ extern void cp_pedwarn PVPROTO((const char *, ...));
extern void cp_pedwarn_at PVPROTO((const char *, ...)); extern void cp_pedwarn_at PVPROTO((const char *, ...));
extern void cp_compiler_error PVPROTO((const char *, ...)); extern void cp_compiler_error PVPROTO((const char *, ...));
extern void cp_sprintf PVPROTO((const char *, ...)); extern void cp_sprintf PVPROTO((const char *, ...));
extern void cp_deprecated PROTO((const char*));
/* in error.c */ /* in error.c */
extern void init_error PROTO((void)); extern void init_error PROTO((void));
......
...@@ -315,6 +315,10 @@ int warn_multichar = 1; ...@@ -315,6 +315,10 @@ int warn_multichar = 1;
int warn_nontemplate_friend = 1; int warn_nontemplate_friend = 1;
/* Nonzero means complain about deprecated features. */
int warn_deprecated = 1;
/* Nonzero means `$' can be in an identifier. */ /* Nonzero means `$' can be in an identifier. */
#ifndef DOLLARS_IN_IDENTIFIERS #ifndef DOLLARS_IN_IDENTIFIERS
...@@ -566,6 +570,7 @@ lang_decode_option (argc, argv) ...@@ -566,6 +570,7 @@ lang_decode_option (argc, argv)
flag_external_templates = 1; flag_external_templates = 1;
flag_alt_external_templates = 1; flag_alt_external_templates = 1;
found = 1; found = 1;
cp_deprecated ("-falt-external-templates");
} }
else if (! strcmp (p, "no-alt-external-templates")) else if (! strcmp (p, "no-alt-external-templates"))
{ {
...@@ -589,6 +594,18 @@ lang_decode_option (argc, argv) ...@@ -589,6 +594,18 @@ lang_decode_option (argc, argv)
flag_guiding_decls = 0; flag_guiding_decls = 0;
found = 1; found = 1;
} }
else if (!strcmp (p, "this-is-variable"))
{
flag_this_is_variable = 1;
found = 1;
cp_deprecated ("-fthis-is-variable");
}
else if (!strcmp (p, "external-templates"))
{
flag_external_templates = 1;
found = 1;
cp_deprecated ("-fexternal-templates");
}
else if (!strcmp (p, "new-abi")) else if (!strcmp (p, "new-abi"))
{ {
flag_new_abi = 1; flag_new_abi = 1;
...@@ -698,6 +715,8 @@ lang_decode_option (argc, argv) ...@@ -698,6 +715,8 @@ lang_decode_option (argc, argv)
warn_unknown_pragmas = setting * 2; warn_unknown_pragmas = setting * 2;
else if (!strcmp (p, "non-template-friend")) else if (!strcmp (p, "non-template-friend"))
warn_nontemplate_friend = setting; warn_nontemplate_friend = setting;
else if (!strcmp (p, "deprecated"))
warn_deprecated = setting;
else if (!strcmp (p, "comment")) else if (!strcmp (p, "comment"))
; /* cpp handles this one. */ ; /* cpp handles this one. */
else if (!strcmp (p, "comments")) else if (!strcmp (p, "comments"))
......
...@@ -266,6 +266,17 @@ cp_compiler_error VPROTO((const char *format, ...)) ...@@ -266,6 +266,17 @@ cp_compiler_error VPROTO((const char *format, ...))
} }
void void
cp_deprecated (msg)
const char *msg;
{
extern int warn_deprecated;
if (!warn_deprecated)
return;
cp_warning ("%s is deprecated.", msg);
cp_warning ("Please see the documentation for details.");
}
void
cp_sprintf VPROTO((const char *format, ...)) cp_sprintf VPROTO((const char *format, ...))
{ {
#ifndef ANSI_PROTOTYPES #ifndef ANSI_PROTOTYPES
......
...@@ -130,4 +130,5 @@ DEFINE_LANG_NAME ("C++") ...@@ -130,4 +130,5 @@ DEFINE_LANG_NAME ("C++")
{ "-Wno-old-style-cast", "" }, { "-Wno-old-style-cast", "" },
{ "-Wnon-template-friend", "" }, { "-Wnon-template-friend", "" },
{ "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" }, { "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" },
{ "-Wdeprecated", "" },
{ "-Wno-deprecated", "Don't announce deprecation of compiler features" },
...@@ -65,6 +65,7 @@ C++ Language}, for extensions that apply @emph{only} to C++. ...@@ -65,6 +65,7 @@ C++ Language}, for extensions that apply @emph{only} to C++.
function. function.
* Return Address:: Getting the return or frame address of a function. * Return Address:: Getting the return or frame address of a function.
* Other Builtins:: Other built-in functions. * Other Builtins:: Other built-in functions.
* Deprecated Features:: Things might disappear from g++.
@end menu @end menu
@end ifset @end ifset
@ifclear INTERNALS @ifclear INTERNALS
...@@ -112,6 +113,7 @@ C++ Language}, for extensions that apply @emph{only} to C++. ...@@ -112,6 +113,7 @@ C++ Language}, for extensions that apply @emph{only} to C++.
* Function Names:: Printable strings which are the name of the current * Function Names:: Printable strings which are the name of the current
function. function.
* Return Address:: Getting the return or frame address of a function. * Return Address:: Getting the return or frame address of a function.
* Deprecated Features:: Things might disappear from g++.
@end menu @end menu
@end ifclear @end ifclear
...@@ -3090,6 +3092,36 @@ or constructor expression (@pxref{Constructors}) and will not return 1 ...@@ -3090,6 +3092,36 @@ or constructor expression (@pxref{Constructors}) and will not return 1
when you pass a constant numeric value to the inline function unless you when you pass a constant numeric value to the inline function unless you
specify the @samp{-O} option. specify the @samp{-O} option.
@node Deprecated Features
@section Deprecated Features
In the past, the GNU C++ compiler was extended to experiment with new
features, at a time when the C++ language was still evolving. Now that
the C++ standard is complete, some of those features are superceded by
superior alternatives. Using the old features might cause a warning in
some cases that the feature will be dropped in the future. In other
cases, the feature might be gone already.
While the list below is not exhaustive, it documents some of the options
that are now deprecated:
@table @code
@item -fthis-is-variable
In early versions of C++, assignment to this could be used to implement
application-defined memory allocation. Now, allocation functions
(@samp{operator new}) are the standard-conforming way to achieve the
same effect.
@item -fexternal-templates
@itemx -falt-external-templates
These are two of the many ways for g++ to implement template
instantiation. @xref{Template Instantiation}. The C++ standard clearly
defines how template definitions have to be organized across
implementation units. g++ has an implicit instantiation mechanism that
should work just fine for standard-conforming code.
@end table
@node C++ Extensions @node C++ Extensions
@chapter Extensions to the C++ Language @chapter Extensions to the C++ Language
@cindex extensions, C++ language @cindex extensions, C++ language
......
...@@ -109,7 +109,8 @@ in the following sections. ...@@ -109,7 +109,8 @@ in the following sections.
-fno-implement-inlines -fname-mangling-version-@var{n} -fno-default-inline -fno-implement-inlines -fname-mangling-version-@var{n} -fno-default-inline
-foperator-names -fno-optional-diags -frepo -fstrict-prototype -foperator-names -fno-optional-diags -frepo -fstrict-prototype
-fsquangle -ftemplate-depth-@var{n} -fthis-is-variable -fvtable-thunks -fsquangle -ftemplate-depth-@var{n} -fthis-is-variable -fvtable-thunks
-nostdinc++ -Wctor-dtor-privacy -Weffc++ -Wno-non-template-friend -nostdinc++ -Wctor-dtor-privacy -Wno-deprecated -Weffc++
-Wno-non-template-friend
-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual
-Wno-pmf-conversions -Wreorder -Wsign-promo -Wsynth -Wno-pmf-conversions -Wreorder -Wsign-promo -Wsynth
@end smallexample @end smallexample
...@@ -1218,6 +1219,9 @@ Warn about violations of various style guidelines from Scott Meyers' ...@@ -1218,6 +1219,9 @@ Warn about violations of various style guidelines from Scott Meyers'
that the standard library headers do not obey all of these guidelines; that the standard library headers do not obey all of these guidelines;
you can use @samp{grep -v} to filter out those warnings. you can use @samp{grep -v} to filter out those warnings.
@item -Wno-deprecated (C++ only)
Do not warn about usage of deprecated features. @xref{Deprecated Features}.
@item -Wno-non-template-friend (C++ only) @item -Wno-non-template-friend (C++ only)
Disable warnings when non-templatized friend functions are declared Disable warnings when non-templatized friend functions are declared
within a template. With the advent of explicit template specification within a template. With the advent of explicit template specification
......
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