Mesa (master): isl: Don't use designated initializers in the header

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Apr 22 03:45:38 UTC 2016


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Fri Apr 15 16:32:33 2016 -0700

isl: Don't use designated initializers in the header

C++ doesn't support designated initializers and g++ in particular doesn't
handle them when the struct gets complicated, i.e. has a union.

Reviewed-by: Chad Versace <chad.versace at intel.com>

---

 src/intel/isl/isl.h | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 6683a08..62d3769 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -979,25 +979,38 @@ isl_surf_info_is_z32_float(const struct isl_surf_init_info *info)
 static inline struct isl_extent2d
 isl_extent2d(uint32_t width, uint32_t height)
 {
-   return (struct isl_extent2d) { .w = width, .h = height };
+   struct isl_extent2d e = { { 0 } };
+
+   e.width = width;
+   e.height = height;
+
+   return e;
 }
 
 static inline struct isl_extent3d
 isl_extent3d(uint32_t width, uint32_t height, uint32_t depth)
 {
-   return (struct isl_extent3d) { .w = width, .h = height, .d = depth };
+   struct isl_extent3d e = { { 0 } };
+
+   e.width = width;
+   e.height = height;
+   e.depth = depth;
+
+   return e;
 }
 
 static inline struct isl_extent4d
 isl_extent4d(uint32_t width, uint32_t height, uint32_t depth,
              uint32_t array_len)
 {
-   return (struct isl_extent4d) {
-      .w = width,
-      .h = height,
-      .d = depth,
-      .a = array_len,
-   };
+   struct isl_extent4d e = { { 0 } };
+
+   e.width = width;
+   e.height = height;
+   e.depth = depth;
+   e.array_len = array_len;
+
+   return e;
 }
 
 #define isl_surf_init(dev, surf, ...) \
@@ -1061,11 +1074,9 @@ isl_surf_get_image_alignment_sa(const struct isl_surf *surf)
 {
    const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
 
-   return (struct isl_extent3d) {
-      .w = fmtl->bw * surf->image_alignment_el.w,
-      .h = fmtl->bh * surf->image_alignment_el.h,
-      .d = fmtl->bd * surf->image_alignment_el.d,
-   };
+   return isl_extent3d(fmtl->bw * surf->image_alignment_el.w,
+                       fmtl->bh * surf->image_alignment_el.h,
+                       fmtl->bd * surf->image_alignment_el.d);
 }
 
 /**




More information about the mesa-commit mailing list