ac: add unreachable() in ac_build_image_opcode()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 7 Apr 2017 16:44:16 +0000 (18:44 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 10 Apr 2017 21:02:12 +0000 (23:02 +0200)
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@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_llvm_build.c

index 5745fab05fbdddcc906a482b059622c82c5433c2..d45094c86241e737c0a1b592bc81db887488e17a 100644 (file)
@@ -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,