[ovs-git] [openvswitch/ovs] d9e75b: util: Make ovs_assert() always expand so that it s...

GitHub noreply at github.com
Tue Oct 10 15:00:10 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: d9e75b82999dc3cb87aab39c200189018e5a9ce1
      https://github.com/openvswitch/ovs/commit/d9e75b82999dc3cb87aab39c200189018e5a9ce1
  Author: Ben Pfaff <blp at ovn.org>
  Date:   2017-10-10 (Tue, 10 Oct 2017)

  Changed paths:
    M include/openvswitch/util.h
    M ofproto/ofproto-dpif-xlate.c

  Log Message:
  -----------
  util: Make ovs_assert() always expand so that it should be followed by ;

ovs_assert() is normally invoked like a function call, e.g.:
    ovs_assert(true);
but its expansion was a full statement, so that this ended up expanding to:
    if (!OVS_LIKELY(true)) {                                       \
  ovs_assert_failure(OVS_SOURCE_LOCATOR, __func__, #CONDITION);       \
    };
with both } and ; at the end, which is weird and somewhat risky around 'if'
statements.

This commit fixes the problem, making ovs_assert() expand to an expression.

Reported-by: Greg Rose <gvrose8192 at gmail.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>




More information about the git mailing list