[build2] Patches for C++23 std::aligned_storage and libpkgconf v1.9.0+

Boris Kolpackov boris at codesynthesis.com
Thu Mar 2 13:53:57 UTC 2023


Matthew Krupcale via users <users at build2.org> writes:

> On Fedora 38 and 39 there were some bugs [1,2] reported regarding
> failure to build or install, respectively, build2 v0.15.0. I've got
> things building again in a Copr [3] before I push changes to official
> repos with three patches [4-6] addressing the update of git to v2.38+,
> deprecation of std::aligned_storage in C++23 [7], and the update of
> libpkgconf to v1.9.4 [8]. The former patch is already upstream [9],
> while the second patch I'm not 100% certain about since I don't know
> what the alignment should be in all the build2 use cases since the
> template Align parameter was unspecified. The final patch is to
> address a change in the libpkgconf error handler function signature
> [10].

Thanks for looking into this and providing a detailed description of
the issues.

I've applied your libpkgconf patch as is[1] but the std::aligned_storage
change needs some work[2]. Specifically, after some digging, it appears
a suitable replacement for:

std::aligned_storage<N>::type data;

Is:

alignas (std::max_align_t) unsigned char data[N];

Or, if N is likely to be less than max alignment:

alignas (std::min (alignof (std::max_align_t), N)) unsigned char data[N];

To make sure, I've written a test[3] and it passes on all the main
platforms/compilers[4].

Let me know if there are any other issues.

[1] https://git.build2.org/cgit/build2/commit/?id=343d6e69e412166cfc21f268a51b692cb0201653
[2] https://git.build2.org/cgit/build2/commit/?id=417be15231cb34a2e858d26b63406d1fb5535cb9
[3] https://github.com/boris-kolpackov/alignas
[4] https://ci.stage.build2.org/@4084c65a-deae-4208-a053-1d3f4269c9a5



More information about the users mailing list