Commit 87bc8979 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a diagnostic() wrapper around assert() for checks which are so expensive

that we may want to compile them out for performance at a latter date.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2763 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 60b50ef2
......@@ -62,7 +62,12 @@ int vtmpfile(char *);
/*
* assert(), AN() and AZ() are static checks that should not happen.
* xxxassert(), XXXAN() and XXXAZ() are markers for missing code.
* In general asserts should be cheap, such as checking return
* values and similar.
* diagnostic() are asserts which are so expensive that we may want
* to compile them out for performance at a later date.
* xxxassert(), XXXAN() and XXXAZ() marks conditions we ought to
* handle gracefully, such as malloc failure.
*/
#ifdef WITHOUT_ASSERTS
......@@ -89,3 +94,4 @@ void lbv_xxxassert(const char *, const char *, int, const char *, int);
#define AN(foo) do { assert((foo) != 0); } while (0)
#define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0)
#define XXXAN(foo) do { xxxassert((foo) != 0); } while (0)
#define diagnostic(foo) assert(foo)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment