<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 13, 2016 at 10:19 AM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Jose Fonseca <<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>><br>
<br>
Not supported by MSVC, and completely unnecessary -- inline functions<br>
work just as well.<br>
<br>
NIR_SRC_INIT/NIR_DEST_INIT could and probably should be replaced by the<br>
inline functions.<br>
<br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
<br>
---<br>
<br>
Jason, I believe you (used to) have an alternative in the vulkan branch.<br>
This approach looks more reasonable imho, although I don't feel strongly<br>
either way.<br>
<br>
-Emil<br>
---<br>
src/compiler/nir/nir.h | 18 ++++++++++++++++--<br>
1 file changed, 16 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index ebac750..0adadc2 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -503,7 +503,14 @@ typedef struct nir_src {<br>
bool is_ssa;<br>
} nir_src;<br>
<br>
-#define NIR_SRC_INIT (nir_src) { { NULL } }<br>
+static inline nir_src<br>
+nir_src_init(void)<br>
+{<br>
+ nir_src src = { { NULL } };<br>
+ return src;<br>
+}<br>
+<br>
+#define NIR_SRC_INIT nir_src_init()<br></blockquote><div><br></div><div>Is this a problem in C or only in C++? If it's only a problem in C++, another option (and I've written this patch before) is to do<br><br></div><div>#ifdef _cplusplus<br></div><div>#define NIR_SRC_INIT nir_src()<br></div><div>#else<br></div><div>#define NIR_SRC_INIT { { NULL } }<br></div><div>#endif<br><br></div><div>and the same for NIR_ALU_SRC_INIT, NIR_DST_INIT, etc.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
#define nir_foreach_use(reg_or_ssa_def, src) \<br>
list_for_each_entry(nir_src, src, &(reg_or_ssa_def)->uses, use_link)<br>
@@ -526,7 +533,14 @@ typedef struct {<br>
bool is_ssa;<br>
} nir_dest;<br>
<br>
-#define NIR_DEST_INIT (nir_dest) { { { NULL } } }<br>
+static inline nir_dest<br>
+nir_dest_init(void)<br>
+{<br>
+ nir_dest dest = { { { NULL } } };<br>
+ return dest;<br>
+}<br>
+<br>
+#define NIR_DEST_INIT nir_dest_init()<br>
<br>
#define nir_foreach_def(reg, dest) \<br>
list_for_each_entry(nir_dest, dest, &(reg)->defs, reg.def_link)<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.8.0<br>
<br>
</font></span></blockquote></div><br></div></div>