Commit 6ea2bd47 by Jason Merrill Committed by Jason Merrill

re PR c++/25185 (deep typedef substitution in error message)

	PR c++/25185
	* c-common.h, c-common.c: Add flag_pretty_templates.
	* c-opts.c (c_common_handle_option): Set it.
	* c.opt: Add -fno-pretty-templates.
	* doc/invoke.texi (C++ Dialect Options): Likewise.

	* error.c (dump_function_decl): Don't pretty-print templates
	if -fno-pretty-templates.
	(count_non_default_template_args): Print all args if
	-fno-pretty-templates.

From-SVN: r145697
parent a2dc5812
2009-04-07 Jason Merrill <jason@redhat.com>
PR c++/25185
* c-common.h, c-common.c: Add flag_pretty_templates.
* c-opts.c (c_common_handle_option): Set it.
* c.opt: Add -fno-pretty-templates.
* doc/invoke.texi (C++ Dialect Options): Likewise.
2009-04-07 Uros Bizjak <ubizjak@gmail.com>
* config/ia64/ia64.c (ia64_builtins): Add IA64_BUILTIN_HUGE_VALQ.
......
......@@ -593,6 +593,11 @@ int flag_enforce_eh_specs = 1;
int flag_threadsafe_statics = 1;
/* Nonzero if we want to pretty-print template specializations as the
template signature followed by the arguments. */
int flag_pretty_templates = 1;
/* Nonzero means warn about implicit declarations. */
int warn_implicit = 1;
......
......@@ -695,6 +695,11 @@ extern int flag_enforce_eh_specs;
extern int flag_threadsafe_statics;
/* Nonzero if we want to pretty-print template specializations as the
template signature followed by the arguments. */
extern int flag_pretty_templates;
/* Nonzero means warn about implicit declarations. */
extern int warn_implicit;
......
......@@ -808,6 +808,10 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_threadsafe_statics = value;
break;
case OPT_fpretty_templates:
flag_pretty_templates = value;
break;
case OPT_fzero_link:
flag_zero_link = value;
break;
......
......@@ -716,6 +716,10 @@ fpreprocessed
C ObjC C++ ObjC++
Treat the input file as already preprocessed
fpretty-templates
C++ ObjC++
-fno-pretty-templates Do not pretty-print template specializations as the template signature followed by the arguments
freplace-objc-classes
ObjC ObjC++
Used in Fix-and-Continue mode to indicate that object files may be swapped in at runtime
......
2009-04-07 Jason Merrill <jason@redhat.com>
PR c++/25185
* error.c (dump_function_decl): Don't pretty-print templates
if -fno-pretty-templates.
(count_non_default_template_args): Print all args if
-fno-pretty-templates.
2009-04-06 Jason Merrill <jason@redhat.com>
PR c++/35146
......
......@@ -163,7 +163,7 @@ count_non_default_template_args (tree args, tree params)
int n = TREE_VEC_LENGTH (args);
int last;
if (params == NULL_TREE)
if (params == NULL_TREE || !flag_pretty_templates)
return n;
for (last = n - 1; last >= 0; --last)
......@@ -1206,7 +1206,8 @@ dump_function_decl (tree t, int flags)
exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (t));
/* Pretty print template instantiations only. */
if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t))
if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t)
&& flag_pretty_templates)
{
tree tmpl;
......
......@@ -188,6 +188,7 @@ in the following sections.
-fno-implement-inlines -fms-extensions @gol
-fno-nonansi-builtins -fno-operator-names @gol
-fno-optional-diags -fpermissive @gol
-fno-pretty-templates @gol
-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
-fno-default-inline -fvisibility-inlines-hidden @gol
......@@ -1834,6 +1835,19 @@ Downgrade some diagnostics about nonconformant code from errors to
warnings. Thus, using @option{-fpermissive} will allow some
nonconforming code to compile.
@item -fno-pretty-templates
@opindex fno-pretty-templates
When an error message refers to a specialization of a function
template, the compiler will normally print the signature of the
template followed by the template arguments and any typedefs or
typenames in the signature (e.g. @code{void f(T) [with T = int]}
rather than @code{void f(int)}) so that it's clear which template is
involved. When an error message refers to a specialization of a class
template, the compiler will omit any template arguments which match
the default template arguments for that template. If either of these
behaviors make it harder to understand the error message rather than
easier, using @option{-fno-pretty-templates} will disable them.
@item -frepo
@opindex frepo
Enable automatic template instantiation at link time. This option also
......
2009-04-07 Jason Merrill <jason@redhat.com>
PR c++/25185
* g++.dg/template/error40.C: New.
2009-04-07 Janus Weil <janus@gcc.gnu.org>
PR fortran/38152
......
// { dg-options "-fno-pretty-templates" }
template <class T, int N=0, int X=1>
struct A
{
};
void foo(void)
{
A<void> a = 0; // { dg-error "A<void, 0, 1>" }
}
template <class T> T f(T); // { dg-message "int f<int>.int." }
template <class T> T f(T, int = 0); // { dg-message "" }
int main()
{
f(1); // { dg-error "" }
}
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