From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove
Date: Tue, 25 Apr 2017 01:19:00 -0000 [thread overview]
Message-ID: <918cb021-467e-1598-745c-d7d0aa3f0c6f@redhat.com> (raw)
In-Reply-To: <e3eb5978-e214-e078-0a7c-9ab51b02275e@redhat.com>
On 04/25/2017 02:14 AM, Pedro Alves wrote:
> Below's what I pushed.
BTW, if this ever reveals problematic in such a way that it'd be desirable
to have a convenient way to disable it, we can make the overloads
trigger warnings instead, so that folks can disable the build errors
with --disable-werror (which is the default on releases).
From 232eda6a5fca7347c6b8b1d553e792803bccba0a Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 25 Apr 2017 00:42:17 +0100
Subject: [PATCH] warnings-instead
---
gdb/common/common-defs.h | 8 ++++++++
gdb/common/poison.h | 12 ++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 439bce6..d00543b 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -69,6 +69,14 @@
#undef ATTRIBUTE_PRINTF
#define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
+#ifdef __GNUC__
+/* Introduced in gcc versions 3.1, which is older than our minimum
+ requirement. */
+# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
+#else
+# define ATTRIBUTE_DEPRECATED
+#endif
+
#include "libiberty.h"
#include "pathmax.h"
#include "gdb/signals.h"
diff --git a/gdb/common/poison.h b/gdb/common/poison.h
index a875568..ac65484 100644
--- a/gdb/common/poison.h
+++ b/gdb/common/poison.h
@@ -74,10 +74,18 @@ using BothAreRelocatable
template <typename D, typename S,
typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
-void *memcpy (D *dest, const S *src, size_t n) = delete;
+ATTRIBUTE_DEPRECATED
+void *memcpy (D *dest, const S *src, size_t n)
+{
+ return memcpy ((void *) dest, (void *) src, n);
+}
template <typename D, typename S,
typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
-void *memmove (D *dest, const S *src, size_t n) = delete;
+ATTRIBUTE_DEPRECATED
+void *memmove (D *dest, const S *src, size_t n)
+{
+ return memmove ((void *) dest, (void *) src, n);
+}
#endif /* COMMON_POISON_H */
--
2.5.5
next prev parent reply other threads:[~2017-04-25 1:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 2:27 [PATCH 0/4] " Pedro Alves
2017-04-13 2:28 ` [PATCH 2/5] Don't memcpy non-trivially-copyable types: Make enum_flags triv. copyable Pedro Alves
2017-04-20 3:34 ` Simon Marchi
2017-04-25 1:10 ` Pedro Alves
2017-04-13 2:28 ` [PATCH 4/5] Don't memset non-POD types: struct btrace_insn Pedro Alves
2017-04-13 7:57 ` Metzger, Markus T
2017-04-25 1:11 ` Pedro Alves
2017-04-13 2:28 ` [PATCH 1/5] Poison non-POD memset & non-trivially-copyable memcpy/memmove Pedro Alves
2017-04-20 3:27 ` Simon Marchi
2017-04-25 1:14 ` Pedro Alves
2017-04-25 1:19 ` Pedro Alves [this message]
2017-04-25 8:24 ` Yao Qi
2017-04-25 9:24 ` Pedro Alves
2017-04-25 10:02 ` Pedro Alves
2017-04-24 1:12 ` Simon Marchi
2017-04-24 1:53 ` Simon Marchi
2017-04-27 13:58 ` Pedro Alves
2017-04-30 1:51 ` Simon Marchi
2017-05-17 11:35 ` Pedro Alves
2017-05-17 13:11 ` Simon Marchi
2017-05-17 13:20 ` Pedro Alves
2017-04-27 13:57 ` Pedro Alves
2017-04-13 2:28 ` [PATCH 3/5] Don't memset non-POD types: struct bp_location Pedro Alves
2017-04-13 2:35 ` [PATCH 5/5] Don't memset non-POD types: struct breakpoint Pedro Alves
2017-04-20 4:00 ` Simon Marchi
2017-04-25 1:11 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=918cb021-467e-1598-745c-d7d0aa3f0c6f@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox