Page MenuHomeFreeBSD

Remove checks for __GNUCLIKE_ASM assuming it is always true.

Authored by jhb on Apr 6 2022, 2:25 PM.



All supported compilers (modern versions of GCC and clang) support

Many places didn't have an #else so would just silently do the wrong
thing. Ancient versions of icc (the original motivation for this) are
no longer a compiler FreeBSD supports.

Diff Detail

rG FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb requested review of this revision.Apr 6 2022, 2:25 PM

I have a cdefs cleanup branch somewhere with something very similar in it. I'll rebase and cope. I ran into some issues with it, but don't recall why work stalled on it exactly other than non-standard compilers and ports needing older gcc versions to build...

Intel's compiler has moved to gnu asm a long time ago and we've been deorbiting support for the ancient version.
pcc works with this change
lcc didn't work before and won't work after, but we don't have a port for it
gcc/clang of course work
tcc broke, IIRC, when I did this or some other cleanup work, but it's depth of support is minimal and that shouldn't gate things.

This revision is now accepted and ready to land.Apr 6 2022, 2:32 PM

Just so it's documented here and not just on IRC:

My general goal with this set of changes is to assume modern versions of GCC/clang (or a compiler that can understand modern GNU C) to build FreeBSD itself. To that end, this series doesn't change anything in <sys/cdefs.h> itself so that more esoteric compilers should in theory still be able to build applications like hello world even after these changes.

It is true that some of these headers are also (ab)used in userspace, especially <machine/atomic.h> (and perhaps <machine/ieeefp.h> is the most likely candidate). However, in most cases while we might allow software to compile by providing prototypes in place of inlines, the software won't actually work as we don't ship the functions the prototypes want to link against, so I don't think we will break anything that isn't already broken.

An exp-run of this series probably does make sense.

FWIW, the system literally won't compiled without __GNUCLIKE_ASM defined due to pcpu.h

arichardson added inline comments.

Pre-existing but shouldn't this be defined(__amd64__)? And I guess _Generic if you want to modernize it.


Mmmm, interesting. Note that irintf() and irintd() aren't defined for amd64 so I think if this was fixed it wouldn't compile on amd64.