[igt-dev] [RFC v2 2/3] lib: implement new engine discovery interface

Andi Shyti andi.shyti at intel.com
Thu Nov 22 13:28:27 UTC 2018


Hi Tvrtko,

> > +		for (int __m, __e = 1; (__m = get_engines(fd, ctx)); ) \
> > +			if (__e > __m) \
> > +				break; \
> > +			else \
> > +				for(e = __e ; __e <= __m; e = ++__e)
> 
> I am struggling to figure this out, but it is probably just me. Can it cause
> some compiler warnings for misleading braces, indent or whatever the things
> are it could warn here?
> 
> Would something simpler not work?
> 
> #define for_each_engine_ctx(fd, ctx, e) \
>    for (int __e = 0, __m = get_engines(fd, ctx);
> 	(e) = __e, __e < __m;
> 	__e++)
> 
> I am probably missing something elementary...

It doesn't complain, but I already simplified this macro.
I just used Chris's way just for the RFC (also because it ends up
calling calling get_engines() twice).

I agree with all your comments from this and the other RFC. I
will post directly the patch next, with few more improvements.

Important for me was not to go off track with this.

Thanks a lot, Tvrtko,
Andi


More information about the igt-dev mailing list