Page MenuHomeFreeBSD

machine/ieeefp.h: include <sys/cdefs.h>
Needs ReviewPublic

Authored by pkubaj on Mon, Sep 14, 9:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 24, 8:59 PM
Unknown Object (File)
Tue, Sep 22, 8:25 PM
Unknown Object (File)
Tue, Sep 22, 2:33 PM
Unknown Object (File)
Tue, Sep 22, 2:32 PM
Unknown Object (File)
Tue, Sep 22, 10:50 AM
Unknown Object (File)
Mon, Sep 21, 4:51 PM
Unknown Object (File)
Sun, Sep 20, 7:15 PM
Unknown Object (File)
Sun, Sep 20, 5:42 PM

Details

Reviewers
andrew
manu
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 Skipped
Unit
Tests Skipped

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.