Using it encourages the (IMHO worrying) practice of leaving member variables uninitialized in constructor definitions. This macro shouldn't be necessary anymore after the last patch series fixing all its users to initialize all member variables from the class constructor. Remove it. --- src/glsl/ralloc.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/glsl/ralloc.h b/src/glsl/ralloc.h index 82a3daa..22ed7f3 100644 --- a/src/glsl/ralloc.h +++ b/src/glsl/ralloc.h @@ -404,7 +404,17 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); } /* end of extern "C" */ #endif -#define _RALLOC_OPS(ALLOC, TYPE) \ +/** + * Declare C++ new and delete operators which use ralloc. + * + * Placing one of these macros in the body of a class makes it possible to do: + * + * TYPE *var = new(mem_ctx) TYPE(...); + * delete var; + * + * which is more idiomatic in C++ than calling ralloc or rzalloc. + */ +#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) \ private: \ static void _ralloc_##TYPE##_destructor_callback(void *p) \ { \ @@ -413,7 +423,7 @@ private: \ public: \ static void* operator new(size_t size, void *mem_ctx) \ { \ - void *p = ALLOC(mem_ctx, size); \ + void *p = ralloc_size(mem_ctx, size); \ assert(p != NULL); \ ralloc_set_destructor(p, _ralloc_##TYPE##_destructor_callback); \ return p; \ @@ -425,17 +435,5 @@ public: \ ralloc_free(p); \ } -/** - * Declare C++ new and delete operators which use ralloc. - * - * Placing one of these macros in the body of a class makes it possible to do: - * - * TYPE *var = new(mem_ctx) TYPE(...); - * delete var; - * - * which is more idiomatic in C++ than calling ralloc or rzalloc. - */ -#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(ralloc_size, TYPE) -#define DECLARE_RZALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(rzalloc_size, TYPE) #endif -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev