From: Rafael Sadowski Subject: Re: [libcxx22] fallout To: Theo Buehler Cc: ports@openbsd.org Date: Wed, 26 Aug 2026 07:00:59 +0200 On Tue Aug 25, 2026 at 10:24:53PM +0200, Theo Buehler wrote: > On Tue, Aug 25, 2026 at 09:55:53PM +0200, Rafael Sadowski wrote: > > On Fri Aug 21, 2026 at 02:15:34PM +0200, Theo Buehler wrote: > > > Here is the directly libcxx22-related breakage of my first bulk. > > > > > > There may be a few more because mono got stuck with a weird error. And > > > I did not try to build the V8 monsters: codex, deno, chromiums and a few > > > others because my machine isn't beefy enough. I don't think anything > > > super important is directly affected or hiding behind those. So as far > > > as ports are concerned, I think we can land libcxx22 whenever we want: > > > > > > audio/ncmpcpp > > > audio/rubberband > > > cad/freecad > > > databases/mongodb/44 > > > games/cataclysm-dda > > > games/dxx-rebirth > > > games/flightgear/base > > > games/keeperrl > > > mail/kopano/core > > > misc/subsurface > > > shells/fish/v3 > > > textproc/lttoolbox > > > > > > > > > misc/subsurface > > > /usr/ports/pobj/subsurface-6.0.5459/subsurface-e0fbda77ef203a5a2539465e9fa44df56e2f5a9e/core/uemis-downloader.cpp:434:9: error: null passed to a callee that requires a non-null argument [-Werror, > > > -Wnonnull] > > > 434 | return NULL; > > > | ^~~~ > > > > OK? > > > > diff --git a/misc/subsurface/patches/patch-core_uemis-downloader_cpp b/misc/subsurface/patches/patch-core_uemis-downloader_cpp > > new file mode 100644 > > index 00000000000..85c640885f3 > > --- /dev/null > > +++ b/misc/subsurface/patches/patch-core_uemis-downloader_cpp > > @@ -0,0 +1,21 @@ > > +Index: core/uemis-downloader.cpp > > +--- core/uemis-downloader.cpp.orig > > ++++ core/uemis-downloader.cpp > > +@@ -194,7 +194,7 @@ static struct dive *get_dive_by_uemis_diveid(device_da > > + if (object_id == d->dcs[0].diveid) > > + return d.get(); > > + } > > +- return NULL; > > ++ return {}; > > Maybe there is some C++ magic that fixes this, but I don't think this is > right. The return value is assigned to a non_owned_dive (since the > divelist is an owning_table containing unique_ptrs). Doesn't this leak? Yes and no, with "std::unique_ptr::get", you access the raw pointer and then leave the protection provided by "std::unique_ptr" (which is the owner of this pointer). It's all a bit messy. I think the "return null" case is one that never happens, but the function has to return something. But one thing is wrong: when we trigger "return null", we're dereferencing the pointer. I've fixed that below and instead of "{}" we can retrun nullptr which is the same but more explicit. > > > + } > > + > > + /* send text to the importer progress bar */ > > +@@ -431,7 +431,7 @@ static std::string first_object_id_val(std::string_vie > > + return res; > > + } > > + } > > +- return NULL; > > ++ return {}; > > this seems fine. Yes this returns a copy of an empty std::string. > > > + } > > + > > + /* ultra-simplistic; it doesn't deal with the case when the object_id is > diff --git a/misc/subsurface/patches/patch-core_uemis-downloader_cpp b/misc/subsurface/patches/patch-core_uemis-downloader_cpp new file mode 100644 index 00000000000..de09a8338da --- /dev/null +++ b/misc/subsurface/patches/patch-core_uemis-downloader_cpp @@ -0,0 +1,30 @@ +Index: core/uemis-downloader.cpp +--- core/uemis-downloader.cpp.orig ++++ core/uemis-downloader.cpp +@@ -194,7 +194,7 @@ static struct dive *get_dive_by_uemis_diveid(device_da + if (object_id == d->dcs[0].diveid) + return d.get(); + } +- return NULL; ++ return nullptr; + } + + /* send text to the importer progress bar */ +@@ -431,7 +431,7 @@ static std::string first_object_id_val(std::string_vie + return res; + } + } +- return NULL; ++ return {}; + } + + /* ultra-simplistic; it doesn't deal with the case when the object_id is +@@ -914,7 +914,7 @@ static bool process_raw_buffer(device_data_t *devdata, + int diveid = 0; + from_chars(val, diveid); + non_owned_dive = get_dive_by_uemis_diveid(devdata, diveid); +- if (dive_no != 0) ++ if (non_owned_dive && dive_no != 0) + non_owned_dive->number = dive_no; + if (for_dive) + *for_dive = diveid;