Page MenuHomeFreeBSD

machine/ieeefp.h: include <sys/cdefs.h>
ClosedPublic

Authored by pkubaj on Sep 14 2026, 9:31 AM.
Tags
None
Referenced Files
F176630119: D59659.id186646.diff
Tue, Oct 20, 9:31 AM
F176629818: D59659.id187960.diff
Tue, Oct 20, 9:27 AM
F176629394: D59659.id189911.diff
Tue, Oct 20, 9:22 AM
F176625619: D59659.id189911.diff
Tue, Oct 20, 8:32 AM
Unknown Object (File)
Mon, Oct 19, 1:45 PM
Unknown Object (File)
Mon, Oct 19, 10:09 AM
Unknown Object (File)
Sun, Oct 18, 11:25 PM
Unknown Object (File)
Sun, Oct 18, 10:44 PM

Details

Summary

The <machine/ieeefp.h> headers wrap their deprecated FPU control
interface prototypes (fpgetround() etc.) in BEGIN_DECLS/END_DECLS,
but rely on the includer to have pulled in <sys/cdefs.h>. On arm,
arm64, powerpc, and riscv, <floatingpoint.h> does not, so including it
as the very first header fails with "unknown type name BEGIN_DECLS".
On amd64, including <machine/ieeefp.h> directly with
IEEEFP_NOINLINES__ fails the same way. i386 does not use
__BEGIN_DECLS there.

This breaks e.g. devel/py-pyinstaller, whose bootloader main.c does

#ifdef __FreeBSD__
#include <floatingpoint.h>
#endif

as its first include.

Test Plan

Compiled a file containing only #include <floatingpoint.h> and one
containing only #include <machine/ieeefp.h>, as C and C++, with
cc -target <triple> -nostdinc -fsyntax-only against each architecture's
headers, for powerpc64, powerpc64le, armv7, aarch64, armv7 using the
arm64 headers (the arm path), riscv64, and amd64 with and without
-DIEEEFP_NOINLINES.

Before: 26 of 32 fail with "unknown type name 'BEGIN_DECLS'" (every
case except amd64 without
IEEEFP_NOINLINES__ and amd64
<floatingpoint.h>). After: all 32 compile.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

My suggestion would be to push the #include into the ieeefp.h headers themselves as they are the ones using __BEGIN_DECL.

pkubaj retitled this revision from floatingpoint.h: include <sys/cdefs.h> before <machine/ieeefp.h> to machine/ieeefp.h: include <sys/cdefs.h>.
pkubaj edited the summary of this revision. (Show Details)
pkubaj edited the test plan for this revision. (Show Details)

Is that what you meant? Note that this now touches amd64 as well.

This revision is now accepted and ready to land.Tue, Oct 13, 7:33 PM
This revision was automatically updated to reflect the committed changes.