[ovs-dev] [PATCH 09/15] datapath-windows: Add macros in Debug.h

Nithin Raju nithin at vmware.com
Sat Aug 16 06:47:51 UTC 2014

There are lot of assumptions here about how code should be structured and written. eg. there's an implicit assumption that 'Cleanup' should be defined.

Let's table this for sometime till we get the current code starts working with netlink.

If you can point me to some code what is using these macros, I might be able to comment better.

> +//OVS_USE_ASSERTS is not #define-d on release mode
> +#define OVS_CHECK(x) ASSERT(x)
> +#define OVS_CHECK_OR(x, expr) { if (!(x)) { ASSERT(0); expr; } }
> +#define OVS_CHECK_BREAK(x) { if (!(x)) { ASSERT(0); break; } }
> +#define OVS_CHECK_RET(x, value) { if (!(x)) { ASSERT(0); return value; } }
> +#define OVS_CHECK_GC(x) { if (!(x)) { ASSERT(0); goto Cleanup; } }
> +#else
> +#define OVS_CHECK(x)
> +#define OVS_CHECK_OR(x, expr) { if (!(x)) expr; }
> +#define OVS_CHECK_BREAK(x) { if (!(x)) break; }
> +#define OVS_CHECK_RET(x, value) { if (!(x)) return value; }
> +#define OVS_CHECK_GC(x) { if (!(x)) goto Cleanup; }
> +#endif //OVS_USE_ASSERTS

I don't think we need two separate definitions. If ASSERT() is defined debug only, then it would be a no-op in 'OVS_USE_ASSERTS'.


More information about the dev mailing list