[prev in list] [next in list] [prev in thread] [next in thread]
List: netbsd-tech-kern
Subject: Re: changing KASSERT()'s definition for non-diag kernels
From: Alan Barrett <apb () cequrux ! com>
Date: 2013-10-20 8:28:35
Message-ID: 20131020082835.GH1154 () apb-laptoy ! apb ! alt ! za
[Download RAW message or body]
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)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic