[ovs-git] Open vSwitch: Avoid sparse error or warning for sizeof(_Bool). (master)

dev at openvswitch.org dev at openvswitch.org
Mon May 23 19:15:05 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  7fae24e67c95b1dbe93497135ae533e39b61e110 (commit)
      from  7fb563b94c6b265f5dae9965fe33392716a7886e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7fae24e67c95b1dbe93497135ae533e39b61e110
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=7fae24e67c95b1dbe93497135ae533e39b61e110
Author: Ben Pfaff <blp at nicira.com>
		
Avoid sparse error or warning for sizeof(_Bool).
		
The sparse checker does not like taking sizeof(_Bool).  Older versions of
sparse output a hard error ("error: cannot size expression").  Newer
versions output a warning ("warning: expression using sizeof bool").  This
commit avoids the problem by not using sizeof(_Bool) anywhere.

The only place where OVS uses sizeof(_Bool) anyway is in code generated by
the OVSDB IDL.  It generates it for populating "optional bool" columns in
the database, that is, columns that are allowed to contain 0 or 1 instances
of a bool.  For these columns, it generates code that looks roughly like
this:
    row->column = xmalloc(sizeof *row->column);
    *row->column = value;
This commit changes these columns from type "bool *" to type "const bool *"
and changes the generated code to:
    static const bool true_value = true;
    static const bool false_value = false;

    row->column = value ? &true_value : &false_value;
which avoids the problem and saves a malloc() call at the same time.

The idltest code had a column with a slightly different type ("0, 1, or
2 bools") that didn't fit the revised pattern and is a fairly stupid type
anyhow, so I just changed it to "0 or 1 bools".


-----------------------------------------------------------------------

Summary of changes:
 ovsdb/ovsdb-idlc.in     |   34 ++++++++++++++-
 tests/idltest.ovsschema |    2 +-
 tests/ovsdb-idl-py.at   |   22 +++++-----
 tests/ovsdb-idl.at      |   28 ++++++------
 vswitchd/vswitch.pic    |  104 +++++++++++++++++++++--------------------------
 5 files changed, 105 insertions(+), 85 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list