On Thu, 14 Mar 2024 at 14:49, David Malcolm <dmalc...@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.phili...@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 >