diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-12-09 00:22:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-12-09 00:22:45 +0100 |
commit | 5544dbeb1cedb43b8cc9c81e70228cabdfbd26bb (patch) | |
tree | 53b891203c5efddb45445387fb7d8add06ab4fb2 /gcc/cp/cvt.c | |
parent | a0d169d17a275c66e6e59d843097aa1a9a87d918 (diff) | |
download | gcc-5544dbeb1cedb43b8cc9c81e70228cabdfbd26bb.zip gcc-5544dbeb1cedb43b8cc9c81e70228cabdfbd26bb.tar.gz gcc-5544dbeb1cedb43b8cc9c81e70228cabdfbd26bb.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 26 |
1 files changed, 14 insertions, 12 deletions
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)) { |