[ovs-dev,PATCHv3,2/4] ovsdb-idl: Avoid mutable type specifier.

Message ID 20170811180647.641-3-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Aug. 11, 2017, 6:06 p.m.
In C++, 'mutable' is a keyword. If this is used as the name for a field,
then C++ compilers can get confused about the context and fail to
compile references to such fields. Rename the field to 'is_mutable' to
avoid this issue.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
v3: Rename to 'is_mutable'.
v2: Rebase.
---
 lib/ovsdb-idl-provider.h | 2 +-
 lib/ovsdb-idl.c          | 2 +-
 ovsdb/ovsdb-idlc.in      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Aug. 11, 2017, 6:40 p.m. | #1
On Fri, Aug 11, 2017 at 11:06:45AM -0700, Joe Stringer wrote:
> In C++, 'mutable' is a keyword. If this is used as the name for a field,
> then C++ compilers can get confused about the context and fail to
> compile references to such fields. Rename the field to 'is_mutable' to
> avoid this issue.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
> v3: Rename to 'is_mutable'.
> v2: Rebase.

Acked-by: Ben Pfaff <blp@ovn.org>

Patch

diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index a2eb8cac67d7..cdb41221e43d 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -89,7 +89,7 @@  struct ovsdb_idl_row {
 struct ovsdb_idl_column {
     char *name;
     struct ovsdb_type type;
-    bool mutable;
+    bool is_mutable;
     void (*parse)(struct ovsdb_idl_row *, const struct ovsdb_datum *);
     void (*unparse)(struct ovsdb_idl_row *);
 };
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 227aa5fbfcb2..2d0aa85ee311 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -2871,7 +2871,7 @@  bool
 ovsdb_idl_is_mutable(const struct ovsdb_idl_row *row,
                      const struct ovsdb_idl_column *column)
 {
-    return column->mutable || (row->new && !row->old);
+    return column->is_mutable || (row->new && !row->old);
 }
 
 /* Returns false if 'row' was obtained from the IDL, true if it was initialized
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index bb07c21a80d0..24e86b772fbe 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -1268,7 +1268,7 @@  void
          .type = {
 %(type)s
          },
-         .mutable = %(mutable)s,
+         .is_mutable = %(mutable)s,
          .parse = %(s)s_parse_%(c)s,
          .unparse = %(s)s_unparse_%(c)s,
     },\n""" % {'P': prefix.upper(),