bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rfc] Colorized output for GNU make?


From: Eli Zaretskii
Subject: Re: [rfc] Colorized output for GNU make?
Date: Fri, 21 Oct 2011 00:45:18 +0200

> Date: Fri, 21 Oct 2011 00:33:51 +0200
> From: Sebastian Pipping <address@hidden>
> 
> >   +  /* Determine target file (i.e. stdout or stderr) and color to pick */
> >   +  switch (type)
> >   +    {
> >   +      case OT_DIR_ENTER: target = stdout; color = color_dir_enter; break;
> >   +      case OT_DIR_LEAVE: target = stdout; color = color_dir_leave; break;
> >   +      case OT_MISC_MESSAGE: target = stdout; color = color_misc_message; 
> > break;
> >   +      case OT_MISC_ERROR: target = stderr; color = color_misc_error; 
> > break;
> >   +      case OT_MISC_FATAL: target = stderr; color = color_misc_fatal; 
> > break;
> >   +      case OT_EXECUTION: target = stdout; color = color_execution; break;
> >   +      default: target = stdout; color = ""; colorize = 0; break;
> >   +    }
> > 
> > This should probably be a data structure, indexed by the OT_* values.
> 
> Actually, I asked myself if I should go for a table lookup but I somehow
> decided against it.  (I was wondering if putting "stderr" into a stacic
> map would end up with a fully initialized stderr or if there could be
> races on that.  If there can, I would need an extra function to get the
> current value of stderr during runtime.  I was also worried if C90 would
> allow me to build that table as I wanted.  That's where the doubts pot
> flow over... an made me go to switch.)
> 
> So while I don't obect to such a change: what kind of gain are you
> aiming here?  Speed?  Maintainability?  Would be cool to hear more.

IMHO, an array is easier to expand, and also the code will be more
compact: doing it your way requires to repeat the same assignments
over and over again.

But hey! this is just MHO.  At the very least wait to hear from Paul
and Boris, they could very well think otherwise.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]