public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 0/4] Add variant type
Date: Wed, 2 Feb 2022 20:32:45 -0500	[thread overview]
Message-ID: <c37e7279-6ab3-ea6a-c3dd-ddbc3eb9d66a@polymtl.ca> (raw)
In-Reply-To: <20220203000206.GA1474789@redhat.com>

On 2022-02-02 19:02, Andrew Burgess wrote:
> * Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2022-02-01 09:07:13 -0500]:
> 
>> I sometimes encounter situations where I think using std::variant would
>> be useful.  The benefits would be to be able to use non-POD types in the
>> alternatives, have them automatically constructed when making an
>> alternative active, and automatically destructing them when switching to
>> another alternative of destroying the variant.  Also, the validation of
>> access to the alternatives, to prevent accessing an alternative that is
>> not the current one.
>>
>> However, std::variant is only available in C++17.  I suggest that we
>> import a variant implementation to allow us to use it right now, a bit
>> like we did for optional and string_view.  We could maybe import the
>> implementation from libstdc++, like we did for these last two types, but
>> that sounds really tedious (we would also want to import any tests).
>> Instead, we can take advantage of a popular implementation distributed
>> as a single header file.  I chose this one:
>>
>>   https://github.com/martinmoene/variant-lite
>>
>> because it is close to the std implementation, and the license (Boost
>> Software License) is clear and compatible with the GPL v3.
> 
> Is this compatible with the copyright assignment requirement of
> contributing to GDB?
> 
> I'm assuming copyright of that file is not assigned to FSF.

Exactly, we're merely redistributing it (as its license allows).  Its
header does not say "Copyright FSF" like the other files.

> My concern would be, what if code was copied from that file into the
> rest of GDB?  Does that cause us problems?

Well, we should avoid that :).  I see it exactly like zlib, which is also bundled.

Simon

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 14:07 Simon Marchi
2022-02-01 14:07 ` [PATCH 1/4] gdb: remove internalvar_funcs::destroy Simon Marchi
2022-03-04 16:15   ` Tom Tromey
2022-03-06 16:33     ` Simon Marchi
2022-02-01 14:07 ` [PATCH 2/4] gdb: constify parameter of value_copy Simon Marchi
2022-03-04 16:16   ` Tom Tromey
2022-03-06 16:33     ` Simon Marchi
2022-02-01 14:07 ` [PATCH 3/4] gdbsupport: add variant-lite header Simon Marchi
2022-02-01 14:07 ` [PATCH 4/4] gdb: make internalvar use a variant Simon Marchi
2022-03-04 16:23   ` Tom Tromey
2022-03-07 12:12     ` Pedro Alves
2022-03-16  2:06       ` Simon Marchi
2022-03-16 13:26         ` Pedro Alves
2022-03-16 13:28           ` Simon Marchi
2022-02-03  0:02 ` [PATCH 0/4] Add variant type Andrew Burgess
2022-02-03  1:32   ` Simon Marchi [this message]
2022-02-04 12:44     ` Andrew Burgess
2022-02-04 13:19       ` Simon Marchi

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=c37e7279-6ab3-ea6a-c3dd-ddbc3eb9d66a@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).