tgsi: Fix helgrind complaint about one-time init
authorRob Clark <robdclark@chromium.org>
Tue, 17 Nov 2020 22:47:27 +0000 (14:47 -0800)
committerMarge Bot <eric+marge@anholt.net>
Tue, 24 Nov 2020 21:03:34 +0000 (21:03 +0000)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>

src/gallium/auxiliary/tgsi/tgsi_info.c

index 477876d..7a7148b 100644 (file)
@@ -53,15 +53,12 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
 const struct tgsi_opcode_info *
 tgsi_get_opcode_info(enum tgsi_opcode opcode)
 {
-   static boolean firsttime = 1;
-
    ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, opcode, TGSI_OPCODE_LAST - 1);
    ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, output_mode,
                         TGSI_OUTPUT_OTHER);
 
-   if (firsttime) {
+   do_once {
       unsigned i;
-      firsttime = 0;
       for (i = 0; i < ARRAY_SIZE(opcode_info); i++)
          assert(opcode_info[i].opcode == i);
    }