[ovs-dev] [PATCHv2] lib/util.h: Disable ovs_assert when build with NDEBUG

Ben Pfaff blp at nicira.com
Fri Dec 13 18:30:56 UTC 2013


On Fri, Dec 13, 2013 at 06:54:27PM +0100, Helmut Schaa wrote:
> Reduces binary size. Use a static inline function instead of
> a macro to not get "unused variable" warnings everywhere.
> 
> Making ovs_assert an empty inline in the header file effectively
> optimizes out all calls to ovs_assert.
> 
> Signed-off-by: Helmut Schaa <helmut.schaa at googlemail.com>
> ---
>  lib/util.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/util.h b/lib/util.h
> index 975d1a9..cc70f0e 100644
> --- a/lib/util.h
> +++ b/lib/util.h
> @@ -68,11 +68,16 @@
>   *
>   *   - Writes the failure message to the log.
>   *
> - *   - Not affected by NDEBUG. */
> + *   - Gets optimized out by NDEBUG. */

This list is supposed to be *differences* from assert() ;-)

I changed the list item to 
    - NDEBUG only affects the first time util.h is included.

and I'll apply this soon.



More information about the dev mailing list