Mesa (master): tgsi: Fix helgrind complaint about one-time init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 24 21:24:54 UTC 2020


Module: Mesa
Branch: master
Commit: d91fe7d1c65179e64a6ca294135ac1bad2b16fb9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d91fe7d1c65179e64a6ca294135ac1bad2b16fb9

Author: Rob Clark <robdclark at chromium.org>
Date:   Tue Nov 17 14:47:27 2020 -0800

tgsi: Fix helgrind complaint about one-time init

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>

---

 src/gallium/auxiliary/tgsi/tgsi_info.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 477876d7e52..7a7148b5de6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -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);
    }



More information about the mesa-commit mailing list