Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Aug 2026 07:09:32 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Robert Clausecker <fuz@FreeBSD.org>, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Faraz Vahedi <kfv@kfv.io>
Subject:   Re: git: 296c05f7212c - main - libutil++: Include <cerrno> in stringf.cc
Message-ID:  <fff19baa-1c2c-4142-b631-d948ebe9fb13@yahoo.com>
In-Reply-To: <6a6f33c9.1d959.1a21c17@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

On 8/2/26 05:10, Robert Clausecker wrote:
> The branch main has been updated by fuz:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=296c05f7212c37bd6e6bf7e42af11d42a275d493
> 
> commit 296c05f7212c37bd6e6bf7e42af11d42a275d493
> Author:     Faraz Vahedi <kfv@kfv.io>
> AuthorDate: 2026-05-11 06:05:18 +0000
> Commit:     Robert Clausecker <fuz@FreeBSD.org>
> CommitDate: 2026-08-02 11:17:45 +0000
> 
>     libutil++: Include <cerrno> in stringf.cc
>     
>     stringf.cc uses errno and related macros without including <cerrno>.
>     
>     Their availability is guaranteed only when the corresponding header
>     is included; transitive exposure is implementation-defined.
>     
>     Modern libc++ has been progressively reducing incidental transitive
>     includes as part of its header removal policy (see LLVM libc++ Header
>     Removal Policy and D132284), making such dependencies brittle.


I'll note that libc++ has a means of testing the lack of transitive
includes: -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES .

It turns out that a number of FreeBSD specific headers that libc++
indirectly includes also are working in various places only because of
the transitive includes based pollution --and includes of FreeBSD
specific headers in various places are required for
-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES to avoid build failures. It is not
only the standard C++ headers that are at issue.

I have https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295589 ("LLVM
futures and _LIBCPP_REMOVE_TRANSITIVE_INCLUDES now: vs. buildworld")
where I've been noting what I've run into using
_LIBCPP_REMOVE_TRANSITIVE_INCLUDES for my personal/tailored world-build
variant.

One of the items in the diffs there has been:

diff --git a/lib/libutil++/stringf.cc b/lib/libutil++/stringf.cc
index 8c24167d70ac..3bbe123037b0 100644
--- a/lib/libutil++/stringf.cc
+++ b/lib/libutil++/stringf.cc
@@ -5,6 +5,7 @@
  * Written by: John Baldwin <jhb@FreeBSD.org>
  */

+#include <cerrno>
 #include <cstdarg>
 #include <cstdio>
 #include <string>

>     
>     This change includes <cerrno> explicitly to make the dependency
>     well-defined. No functional or behavioural change intended.
>     
>     Approved by:    fuz
>     Signed-off-by:  Faraz Vahedi <kfv@kfv.io>
>     Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2188
> ---
>  lib/libutil++/libutil++.hh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/libutil++/libutil++.hh b/lib/libutil++/libutil++.hh
> index 60e6b3fc5fde..3ba46ed5c506 100644
> --- a/lib/libutil++/libutil++.hh
> +++ b/lib/libutil++/libutil++.hh
> @@ -13,6 +13,7 @@
>  #include <netdb.h>
>  #include <unistd.h>
>  
> +#include <cerrno>
>  #include <cstdarg>
>  #include <cstdio>
>  #include <cstdlib>
> 
> 


-- 
===
Mark Millard
marklmi at yahoo.com


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?fff19baa-1c2c-4142-b631-d948ebe9fb13>