On Tue, Jan 03, 2012 at 07:40:50AM -0800, Ronald S. Bultje wrote:
> On Tue, Jan 3, 2012 at 5:54 AM, Diego Biurrun <[email protected]> wrote:
> > This fixes compilation failures related to START_TIMER/STOP_TIMER macros and
> > -Werror=declaration-after-statement.  START_TIMER declares variables and 
> > thus
> > may not be placed after statements outside of a new block.
> >
> > --- a/libavutil/timer.h
> > +++ b/libavutil/timer.h
> > @@ -46,6 +46,7 @@
> >
> >  #ifdef AV_READ_TIME
> >  #define START_TIMER \
> > +    {               \
> >  uint64_t tend;\
> >  uint64_t tstart= AV_READ_TIME();\
> >
> > @@ -64,6 +65,7 @@ tend= AV_READ_TIME();\
> >         av_log(NULL, AV_LOG_ERROR, "%"PRIu64" decicycles in %s, %d runs, %d 
> > skips\n",\
> >                tsum*10/tcount, id, tcount, tskip_count);\
> >     }\
> > +} \
> >  }
> >  #else
> >  #define START_TIMER
> 
> I preferred the other idea, which is to add an INIT_TIMER macro, like:
> 
> #define INIT_TIMER \
> uint64_t start_time, end_time
> 
> #define START_TIMER \
> start_time = AV_READ_TIME()
> 
> and STOP_TIME stays as it is.

Then you have to move INIT_TIMER to somewhere far away from START_TIMER
and use two macros (INIT_TIMER + START_TIMER) instead of just START_TIMER.
Also, all roundabout 40 START_TIMER instances we have need to be adapted.
How is that an improvement?

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to