aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-02-28 19:56:36 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-02-28 19:56:36 +0100
commitf6eee6bf4cc9c7b1a9f8f7af82b8fcccefac973a (patch)
tree4149ca9a9a68c55f65127b14d78bb7a64b8ff98f /gcc
parent15d3974b692be987e59d771b1c926252e6208ca1 (diff)
downloadgcc-f6eee6bf4cc9c7b1a9f8f7af82b8fcccefac973a.zip
gcc-f6eee6bf4cc9c7b1a9f8f7af82b8fcccefac973a.tar.gz
gcc-f6eee6bf4cc9c7b1a9f8f7af82b8fcccefac973a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/pt.c27
2 files changed, 20 insertions, 16 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 457bfc2..5d8a6db 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 23eb2db..507675b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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