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: Sebastian Pipping
Subject: Re: [rfc] Colorized output for GNU make?
Date: Fri, 21 Oct 2011 00:33:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20111020 Thunderbird/7.0.1

On 10/20/2011 08:43 PM, Eli Zaretskii wrote:
>> Date: Thu, 20 Oct 2011 20:19:33 +0200
>> From: Sebastian Pipping <address@hidden>
>>
>> I have some new code ready for you to tear apart, err review :-)
> 
> Here's mine:

Thanks Eli!


>   +  /* 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.

Best,



Sebastian



reply via email to

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