[Mesa-dev] [PATCH] ac: add unreachable() in ac_build_image_opcode()

Marek Olšák maraeo at gmail.com
Mon Apr 10 15:06:14 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Fri, Apr 7, 2017 at 6:44 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> To silent the following compiler warning:
>
> common/ac_llvm_build.c: In function ‘ac_build_image_opcode’:
> common/ac_llvm_build.c:1080:3: warning: ‘name’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    snprintf(intr_name, sizeof(intr_name), "%s%s%s%s.v4f32.%s.v8i32",
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     name,
>     ~~~~~
>     a->compare ? ".c" : "",
>     ~~~~~~~~~~~~~~~~~~~~~~~
>     a->bias ? ".b" :
>     ~~~~~~~~~~~~~~~~
>     a->lod ? ".l" :
>     ~~~~~~~~~~~~~~~
>     a->deriv ? ".d" :
>     ~~~~~~~~~~~~~~~~~
>     a->level_zero ? ".lz" : "",
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     a->offset ? ".o" : "",
>     ~~~~~~~~~~~~~~~~~~~~~~
>     type);
>     ~~~~~
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/amd/common/ac_llvm_build.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index 5745fab05f..d45094c862 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -1072,6 +1072,8 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
>                 case ac_image_get_resinfo:
>                         name = "llvm.amdgcn.image.getresinfo";
>                         break;
> +               default:
> +                       unreachable("invalid image opcode");
>                 }
>
>                 ac_build_type_name_for_intr(LLVMTypeOf(args[0]), type,
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list