Re: git: 2ade7285253f - stable/14 - tools.build: add sys/cdefs.h to SYSINCS, since lots of other headers use it

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Tue, 30 Dec 2025 01:06:27 UTC
On 29 Dec 2025, at 22:21, Dimitry Andric <dim@FreeBSD.org> wrote:
> 
> On 29 Dec 2025, at 21:58, Mark Johnston <markj@freebsd.org> wrote:
>> 
>> On Mon, Dec 29, 2025 at 12:17:52PM +0000, Dimitry Andric wrote:
>>> The branch stable/14 has been updated by dim:
>>> 
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=2ade7285253fc5dfe0adfc51f7bd342b9293f253
>>> 
>>> commit 2ade7285253fc5dfe0adfc51f7bd342b9293f253
>>> Author:     Dimitry Andric <dim@FreeBSD.org>
>>> AuthorDate: 2025-12-26 15:26:13 +0000
>>> Commit:     Dimitry Andric <dim@FreeBSD.org>
>>> CommitDate: 2025-12-29 12:16:00 +0000
>>> 
>>>   tools.build: add sys/cdefs.h to SYSINCS, since lots of other headers use it
>>> 
>>>   This is needed to let the legacy stage compile against newer versions of
>>>   sys/font.h, which transitively includes sys/cdefs.h, and requires the
>>>   new __nonstring macro from it.
>>> 
>>>   Fixes:          e2c93ed09f25
>>>   MFC after:      3 days
>>> 
>>>   (cherry picked from commit 1c9ff80f06350fa44b7e50ce09ad665ab0082abb)
>> 
>> Hi Dimitry,
>> 
>> After this commit, I can't build stable/14 on main (commit 88b04633c29e
>> to be exact) anymore.  Here's the output from a buildworld, it fails
>> pretty much immediately:
>> https://reviews.freebsd.org/P683
>> 
>> The same seems to be true on stable/13, but not on stable/15.
> 
> Hmm, this turns out to be a bit deeper rabbit hole than I anticipated. The cdefs.h header on stable/14 and stable/13 are quite behind the one on main and stable/15. This causes issues like the above, when __noexcept, __deprecated1 and others are not defined during the legacy stage, and it picks up _some_ headers from the host system, and others from the location installed by tools/build/Makefile.
> 
> I think I will rollback the MFCs for now, until I can figure out a solution. Ideally we would not have to copy cdefs.h for this bootstrap part, but that leads to other issues.

As an alternative solution, I have MFC'd support for __noexcept, __deprecated, and __deprecated1 to stable/14 and stable/13, with a small additional patch to stable/13. I believe both branches should now build fine on main.

-Dimitry