Page MenuHomeFreeBSD

linuxkpi: Add add_taint stub
ClosedPublic

Authored by manu on Aug 10 2022, 6:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 24, 9:12 AM
Unknown Object (File)
Mon, Sep 23, 11:17 PM
Unknown Object (File)
Sat, Sep 14, 3:13 AM
Unknown Object (File)
Tue, Sep 3, 11:55 PM
Unknown Object (File)
Tue, Sep 3, 7:47 PM
Unknown Object (File)
Aug 14 2024, 12:33 PM
Unknown Object (File)
Aug 14 2024, 12:33 PM
Unknown Object (File)
Aug 14 2024, 12:33 PM

Details

Summary

Needed by drm-kmod.

Sponsored by: Beckhoff Automation GmbH & Co. KG

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46952
Build 43841: arc lint + arc unit

Event Timeline

manu requested review of this revision.Aug 10 2022, 6:50 AM
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/kernel.h
685

I would have said do {} while (0).

sys/compat/linuxkpi/common/include/linux/kernel.h
685

You've been suggesting this for a number of reviews, what's the point if you don't mind be asking ?

bz added inline comments.
sys/compat/linuxkpi/common/include/linux/kernel.h
685

I believe most the ones I suggested are void functions, no return value; @hselasky in the past has always suggested to me for LinuxKPI to use do {} while(0) in those cases and that seems general style in FreeBSD.

Here's a quick test putting a (0); into an empty main function and you get a warning ...
I think we simply suppress them in the builds currently:

share/mk/bsd.sys.mk:CWARNFLAGS.clang+=  -Wno-tautological-compare -Wno-unused-value\
share/mk/bsd.sys.mk:            -Wno-error=unused-value
% cc -Wall 0.c -o 0-2
0.c:7:3: warning: expression result unused [-Wunused-value]
        (0);
         ^
1 warning generated.
sys/compat/linuxkpi/common/include/linux/kernel.h
685

Right, do { ... } while(0) is generally good practice so that it behaves similarly to a function with respect to cases like @bz mentions, the trailing ; after the macro behaves as expected, and (in the case of macros with actual bodies) it works properly inside of another block like if ... else ....

I think it's reasonable to just always put void function-like macros in do { } while (0)

Yes, "do { } while (0)" is the right thing here, if there is no return value.

sys/compat/linuxkpi/common/include/linux/kernel.h
685

Thanks for the explanation, I'll update all the reviews to do this :)

This revision is now accepted and ready to land.Aug 16 2022, 1:41 PM
This revision was automatically updated to reflect the committed changes.