[Mesa-dev] [PATCH 3/4] freedreno/ir3: Add missing braces in initializer

Rob Clark robdclark at gmail.com
Thu Jul 28 18:07:44 UTC 2016


tbh, I haven't used anything as ancient as 4.6 in a while.. these days
I'm using 6.1 and even with 5.x I don't remember seeing that warning.

Maybe we can just drop -Wmissing-field-initializers??

BR,
-R

On Thu, Jul 28, 2016 at 1:16 PM, Francesco Ansanelli
<francians at gmail.com> wrote:
> Hi,
>
> with my version of the compiler:
>
> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
>
> and original code ({0}) I get:
>
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
> braces around initializer [-Wmissing-braces]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
> initialization for ‘key.<anonymous>’) [-Wmissing-braces]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
> initializer [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
> initialization for ‘key.<anonymous>.<anonymous>.has_per_samp’)
> [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
> initializer [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
> initialization for ‘key.vsaturate_s’) [-Wmissing-field-initializers]
>
> with the change suggested by Eric ({{{0}}}) I get:
>
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
> initializer [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
> initialization for ‘key.<anonymous>.<anonymous>.has_per_samp’)
> [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: missing
> initializer [-Wmissing-field-initializers]
> src/gallium/drivers/freedreno/ir3/ir3_shader.c:312:17: warning: (near
> initialization for ‘key.vsaturate_s’) [-Wmissing-field-initializers]
>
> With my latest suggestion no warnings on that row, neither from clang:
>
> Ubuntu clang version 3.4-1ubuntu3~precise2 (tags/RELEASE_34/final) (based on
> LLVM 3.4)
>
> Up to you how to proceed..
>
> Cheers
> Francesco
>
>
> 2016-07-28 12:54 GMT+02:00 Rob Clark <robdclark at gmail.com>:
>>
>> On Thu, Jul 28, 2016 at 6:31 AM, Emil Velikov <emil.l.velikov at gmail.com>
>> wrote:
>> > On 28 July 2016 at 09:21, Eric Engestrom <eric.engestrom at imgtec.com>
>> > wrote:
>> >> On Wed, Jul 27, 2016 at 07:37:56PM +0200, Francesco Ansanelli wrote:
>> >>> Hello,
>> >>>
>> >>> unluckily this didn't fix the warning...
>> >>> I've done some more compile testing and found this solution:
>> >>>
>> >>> - static struct ir3_shader_key key = {{0}};
>> >>> +static struct ir3_shader_key key = {{{0, 0, 0, 0, 0, 0, 0, 0}}, 0, 0,
>> >>> 0,
>> >>> 0, 0, 0, 0, 0};
>> >>
>> >> So there are 3 levels of structs? The proper fix IMHO should then be
>> >> {{{0}}}, as the rest of the 0's are implied.
>> >> Can you test if that fixes it?
>> >>
>> > The original code is perfect (follows the spec) as-is. There's been a
>> > number of gcc bugs on the topic, hence why sometimes people prefer
>> > memset.
>> > Which one people will opt for is quite subjective but I'd rather leave
>> > the call to Rob.
>>
>> I'm leaning towards just going back to {0}, since at least gcc (at
>> least modern versions) didn't seem to complain about that, but do
>> complain about {{0}}
>>
>> BR,
>> -R
>>
>> > -Emil
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>


More information about the mesa-dev mailing list