public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: "Simon Marchi" <simon.marchi@polymtl.ca>,
	"Andrew Burgess" <aburgess@redhat.com>,
	"周春明(日月)" <riyue.zcm@alibaba-inc.com>
Cc: Gdb-patches
	<gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org>,
	Dominique Quatravaux <dominique.quatravaux@epfl.ch>,
	Louis-He <1726110778@qq.com>,
	gdb-patches <gdb-patches@sourceware.org>,
	Sam Warner <samuel.r.warner@me.com>
Subject: Re: ../../gdbsupport/new-op.cc:137:1: error: ‘void operator delete [](void*, std::size_t)’ is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Werror=c++14-compat]
Date: Wed, 2 Mar 2022 17:03:32 +0000	[thread overview]
Message-ID: <4010c3d0-f890-8eb4-2e08-d157aa01d8d6@palves.net> (raw)
In-Reply-To: <18e3cba4-71ce-5b88-c760-8c8787541f35@polymtl.ca>

On 2022-03-02 16:54, Simon Marchi via Gdb-patches wrote:

> The story of this is that ASan gave some alloc-dealloc mismatch warnings
> if we didn't define these specific delete operators, so we defined them
> in this commit:
> 
>   https://gitlab.com/gnutools/binutils-gdb/-/commit/5fff6115feae7aaa23c0ae8d144e1c8418ee2ee1
> 
> But for the variants of delete that are only introduced in C++14, it
> meant adding functions without an equivalent declaration when building
> in C++11, which produced some -Wmissing-declarations warnings.  So these
> declarations were added in this commit:
> 
>   https://gitlab.com/gnutools/binutils-gdb/-/commit/b038b53f1ff4bf00ecdead1db23eddc4fd654305
> 
> The idea being that in C++11, these delete operators won't get used, but
> there will be a declaration to avoid the warning, and in C++14 the
> declarations will duplicate those found in headers, which is harmless.
> 
> And now here we are, we have a C++11 compiler that complains about
> declaring these delete operators.
> 
> So we can't simply remove the declarations and / or definitions, we
> would just re-introduce the problems fixed by these commits.
> 
> I think that a clean way to fix this would be to conditionally define
> these delete operators based on the C++ version.  So we would remove the
> declarations, as you do in your commit, but place the definitions under
> an "#if __cplusplus >= xyz".
> 

How can we be sure that some C++ library linked with gdb won't call them, though?
Like e.g., libsource-highlight.so.  It would seem to me that the best approach
would be to disable the warning around the declarations/definitions.

  reply	other threads:[~2022-03-02 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  7:48 周春明(日月)
2022-03-01 14:32 ` Simon Marchi
2022-03-02  3:08   ` 回复:../../gdbsupport/new-op.cc:137:1: " 周春明(日月)
2022-03-02 16:45     ` Simon Marchi
2022-03-02 16:30 ` ../../gdbsupport/new-op.cc:137:1: " Andrew Burgess
2022-03-02 16:54   ` Simon Marchi
2022-03-02 17:03     ` Pedro Alves [this message]
2022-03-02 17:26       ` Simon Marchi
2022-03-02 17:43         ` Pedro Alves
2022-03-02 17:22     ` Andrew Burgess
2022-03-02 17:41       ` Simon Marchi
2022-03-03 12:27         ` Andrew Burgess
2022-03-03 14:18         ` Tom Tromey

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=4010c3d0-f890-8eb4-2e08-d157aa01d8d6@palves.net \
    --to=pedro@palves.net \
    --cc=1726110778@qq.com \
    --cc=aburgess@redhat.com \
    --cc=dominique.quatravaux@epfl.ch \
    --cc=gdb-patches-bounces+riyue.zcm=alibaba-inc.com@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=riyue.zcm@alibaba-inc.com \
    --cc=samuel.r.warner@me.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).