Re: [PATCH gcc/* 1/2] gcc: copy expected and optional out of rust/utils

Jakub Jelinek <[email protected]>
Newsgroups gmane.comp.gcc.algol68,gmane.comp.gcc.patches,gmane.comp.gcc.fortran,gmane.comp.gcc.jit,gmane.comp.gcc.rust
Message-ID <aoQq-JOMymeQmkCF@tucnak>
On Tue, Aug 18, 2026 at 11:35:21AM +0200, Arsen Arsenović wrote:
> Jason Merrill <[email protected]> writes:
> 
> > On 7/5/26 5:15 PM, Arsen Arsenović wrote:
> >> In my attempts to remove these duplicates from the Rust frontend, I
> >> broke it horribly.  So, I'm leaving them in the Rust frontend.  Help
> >> wanted!
> >> gcc/ChangeLog:
> >> 	* util/expected.h: New file.  Copied out of rust/util.
> >
> > Creating gcc/util seems novel, usually utility headers go directly in gcc/ or
> > in include/.
> 
> Yes, that's the structure the Rust FE was using, and I though it'd be
> nice to curtail expanding gcc/ a bit (it's already at 1095 entries), so
> I kept it.
> 
> But, I can move it elsewhere if so desired.
> 
> What may be an issue with include/ is that (at the moment, anyway) the
> headers are using gcc_assert.

Please put it into gcc/ directly then.
I really dislike other subdirs with extremely few files, it is significant
inbalance having directories for almost nothing vs. the 1000+ files
directory, e.g. the gcc/topics/ directory containing a single header, or
gcc/custom-sarif-properties/ which has 6 files in it or
gcc/sym-exec/ with 7 files in it.  All those would be better in gcc/
directly, custom-sarif-properties with some file prefixes, sym-exec as is.

And yes, I'd think we should based it on libstdc++ implemenntation rather
than some third party (sure, some tweaks will be needed, we need to work with
any C++14 implementation, so stop relying on stuff from <bits/c++config>).

Also, I'd say we should use <expected>/<optional> directly when being
compiled with C++23 resp. C++17, only use the extra headers as fallback
for older C++ compilation, so that when we eventually bump minimum C++
version to C++17 (or much later to C++23), we can remove those headers.

	Jakub
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.