Page MenuHomeFreeBSD

linuxkpi compiler.h: replace dummy expressions with dummy statements
ClosedPublic

Authored by rlibby on Jul 22 2017, 5:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 19 2024, 2:25 AM
Unknown Object (File)
Jan 29 2024, 5:36 AM
Unknown Object (File)
Dec 31 2023, 1:38 PM
Unknown Object (File)
Sep 7 2023, 8:42 PM
Unknown Object (File)
Sep 4 2023, 11:45 AM
Unknown Object (File)
Aug 6 2023, 9:30 AM
Unknown Object (File)
Aug 2 2023, 9:59 AM
Unknown Object (File)
Jul 15 2023, 4:28 PM

Details

Summary

It looks like the __acquire and __release macros are for the consumption of static analysis tools and have no semantic effect. Transform the definitions from constant expressions to empty statements in order to avoid -Wunused-value from gcc.

I glanced through linux kernel code and didn't see any places where __acquire or __release were actually being used as expressions.

Test Plan

buildkernel with gcc

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/compat/linuxkpi/common/include/linux/compiler.h
43 ↗(On Diff #31076)

It looks like these require the same treatment. They're unused at the moment, but it wouldn't hurt to fix them while here.

sys/compat/linuxkpi/common/include/linux/compiler.h
43 ↗(On Diff #31076)

So I actually did look at __chk_user_ptr & __chk_io_ptr and it looked like they were being used in an expression context in some linux kernel code (uselessly, in non-ultimate position of comma expressions. Define a value, cast off its type, then comma off its value ... ). So I thought to punt for now. Since, as you say, they're unused by us for now, it won't matter. Alternate could be (void)0 (for just those two or all four). What's your preference here?

sys/compat/linuxkpi/common/include/linux/compiler.h
43 ↗(On Diff #31076)

Ah, I see. I think it'd make sense to use (void)0 in this case and keep the dummy statements below, but I don't feel strongly about it.

markj feedback: also quiet future warnings for __chk_{user,io}_ptr

Thanks for fixing this, approved.

This revision is now accepted and ready to land.Jul 22 2017, 5:51 PM
This revision was automatically updated to reflect the committed changes.