summaryrefslogtreecommitdiff
path: root/tests/lib/cxxcompat.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-06-13 08:38:05 -0400
committerGitHub <noreply@github.com>2019-06-13 08:38:05 -0400
commita8baba69aef8bdcb1e3f3eaea468e392ba6a0116 (patch)
treef2ba3a9f27d123ddbcd192f8a8095db18109cb93 /tests/lib/cxxcompat.c
parent230113cf7123d2d1b9c686368e44a5b320fd8fc9 (diff)
parenta7f20d4328092b382c26c6d738e575c1ead9dc91 (diff)
Merge pull request #4448 from opensourcerouting/cxx-container-of
lib: const-unaware container_of for C++
Diffstat (limited to 'tests/lib/cxxcompat.c')
-rw-r--r--tests/lib/cxxcompat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/lib/cxxcompat.c b/tests/lib/cxxcompat.c
index 48fa0ec8a9..6624de7386 100644
--- a/tests/lib/cxxcompat.c
+++ b/tests/lib/cxxcompat.c
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#define test__cplusplus
+
#include "lib/zebra.h"
#include "lib/agg_table.h"
@@ -107,6 +109,17 @@
#include "lib/zassert.h"
#include "lib/zclient.h"
+PREDECL_RBTREE_UNIQ(footree)
+struct foo {
+ int dummy;
+ struct footree_item item;
+};
+static int foocmp(const struct foo *a, const struct foo *b)
+{
+ return memcmp(&a->dummy, &b->dummy, sizeof(a->dummy));
+}
+DECLARE_RBTREE_UNIQ(footree, struct foo, item, foocmp)
+
int main(int argc, char **argv)
{
return 0;