diff options
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5cb63da..a3fe71e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-12-08 Jakub Jelinek <jakub@redhat.com> + + * cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast + msg to (const char *) in conditional expressions. Formatting fixes. + 2019-12-07 Jason Merrill <jason@redhat.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index cde3760..e922e4d 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1044,12 +1044,13 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit) tree args = TREE_VALUE (attr); if (args) msg.escape (TREE_STRING_POINTER (TREE_VALUE (args))); - const char* format = (msg ? - G_("ignoring return value of %qD, " - "declared with attribute %<nodiscard%>: %<%s%>") : - G_("ignoring return value of %qD, " - "declared with attribute %<nodiscard%>%s")); - const char* raw_msg = msg ? msg : ""; + const char *format + = (msg + ? G_("ignoring return value of %qD, " + "declared with attribute %<nodiscard%>: %<%s%>") + : G_("ignoring return value of %qD, " + "declared with attribute %<nodiscard%>%s")); + const char *raw_msg = msg ? (const char *) msg : ""; auto_diagnostic_group d; if (warning_at (loc, OPT_Wunused_result, format, fn, raw_msg)) inform (DECL_SOURCE_LOCATION (fn), "declared here"); @@ -1061,12 +1062,13 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit) tree args = TREE_VALUE (attr); if (args) msg.escape (TREE_STRING_POINTER (TREE_VALUE (args))); - const char* format = msg ? - G_("ignoring returned value of type %qT, " - "declared with attribute %<nodiscard%>: %<%s%>") : - G_("ignoring returned value of type %qT, " - "declared with attribute %<nodiscard%>%s"); - const char* raw_msg = msg ? msg : ""; + const char *format + = (msg + ? G_("ignoring returned value of type %qT, " + "declared with attribute %<nodiscard%>: %<%s%>") + : G_("ignoring returned value of type %qT, " + "declared with attribute %<nodiscard%>%s")); + const char *raw_msg = msg ? (const char *) msg : ""; auto_diagnostic_group d; if (warning_at (loc, OPT_Wunused_result, format, rettype, raw_msg)) { |