From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Pierrick Philippe <pierrick.philippe@irisa.fr>, gcc@gcc.gnu.org
Subject: Re: Using std types and functions within GCC
Date: Thu, 14 Mar 2024 14:55:29 +0000 [thread overview]
Message-ID: <CAH6eHdT7+uFH2rW9fFwxtPbpMeXz9dwcV01ZbUk2kdSXLkfFzg@mail.gmail.com> (raw)
In-Reply-To: <b04132c236a5aecfaf4ca46f0f17a564cb49fa32.camel@redhat.com>
On Thu, 14 Mar 2024 at 14:49, David Malcolm <dmalcolm@redhat.com> wrote:
>
> On Thu, 2024-03-14 at 13:28 +0000, Jonathan Wakely via Gcc wrote:
> > On Thu, 14 Mar 2024 at 12:54, Pierrick Philippe
> > <pierrick.philippe@irisa.fr> wrote:
> > >
> > > Hi all,
>
> Hi Pierrick! It was good to meet you at FOSDEM.
>
> > >
> > > I was wondering, is there any conventions or guidelines regarding
> > > the
> > > usage of types and/or functions coming from the C++ std library
> > > within
> > > the compiler?
> >
> > The relevant header needs to be included from the gcc/system.h
> > header.
> > Look in there for INCLUDE_STRING, INCLUDE_VECTOR etc. and how those
> > macros are used in other sources.
> >
> > > To explicit a bit more, I am working on modification on the
> > > analyzer and
> > > might need to use a pair.
> >
> > A grep of the source shows that <utility> is already included in
> > gcc/system.h and std::pair is already used in several places.
>
> Thanks Jonathan.
>
> A couple of other things to note:
>
> - bear in mind that we need to be somewhat conservative in our usage of
> C++ internally: our code needs to be C++11, compilable by GCC 4.8.3,
> and parsable by gengtype and by xgettext. For example, there's at
> least one place where I'd have used std::optional, but that's C++14 and
> so unavailable.
C++17, so even more unavailable!
> - some parts of our code manage memory using our custom garbage
> collector (via GTY and gengtype), and other parts use C++11 move
> semantics. I suspect that these two approaches to memory management
> aren't especially compatible with each other. For example, our vec<T>
> class works with the GC but not (I think) with move, whereas
> std::vector works with C++11. We make the simplifying assumption
> within the analyzer that the garbage collector will never run within
> the analysis pass, and the analyzer makes use of move semantics, ctors,
> dtors, etc.
>
> Feel free to use std::pair in the analyzer.
>
> Hope this is helpful
> Dave
>
next prev parent reply other threads:[~2024-03-14 14:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 12:53 Pierrick Philippe
2024-03-14 13:28 ` Jonathan Wakely
2024-03-14 14:49 ` David Malcolm
2024-03-14 14:55 ` Jonathan Wakely [this message]
2024-03-15 13:00 ` Tom Tromey
2024-03-15 13:43 ` dkm
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=CAH6eHdT7+uFH2rW9fFwxtPbpMeXz9dwcV01ZbUk2kdSXLkfFzg@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=dmalcolm@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=pierrick.philippe@irisa.fr \
/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).