[Mesa-dev] [PATCH 2/3] mesa: replace date/time macros with MESA_GIT_SHA1

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 5 17:53:11 UTC 2017


On 5 September 2017 at 15:51, Rob Herring <robh at kernel.org> wrote:
> On Tue, Sep 5, 2017 at 9:23 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> Former is non-deterministic and compilers throw a warning about it.
>>
>> Cc: Rob Herring <robh at kernel.org>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>> I think the patch is a good idea, although kind of split about it.
>> Any arguments for/against would be appreciated.
>
> I guess if I had to pick, I'd rather have the git sha1. But really
> both are useful. The time is useful if you want to verify you are
> running your last build. I've heard people sometimes forget to copy
> things over, but that's never happened to me. ;P
>
Precisely my train of thought as well. Although I always double-check
which libraries I'm using - I've been bit a couple of times in the
past.

>> ---
>>  src/mesa/main/context.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index be3f3610117..cc37a0dc4dc 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -138,6 +138,7 @@
>>  #include "math/m_matrix.h"
>>  #include "main/dispatch.h" /* for _gloffset_COUNT */
>>  #include "macros.h"
>> +#include "git_sha1.h"
>>
>>  #ifdef USE_SPARC_ASM
>>  #include "sparc/sparc.h"
>> @@ -398,10 +399,13 @@ one_time_init( struct gl_context *ctx )
>>
>>        atexit(one_time_fini);
>>
>> -#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
>> +#if defined(DEBUG)
>>        if (MESA_VERBOSE != 0) {
>> -         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build %s %s\n",
>> -                     __DATE__, __TIME__);
>> +         _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build"
>> +#ifdef MESA_GIT_SHA1
>
> Would be nice to have a default so you can avoid the ifdef.
>
Good point - silly copy/paste from other parts in Mesa.
Can I fix this everywhere as a follow-up?

-Emil


More information about the mesa-dev mailing list