[Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

Matt Turner mattst88 at gmail.com
Tue Mar 3 20:20:07 PST 2015


On Tue, Mar 3, 2015 at 8:07 PM, Brian Paul <brianp at vmware.com> wrote:
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 5210acc..e2578cf 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -493,7 +493,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>     builder.setMCPU(MCPU);
>  #endif
>
> -   ShaderMemoryManager *MM;
> +   ShaderMemoryManager *MM = NULL;
>     if (useMCJIT) {
>  #if HAVE_LLVM > 0x0303
>         BaseMemoryManager* JMM = reinterpret_cast<BaseMemoryManager*>(CMM);
> --
> 1.9.1

I'm guessing it's the 'delete MM;' that generates the warning? If so,
shouldn't you just wrap it in #if HAVE_LLVM > ...?

I think MCJIT is the only option in llvm >= 3.6? The code could
probably be trivially refactored to avoid the assert(0) as well.

>From what I can tell, it seems like adding initializers is nearly
always the wrong thing to do.


More information about the mesa-dev mailing list