public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Disable over-zealous warnings about std::string copies [PR103332]
@ 2021-12-09 23:24 Jonathan Wakely
  2021-12-10  0:38 ` Martin Sebor
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2021-12-09 23:24 UTC (permalink / raw)
  To: libstdc++, gcc-patches

These warnings are triggered by perfectly valid code using std::string.
They're particularly bad when --enable-fully-dynamic-string is used,
because even std::string().begin() will give a warning.

Use pragmas to stop the troublesome warnings for copies done by
std::char_traits.

libstdc++-v3/ChangeLog:

	PR libstdc++/103332
	PR libstdc++/102958
	PR libstdc++/103483
	* include/bits/char_traits.h: Suppress stringop and array-bounds
	warnings.
---
 libstdc++-v3/include/bits/char_traits.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index da3e0ffffaa..3f7befcf8b2 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -54,6 +54,11 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-overread"
+#pragma GCC diagnostic ignored "-Warray-bounds"
+
   /**
    *  @brief  Mapping from character type to associated types.
    *
@@ -990,6 +995,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   } // namespace __detail
 #endif // C++20
 
+#pragma GCC diagnostic push
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-10 18:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 23:24 [committed] libstdc++: Disable over-zealous warnings about std::string copies [PR103332] Jonathan Wakely
2021-12-10  0:38 ` Martin Sebor
2021-12-10  1:49   ` Martin Sebor
2021-12-10 10:12     ` Jonathan Wakely
2021-12-10 16:35       ` Martin Sebor
2021-12-10 16:41         ` Jakub Jelinek
2021-12-10 17:11           ` Martin Sebor
2021-12-10 17:17             ` Jakub Jelinek
2021-12-10 18:16               ` Jonathan Wakely
2021-12-10 18:10         ` Jonathan Wakely
2021-12-10  9:51   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).