Commit f6eee6bf by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/83871 (wrong code for attribute const and pure on distinct template specializations)

	PR c++/83871
	PR c++/83503
	* pt.c (INCLUDE_STRING): Remove define.
	(warn_spec_missing_attributes): Use pretty_printer instead of
	std::string.  Fix up inform call so that the list of attributes
	is in %s argument.

From-SVN: r258079
parent 15d3974b
2018-02-28 Jakub Jelinek <jakub@redhat.com>
PR c++/83871
PR c++/83503
* pt.c (INCLUDE_STRING): Remove define.
(warn_spec_missing_attributes): Use pretty_printer instead of
std::string. Fix up inform call so that the list of attributes
is in %s argument.
2018-02-28 Martin Sebor <msebor@redhat.com>
PR testsuite/84617
......
......@@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see
file that contains only the method templates and "just win". */
#include "config.h"
#define INCLUDE_STRING
#include "system.h"
#include "coretypes.h"
#include "cp-tree.h"
......@@ -2681,7 +2680,7 @@ warn_spec_missing_attributes (tree tmpl, tree spec, tree attrlist)
template is declared with that the specialization is not, in case
it's not apparent from the most recent declaration of the primary. */
unsigned nattrs = 0;
std::string str;
pretty_printer str;
for (unsigned i = 0; i != sizeof blacklist / sizeof *blacklist; ++i)
{
......@@ -2695,11 +2694,11 @@ warn_spec_missing_attributes (tree tmpl, tree spec, tree attrlist)
if (lookup_attribute (blacklist[i], spec_attrs[k]))
break;
if (str.size ())
str += ", ";
str += "%<";
str += blacklist[i];
str += "%>";
if (nattrs)
pp_string (&str, ", ");
pp_begin_quote (&str, pp_show_color (global_dc->printer));
pp_string (&str, blacklist[i]);
pp_end_quote (&str, pp_show_color (global_dc->printer));
++nattrs;
}
}
......@@ -2711,15 +2710,11 @@ warn_spec_missing_attributes (tree tmpl, tree spec, tree attrlist)
if (warning_at (DECL_SOURCE_LOCATION (spec), OPT_Wmissing_attributes,
"explicit specialization %q#D may be missing attributes",
spec))
{
if (nattrs > 1)
str = G_("missing primary template attributes ") + str;
else
str = G_("missing primary template attribute ") + str;
inform (DECL_SOURCE_LOCATION (tmpl), str.c_str ());
}
inform (DECL_SOURCE_LOCATION (tmpl),
nattrs > 1
? G_("missing primary template attributes %s")
: G_("missing primary template attribute %s"),
pp_formatted_text (&str));
}
/* Check to see if the function just declared, as indicated in
......
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