Skip to content

Commit

Permalink
util: Update OVS_TYPEOF macro for C++ enabled applications.
Browse files Browse the repository at this point in the history
OVS_TYPEOF macro doesn’t return the type of object for non __GNUC__ platforms.
Updating it to use "decltype" keyword when used from C++ code.

Signed-off-by: Archana Holla <[email protected]>
Signed-off-by: William Tu <[email protected]>
  • Loading branch information
archanapholla authored and williamtu committed Apr 7, 2020
1 parent 146f52b commit 8ea05f1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/openvswitch/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
* assigned to OBJECT. */
#ifdef __GNUC__
#define OVS_TYPEOF(OBJECT) typeof(OBJECT)
#elif defined (__cplusplus)
#define OVS_TYPEOF(OBJECT) decltype(OBJECT)
#else
#define OVS_TYPEOF(OBJECT) void *
#endif
Expand Down

0 comments on commit 8ea05f1

Please sign in to comment.