[PATCH RFC] libcpp, libstdc++: add __has_import builtin
Ville Voutilainen
ville.voutilainen@gmail.com
Fri Nov 15 23:30:17 GMT 2024
On Sat, 16 Nov 2024 at 01:12, Jason Merrill <jason@redhat.com> wrote:
>
> Does this seem like an interesting direction?
>
> -- 8< --
>
> A problem with coexistence of module std and the library headers is that
> import and then #include tends to break (PR99000). But even with that
> fixed, it might be useful to be able to test whether a module has been
> imported. So, this patch implements __has_import, along the same lines as
> __has_builtin and such.
>
> This does not test whether an import is available, which seems too variable
> of a property; rather, it tests whether we've already seen an import in this
> TU.
Should it be named __seen_import? All those __has-things seem to be
feature-tests,
and this isn't. Or to put it another way, the __has-things query
properties of the implementation,
this builtin is for querying what has been encountered in the TU so
far. That sounds like
apples and oranges, right?
More information about the Libstdc++
mailing list