From: Jakub Jelinek Date: Sun, 8 Dec 2019 23:22:45 +0000 (+0100) Subject: cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast msg to (const... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5544dbeb1cedb43b8cc9c81e70228cabdfbd26bb;p=gcc.git cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast msg to (const char *) in conditional... * cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast msg to (const char *) in conditional expressions. Formatting fixes. From-SVN: r279101 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5cb63da5a88..a3fe71e222d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-12-08 Jakub Jelinek + + * 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 Jakub Jelinek diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index cde3760886a..e922e4d9b89 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 %: %<%s%>") : - G_("ignoring return value of %qD, " - "declared with attribute %%s")); - const char* raw_msg = msg ? msg : ""; + const char *format + = (msg + ? G_("ignoring return value of %qD, " + "declared with attribute %: %<%s%>") + : G_("ignoring return value of %qD, " + "declared with attribute %%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 %: %<%s%>") : - G_("ignoring returned value of type %qT, " - "declared with attribute %%s"); - const char* raw_msg = msg ? msg : ""; + const char *format + = (msg + ? G_("ignoring returned value of type %qT, " + "declared with attribute %: %<%s%>") + : G_("ignoring returned value of type %qT, " + "declared with attribute %%s")); + const char *raw_msg = msg ? (const char *) msg : ""; auto_diagnostic_group d; if (warning_at (loc, OPT_Wunused_result, format, rettype, raw_msg)) {