Re: [Mesa-dev] [PATCH 01/10] util: fix new gcc6 warnings

2016-02-18 Thread Ian Romanick
This patch is

Reviewed-by: Ian Romanick 

On 02/17/2016 09:34 AM, Rob Clark wrote:
> src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined 
> but not used [-Wunused-const-variable]
>  static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>^~
> 
> I went w/ enum, rather than #define, mostly because a lowercase #define
> is funny looking, and changing the case would have been more churn.
> 
> Signed-off-by: Rob Clark 
> ---
>  src/util/hash_table.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/hash_table.h b/src/util/hash_table.h
> index 85b013c..c69abfa 100644
> --- a/src/util/hash_table.h
> +++ b/src/util/hash_table.h
> @@ -108,7 +108,9 @@ static inline uint32_t _mesa_hash_pointer(const void 
> *pointer)
> return _mesa_hash_data(, sizeof(pointer));
>  }
>  
> -static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
> +enum {
> +   _mesa_fnv32_1a_offset_bias = 2166136261u,
> +};
>  
>  static inline uint32_t
>  _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/10] util: fix new gcc6 warnings

2016-02-16 Thread Matt Turner
On Tue, Feb 16, 2016 at 11:37 AM, Ian Romanick  wrote:
> On 02/16/2016 10:57 AM, Rob Clark wrote:
>> src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined 
>> but not used [-Wunused-const-variable]
>>  static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>>^~
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  src/util/hash_table.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/util/hash_table.h b/src/util/hash_table.h
>> index 85b013c..a0244d7 100644
>> --- a/src/util/hash_table.h
>> +++ b/src/util/hash_table.h
>> @@ -108,7 +108,7 @@ static inline uint32_t _mesa_hash_pointer(const void 
>> *pointer)
>> return _mesa_hash_data(, sizeof(pointer));
>>  }
>>
>> -static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>> +static const uint32_t _mesa_fnv32_1a_offset_bias UNUSED = 2166136261u;
>
> Looking at how it's used in the code, this seems like it should either
> be a #define or an anonymous union.  I mean, I had to go look at the
> code to figure out why it should be UNUSED instead of just removed. :)
>
> enum { _mesa_fnv32_1a_offset_bias = 2166136261u };

I agree either of these would be better. Putting static data in a
header file is strange.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/10] util: fix new gcc6 warnings

2016-02-16 Thread Rob Clark
On Tue, Feb 16, 2016 at 2:37 PM, Ian Romanick  wrote:
> On 02/16/2016 10:57 AM, Rob Clark wrote:
>> src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined 
>> but not used [-Wunused-const-variable]
>>  static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>>^~
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  src/util/hash_table.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/util/hash_table.h b/src/util/hash_table.h
>> index 85b013c..a0244d7 100644
>> --- a/src/util/hash_table.h
>> +++ b/src/util/hash_table.h
>> @@ -108,7 +108,7 @@ static inline uint32_t _mesa_hash_pointer(const void 
>> *pointer)
>> return _mesa_hash_data(, sizeof(pointer));
>>  }
>>
>> -static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>> +static const uint32_t _mesa_fnv32_1a_offset_bias UNUSED = 2166136261u;
>
> Looking at how it's used in the code, this seems like it should either
> be a #define or an anonymous union.  I mean, I had to go look at the
> code to figure out why it should be UNUSED instead of just removed. :)
>
> enum { _mesa_fnv32_1a_offset_bias = 2166136261u };

I'm *assuming* the purpose of the current approach is to have type
safety.. although I guess we could do #define FOO ((uint32_t)...)..

BR,
-R

>>
>>  static inline uint32_t
>>  _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t 
>> size)
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/10] util: fix new gcc6 warnings

2016-02-16 Thread Ian Romanick
On 02/16/2016 10:57 AM, Rob Clark wrote:
> src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined 
> but not used [-Wunused-const-variable]
>  static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
>^~
> 
> Signed-off-by: Rob Clark 
> ---
>  src/util/hash_table.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/hash_table.h b/src/util/hash_table.h
> index 85b013c..a0244d7 100644
> --- a/src/util/hash_table.h
> +++ b/src/util/hash_table.h
> @@ -108,7 +108,7 @@ static inline uint32_t _mesa_hash_pointer(const void 
> *pointer)
> return _mesa_hash_data(, sizeof(pointer));
>  }
>  
> -static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u;
> +static const uint32_t _mesa_fnv32_1a_offset_bias UNUSED = 2166136261u;

Looking at how it's used in the code, this seems like it should either
be a #define or an anonymous union.  I mean, I had to go look at the
code to figure out why it should be UNUSED instead of just removed. :)

enum { _mesa_fnv32_1a_offset_bias = 2166136261u };

>  
>  static inline uint32_t
>  _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev