diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-02 19:40:53 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-02 19:40:53 +0200 |
commit | 9194e1700312f27c6e2abdfb1f604e130497e887 (patch) | |
tree | b8aff846ffca0041e9865850875025968fa9fc7e /lib/setup_once.h | |
parent | 749dbfbc87d6043c4bfb57041ecbf2be6a1d42bb (diff) |
MemoryTracking: fix logging of free() calls done where Curl_safefree is called
Just internal stuff...
Curl_safefree is now a macro defined in memdebug.h instead of a function
prototyped in url.h and implemented in url.c, so inclusion of url.h is no
longer required in order to simply use Curl_safefree.
Provide definition of macro WHILE_FALSE in setup_once.h in order to allow
other macros such as DEBUGF and DEBUGASSERT, and code using it, to compile
without 'conditional expression is constant' warnings.
The WHILE_FALSE stuff fixes 150+ MSVC compiler warnings.
Diffstat (limited to 'lib/setup_once.h')
-rw-r--r-- | lib/setup_once.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/setup_once.h b/lib/setup_once.h index 4f7d0d791..63a3698de 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -303,6 +303,27 @@ struct timeval { /* + * Macro WHILE_FALSE may be used to build single-iteration do-while loops, + * avoiding compiler warnings. Mostly intended for other macro definitions. + */ + +#define WHILE_FALSE while(0) + +#if defined(_MSC_VER) && !defined(__POCC__) +# undef WHILE_FALSE +# if (_MSC_VER < 1500) +# define WHILE_FALSE while(1, 0) +# else +# define WHILE_FALSE \ +__pragma(warning(push)) \ +__pragma(warning(disable:4127)) \ +while(0) \ +__pragma(warning(pop)) +# endif +#endif + + +/* * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. */ @@ -339,7 +360,7 @@ typedef int sig_atomic_t; #ifdef DEBUGBUILD #define DEBUGF(x) x #else -#define DEBUGF(x) do { } while (0) +#define DEBUGF(x) do { } WHILE_FALSE #endif @@ -350,7 +371,7 @@ typedef int sig_atomic_t; #if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) #define DEBUGASSERT(x) assert(x) #else -#define DEBUGASSERT(x) do { } while (0) +#define DEBUGASSERT(x) do { } WHILE_FALSE #endif |