From: Amos Jeffries Date: Wed, 9 Oct 2013 14:04:57 +0000 (-0600) Subject: Fix CBDATA_CLASS2 macro definition X-Git-Tag: SQUID_3_5_0_1~601 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6f8a323677b69686fe76cbe6f94155b1a1144ff;p=thirdparty%2Fsquid.git Fix CBDATA_CLASS2 macro definition CBDATA_UNKNOWN was being used in place of a void no-op statement. This was incorrect and useless. Now that the value definition is fixed it is being picked up by the stricter compilers. Replace the trinary conditional with an if-statement. --- diff --git a/src/cbdata.h b/src/cbdata.h index f480596ee1..d0b5d6aa8b 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -285,7 +285,8 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, public: \ void *operator new(size_t size) { \ assert(size == sizeof(type)); \ - (CBDATA_##type ? CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \ + if (!CBDATA_##type) \ + CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL); \ return cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__); \ } \ void operator delete (void *address) { \ @@ -332,7 +333,7 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, /** * \ingroup CBDATAAPI * - * This needs to be defined LAST in teh class definition. It plays with private/public states in C++. + * This needs to be defined LAST in the class definition. It plays with private/public states in C++. */ #define CBDATA_CLASS2(type) \ private: \ @@ -340,7 +341,8 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, public: \ void *operator new(size_t size) { \ assert(size == sizeof(type)); \ - (CBDATA_##type ? CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \ + if (!CBDATA_##type) \ + CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL); \ return (type *)cbdataInternalAlloc(CBDATA_##type); \ } \ void operator delete (void *address) { \