On Wed, Apr 13, 2016 at 10:19 AM, Emil Velikov <emil.l.veli...@gmail.com> wrote:
> From: Jose Fonseca <jfons...@vmware.com> > > Not supported by MSVC, and completely unnecessary -- inline functions > work just as well. > > NIR_SRC_INIT/NIR_DEST_INIT could and probably should be replaced by the > inline functions. > > Cc: Jason Ekstrand <ja...@jlekstrand.net> > > --- > > Jason, I believe you (used to) have an alternative in the vulkan branch. > This approach looks more reasonable imho, although I don't feel strongly > either way. > > -Emil > --- > src/compiler/nir/nir.h | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h > index ebac750..0adadc2 100644 > --- a/src/compiler/nir/nir.h > +++ b/src/compiler/nir/nir.h > @@ -503,7 +503,14 @@ typedef struct nir_src { > bool is_ssa; > } nir_src; > > -#define NIR_SRC_INIT (nir_src) { { NULL } } > +static inline nir_src > +nir_src_init(void) > +{ > + nir_src src = { { NULL } }; > + return src; > +} > + > +#define NIR_SRC_INIT nir_src_init() > 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 #ifdef _cplusplus #define NIR_SRC_INIT nir_src() #else #define NIR_SRC_INIT { { NULL } } #endif and the same for NIR_ALU_SRC_INIT, NIR_DST_INIT, etc. --Jason > #define nir_foreach_use(reg_or_ssa_def, src) \ > list_for_each_entry(nir_src, src, &(reg_or_ssa_def)->uses, use_link) > @@ -526,7 +533,14 @@ typedef struct { > bool is_ssa; > } nir_dest; > > -#define NIR_DEST_INIT (nir_dest) { { { NULL } } } > +static inline nir_dest > +nir_dest_init(void) > +{ > + nir_dest dest = { { { NULL } } }; > + return dest; > +} > + > +#define NIR_DEST_INIT nir_dest_init() > > #define nir_foreach_def(reg, dest) \ > list_for_each_entry(nir_dest, dest, &(reg)->defs, reg.def_link) > -- > 2.8.0 > >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev