tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: changing KASSERT()'s definition for non-diag kernels



On Sun, 20 Oct 2013, matthew green wrote:
as part of the GCC 4.8 preparation work, we're seeing many new warnings where variables are only used inside KASSERT(), but the non-diag kernel builds trigger errors.

my solution, rather than marking these variables with __USE(), is to change KASSERT() into a real function that consumes its arguments, but is still an empty function.

That seems sensible to me. More generally, a lot of our exiting macros can be rewritten as static inline functions, now that we require a C99 compiler.

note that there is a re-direction to force the input to KASSERT() to be an integer type, as it is called with all sorts of types of input (pointers, values, boolean expressions..)

The KASSERT macro can be invoked with anything that has a truth value as its first argument. Casting that to int seems reasonable, but perhaps using (!!(e)) to convert any type to a truth value would be clearer and less likely to trigger compiler warnings about casting non-numeric types to int.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index