summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Billy Robert O'Neal III <bion@microsoft.com>2019-08-23 17:18:04 -0700
committer Billy Robert O'Neal III <bion@microsoft.com>2019-08-23 17:18:04 -0700
commit66ba636f1fa453335539e27dccd1def8aa7208ef (patch)
treecff9303cb7f58f35cd97987eb20167316e85ae71
parent70f176f74f42366ffc69fc048085edce7ffd8ce1 (diff)
Resolve [[nodiscard]] warning from c_str() call.
In C++98/03, basic_string::c_str() was allowed to be a reallocation to insert the null terminator. MAME is ensuring this actually happens with a do-nothing call to c_str(). In C++11 and later, this is prohibited, and the string is mandated to be always null terminated. As a result Visual C++ marks c_str() with [[nodiscard]], triggering a warning here for discarding the result. (I don't know of any C++03 implementation that actually reallocates here, but just in case this code actually targeted such an implementation I've just suppressed the warning for now. If MAME only targets C++11 or later, we should fix it by deleting the line.)
-rw-r--r--src/emu/rendfont.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index a71a119f75f..c5debb5f055 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -374,7 +374,7 @@ private:
void convert_command_glyph(std::string &str)
{
- str.c_str(); // force NUL-termination - we depend on it later
+ (void)str.c_str(); // force NUL-termination - we depend on it later
std::size_t const len(str.length());
std::vector<char> buf(2 * (len + 1));
std::size_t j(0);