Portability requirements of libgccjit++.h
David Malcolm
dmalcolm@redhat.com
Mon Jan 31 14:37:04 GMT 2022
On Mon, 2022-01-31 at 10:39 +0100, Marc Nieper-Wißkirchen via Jit
wrote:
> The GCC project has the following portability requirements ([1]):
>
> "The directories gcc, libcpp and fixincludes may use C++03. They may
> also
> use the long long type if the host C++ compiler supports it. These
> directories should use reasonably portable parts of C++03, so that it
> is
> possible to build GCC with C++ compilers other than GCC itself. If
> testing
> reveals that reasonably recent versions of non-GCC C++ compilers cannot
> compile GCC, then GCC code should be adjusted accordingly. (Avoiding
> unusual language constructs helps immensely.) Furthermore, these
> directories *should* also be compatible with C++11."
I think that page is out of date; as of GCC 11, we're allowing the use
of C++11 in gcc's implementation
https://gcc.gnu.org/gcc-11/changes.html
though I think we're still being somewhat conservative, since we have
to be buildable with older compilers.
>
> Does this requirement apply to libgccjit++.h as well? The header file
> is
> technically contained in the directory gcc. On the other hand, it is
> not
> used when building GCC.
Yeah - that particular file should probably fall under similar
compatibility rules to libstdc++ (though that said, I'm not as familiar
with libstdc++ as I probably should be).
>
> I am asking because I have found the C++11 nullptr keyword in the
> header
> file.
Good catch.
> Can we generally lift the requirements to C++11 as far as the C++
> API for libgccjit is concerned?
Good idea.
>
> As any user of libgccjit has access to a recent C++ compiler (because
> with
> libgccjit, there comes gcc), I would be very much in favor of lifting
> this
> requirement so that further developments of the API can use C++11
> features,
> including parameter packs generalizing all the ad-hoc overloadings of
> new_call in the current header.
Sounds good to me.
Dave
More information about the Jit
mailing list