Page MenuHomeFreeBSD

systm.h: change pause from #define to inline function
ClosedPublic

Authored by bz on Sep 8 2022, 12:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 10:12 PM
Unknown Object (File)
Oct 3 2024, 11:26 PM
Unknown Object (File)
Sep 30 2024, 5:38 PM
Unknown Object (File)
Sep 30 2024, 9:43 AM
Unknown Object (File)
Sep 29 2024, 9:20 PM
Unknown Object (File)
Sep 29 2024, 8:41 PM
Unknown Object (File)
Sep 29 2024, 2:30 PM
Unknown Object (File)
Sep 29 2024, 1:13 PM
Subscribers

Details

Summary

There are drivers are using (*pause)(x, y) function pointers and depending
on how "pause" is used it gets replaced by pause_sbt causing compile time
failures.
Given "pause" is a generic enough name change it from a #define to an
inline function to avoid replacements where it should not.

MFC after: 2 weeks

Diff Detail

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

Event Timeline

bz requested review of this revision.Sep 8 2022, 12:11 AM
bz created this revision.
kib added inline comments.
sys/sys/systm.h
451–455

We still try to support weird compilers/compilation modes, so please use __inline. See sys/cdefs.h.

454

We are no longer obliged to add this blank line

This revision is now accepted and ready to land.Sep 8 2022, 6:28 AM

Use __inline and remove leading blank line.

This revision now requires review to proceed.Sep 8 2022, 7:01 AM
bz marked 2 inline comments as done.Sep 8 2022, 7:02 AM
This revision is now accepted and ready to land.Sep 8 2022, 7:08 AM
glebius added inline comments.
sys/sys/systm.h
451–455

What are the compilers that we try to support?

sys/sys/systm.h
451–455

What are the compilers that we try to support?

Any C89 compilers, e.g. gcc in -std=c89 or -std=gnu89 modes.

sys/sys/systm.h
451–455

Why do we try to support that C89?
Is underscoring the inline keyword enough to get any significant part of FreeBSD compilable with C89?

sys/sys/systm.h
451–455

Generally, system files should support c89. There's a lot of third party software that requires c89, alas.
However, sys/systm.h is generally only used by the kernel (and boot loader), and this is inside #ifdef _KERNEL.
However, all the other inline functions in this file are __inline, so there's at least a consistency argument to make.

sys/sys/systm.h
451–455

In addition to what Warner said. There is some amount of code that does try to get system definition, mostly the old code, which being C89 by the nature of the old code (do not ask me for examples).

Additional problem is that gnu89 also has inline, which semantic is not compatible with C90 inline, we try to account for this in sys/cdefs.h.