[PATCH] Cygwin: add wrappers for newer new/delete overloads
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Jul 30 12:20:58 GMT 2025
On Jul 25 16:10, Jeremy Drake via Cygwin-patches wrote:
> A sized delete (with a std::size_t parameter) was added in C++14 (but
> doesn't combine with nothrow_t)
>
> An aligned new/delete (with a std::align_val_t parameter) was added in
> C++17, and combinations with the sized delete and nothrow_t variants.
>
> Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
> ---
> I added #pragma GCC diagnostic ignored "-Wc++17-compat" preemptively to
> cxx.cc to match what was done with c++14-compat with the one sized delete
> that was already present (presumably because it broke things when GCC
> started to emit that instead of the non-sized delete).
>
> The default new implementation uses calloc, so I'm not sure if it's
> expected that the aligned new call memset to zero the returned memory.
> It'd be easy enough to add if necessary.
>
> GCC will need to be updated circa
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/cygwin-w64.h;h=160a290a03d00f6408252f5d8751fea7cd44e1be;hb=HEAD#l27
> but only after this change is stable because it will cause linker errors
> if the new __wrap symbols are not exported.
>
> Does there need to be a version bump somewhere to make sure a module
> linked against a new libcygwin.a doesn't run against an old cygwin1.dll,
> resulting in _cygwin_crt0_common.cc writing too much data to
> default_cygwin_cxx_malloc?
>
> winsup/cygwin/cxx.cc | 120 +++++++++++++++++++++-
> winsup/cygwin/cygwin.din | 12 +++
> winsup/cygwin/lib/_cygwin_crt0_common.cc | 59 +++++++++++
> winsup/cygwin/libstdcxx_wrapper.cc | 99 ++++++++++++++++++
> winsup/cygwin/local_includes/cygwin-cxx.h | 14 +++
> 5 files changed, 299 insertions(+), 5 deletions(-)
LGTM. Please push (to main only, at least for now)
Thanks,
Corinna
More information about the Cygwin-patches
mailing list