Mesa (master): util: Fix/silence variable shadowing warnings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 16 10:37:56 UTC 2020


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

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Wed Nov 11 17:18:21 2020 +0100

util: Fix/silence variable shadowing warnings

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7552>

---

 src/util/format/u_format.h | 4 ++++
 src/util/half_float.h      | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h
index 4030c0efb76..cdd91241564 100644
--- a/src/util/format/u_format.h
+++ b/src/util/format/u_format.h
@@ -382,6 +382,9 @@ struct util_format_unpack_description {
 typedef void (*util_format_fetch_rgba_func_ptr)(void *dst, const uint8_t *src,
                                                 unsigned i, unsigned j);
 
+/* Silence warnings triggered by sharing function/struct names */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
 const struct util_format_description *
 util_format_description(enum pipe_format format) ATTRIBUTE_CONST;
 
@@ -390,6 +393,7 @@ util_format_pack_description(enum pipe_format format) ATTRIBUTE_CONST;
 
 const struct util_format_unpack_description *
 util_format_unpack_description(enum pipe_format format) ATTRIBUTE_CONST;
+#pragma GCC diagnostic pop
 
 /**
  * Returns a function to fetch a single pixel (i, j) from a block.
diff --git a/src/util/half_float.h b/src/util/half_float.h
index c52bccf8d1e..4e15b2bdb0b 100644
--- a/src/util/half_float.h
+++ b/src/util/half_float.h
@@ -123,7 +123,7 @@ struct float16_t {
    uint16_t bits;
    float16_t(float f) : bits(_mesa_float_to_half(f)) {}
    float16_t(double d) : bits(_mesa_float_to_half(d)) {}
-   float16_t(uint16_t bits) : bits(bits) {}
+   float16_t(uint16_t raw_bits) : bits(raw_bits) {}
    static float16_t one() { return float16_t(FP16_ONE); }
    static float16_t zero() { return float16_t(FP16_ZERO); }
 };



More information about the mesa-commit mailing list