+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
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"
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)
{
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;
}
}
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