From 1990cfecd76976d7fb253b9a7c22af335a14c28d Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 21 Jun 2008 21:03:27 +0000 Subject: [PATCH] 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: svn+ssh://projects.linpro.no/svn/varnish/trunk@2763 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/include/libvarnish.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/varnish-cache/include/libvarnish.h b/varnish-cache/include/libvarnish.h index 0f378b25..9ae99cad 100644 --- a/varnish-cache/include/libvarnish.h +++ b/varnish-cache/include/libvarnish.h @@ -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) -- 2.39.5