From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tromey@adacore.com>, Andrew Burgess <aburgess@redhat.com>
Cc: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Use std::optional when available
Date: Thu, 12 Oct 2023 19:44:32 +0100 [thread overview]
Message-ID: <4f1176f7-8816-4ec8-a9bd-db7830097c62@palves.net> (raw)
In-Reply-To: <874jiywhfs.fsf@tromey.com>
On 2023-10-10 17:49, Tom Tromey wrote:
>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> I think this change needs to be held off until we move to C++17 - at
> Andrew> which point gdb::optional can just be dropped.
>
> Once we switch I think we can just remove this code entirely.
Agreed, once we can rely on std::optional, we should delete all the tests
under gdb/unittest/optional/. They were originally copied from libstdc++'s
testsuite, to make sure our gdb::optional behaved the same as std::optional,
in the subset of features it did support. See d35d19584cf5.
BTW, with C++17, gdb::string_view can be replaced with std::string_view too,
and the whole of gdb/unittests/basic_string_view/ can go away too.
Pedro Alves
>
> GDB 14 branched, so I think we're ready for that now.
>
>>> +#if __cplusplus < 201703L
>
> Andrew> Ignoring my previous comment for a moment; we now rely on this version
> Andrew> number being defined the same in two files. Would it be better to move
> Andrew> the '#define GDB_OPTIONAL' into gdb_optional.h? Then we can be certain
> Andrew> that it will be defined correctly, and in sync with any future changes
> Andrew> made in that file?
>
> I don't think that would really help. IIUC the issue would be compiling
> two source files with different -std settings. But in this case
> gdb_optional.h would react to this. Maybe I'm not understanding what
> you mean though.
>
> It seems to me that we simply don't need to support compiling the tree
> with different std settings for different files -- it should be fine to
> just assume that everything is compiled compatibly.
>
> Tom
next prev parent reply other threads:[~2023-10-12 18:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 16:05 Tom Tromey
2023-10-09 12:40 ` Andrew Burgess
2023-10-10 16:49 ` Tom Tromey
2023-10-12 18:44 ` Pedro Alves [this message]
2023-10-16 14:13 ` Andrew Burgess
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=4f1176f7-8816-4ec8-a9bd-db7830097c62@palves.net \
--to=pedro@palves.net \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/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).