[PATCH] configure.ac: disable annoying warning -Wmissing-field-initializers

Marek Olšák maraeo at gmail.com
Thu Jan 21 08:58:19 PST 2016


On Thu, Jan 21, 2016 at 2:09 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 21 January 2016 at 12:08, Marek Olšák <maraeo at gmail.com> wrote:
>> On Thu, Jan 21, 2016 at 11:51 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>> On 18 January 2016 at 22:53, Marek Olšák <maraeo at gmail.com> wrote:
>>>> Try explaining that to people who have a compulsion to fix them or
>>>> argue about them. :) Ignore? REALLY? IGNORE???
>>>>
>>> Now that we have a few people off your back can you please point out
>>> where this triggers warnings ?
>>
>> This particular warning is trigged by {}
> As mentioned previously neither {} nor {0} trigger any warning here.
> Jani hinted that you might be using an old (buggy?) compiler which
> generates them.
> Which version of GCC are you using ? Do you mind showing the first few
> warnings ?
>
>> or any { ... } which doesn't
>> initialize all members.
>>
> Do we have any outside of intel_decode.c ? I'm failing to spot any.

amdgpu_bo.c has 7 occurences of "= {}" and they all print the warning.
There are more in libdrm. I have gcc 4.9.2. If I revert this patch, I
get this nice log:


xf86drmMode.c: In function ‘drmHandleEvent’:
xf86drmMode.c:891:15: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
   e = (struct drm_event *) &buffer[i];
               ^
abi16.c: In function ‘abi16_chan_nvc0’:
abi16.c:66:9: warning: missing initializer for field
‘fb_ctxdma_handle’ of ‘struct drm_nouveau_channel_alloc’
[-Wmissing-field-initializers]
  struct drm_nouveau_channel_alloc req = {};
         ^
In file included from private.h:8:0,
                 from abi16.c:34:
../include/drm/nouveau_drm.h:31:11: note: ‘fb_ctxdma_handle’ declared here
  uint32_t     fb_ctxdma_handle;
           ^
abi16.c: In function ‘abi16_chan_nve0’:
abi16.c:87:9: warning: missing initializer for field
‘fb_ctxdma_handle’ of ‘struct drm_nouveau_channel_alloc’
[-Wmissing-field-initializers]
  struct drm_nouveau_channel_alloc req = {};
         ^
In file included from private.h:8:0,
                 from abi16.c:34:
../include/drm/nouveau_drm.h:31:11: note: ‘fb_ctxdma_handle’ declared here
  uint32_t     fb_ctxdma_handle;
           ^
abi16.c: In function ‘abi16_bo_init’:
abi16.c:316:9: warning: missing initializer for field ‘info’ of
‘struct drm_nouveau_gem_new’ [-Wmissing-field-initializers]
  struct drm_nouveau_gem_new req = {};
         ^
In file included from private.h:8:0,
                 from abi16.c:34:
../include/drm/nouveau_drm.h:118:30: note: ‘info’ declared here
  struct drm_nouveau_gem_info info;
                              ^
nouveau.c: In function ‘nouveau_object_fini’:
nouveau.c:222:2: warning: missing initializer for field ‘pad02’ of
‘struct nvif_ioctl_v0’ [-Wmissing-field-initializers]
  };
  ^
In file included from nouveau.c:50:0:
nvif/ioctl.h:22:7: note: ‘pad02’ declared here
  __u8  pad02[4];
       ^
nouveau.c: In function ‘nouveau_device_new’:
nouveau.c:371:9: warning: missing initializer for field ‘version’ of
‘struct nv_device_info_v0’ [-Wmissing-field-initializers]
  struct nv_device_info_v0 info = {};
         ^
In file included from nouveau.c:49:0:
nvif/cl0080.h:14:7: note: ‘version’ declared here
  __u8  version;
       ^
pushbuf.c: In function ‘nouveau_pushbuf_new’:
pushbuf.c:544:9: warning: missing initializer for field ‘channel’ of
‘struct drm_nouveau_gem_pushbuf’ [-Wmissing-field-initializers]
  struct drm_nouveau_gem_pushbuf req = {};
         ^
In file included from pushbuf.c:40:0:
../include/drm/nouveau_drm.h:162:11: note: ‘channel’ declared here
  uint32_t channel;
           ^
radeon_bo_gem.c: In function ‘bo_get_tiling’:
radeon_bo_gem.c:255:12: warning: missing initializer for field
‘handle’ of ‘struct drm_radeon_gem_set_tiling’
[-Wmissing-field-initializers]
     struct drm_radeon_gem_set_tiling args = {};
            ^
In file included from radeon_bo_gem.c:44:0:
../include/drm/radeon_drm.h:829:11: note: ‘handle’ declared here
  uint32_t handle;
           ^
radeon_cs_gem.c: In function ‘radeon_get_device_id’:
radeon_cs_gem.c:531:12: warning: missing initializer for field
‘request’ of ‘struct drm_radeon_info’ [-Wmissing-field-initializers]
     struct drm_radeon_info info = {};
            ^
In file included from radeon_cs.h:38:0,
                 from radeon_cs_gem.c:41:
../include/drm/radeon_drm.h:1014:11: note: ‘request’ declared here
  uint32_t  request;
           ^
radeon_surface.c: In function ‘radeon_get_value’:
radeon_surface.c:121:12: warning: missing initializer for field
‘request’ of ‘struct drm_radeon_info’ [-Wmissing-field-initializers]
     struct drm_radeon_info info = {};
            ^
In file included from radeon_surface.c:42:0:
../include/drm/radeon_drm.h:1014:11: note: ‘request’ declared here
  uint32_t  request;
           ^
amdgpu_bo.c: In function ‘amdgpu_close_kms_handle’:
amdgpu_bo.c:50:9: warning: missing initializer for field ‘handle’ of
‘struct drm_gem_close’ [-Wmissing-field-initializers]
  struct drm_gem_close args = {};
         ^
In file included from ../xf86drm.h:40:0,
                 from amdgpu_bo.c:41:
../include/drm/drm.h:590:8: note: ‘handle’ declared here
  __u32 handle;
        ^
amdgpu_bo.c: In function ‘amdgpu_bo_set_metadata’:
amdgpu_bo.c:127:9: warning: missing initializer for field ‘handle’ of
‘struct drm_amdgpu_gem_metadata’ [-Wmissing-field-initializers]
  struct drm_amdgpu_gem_metadata args = {};
         ^
In file included from amdgpu_bo.c:42:0:
../include/drm/amdgpu_drm.h:231:11: note: ‘handle’ declared here
  uint32_t handle;
           ^
amdgpu_bo.c: In function ‘amdgpu_bo_query_info’:
amdgpu_bo.c:150:9: warning: missing initializer for field ‘handle’ of
‘struct drm_amdgpu_gem_metadata’ [-Wmissing-field-initializers]
  struct drm_amdgpu_gem_metadata metadata = {};
         ^
In file included from amdgpu_bo.c:42:0:
../include/drm/amdgpu_drm.h:231:11: note: ‘handle’ declared here
  uint32_t handle;
           ^
amdgpu_bo.c:151:9: warning: missing initializer for field ‘bo_size’ of
‘struct drm_amdgpu_gem_create_in’ [-Wmissing-field-initializers]
  struct drm_amdgpu_gem_create_in bo_info = {};
         ^
In file included from amdgpu_bo.c:42:0:
../include/drm/amdgpu_drm.h:81:11: note: ‘bo_size’ declared here
  uint64_t bo_size;
           ^
amdgpu_bo.c:152:9: warning: missing initializer for field ‘handle’ of
‘struct drm_amdgpu_gem_op’ [-Wmissing-field-initializers]
  struct drm_amdgpu_gem_op gem_op = {};
         ^
In file included from amdgpu_bo.c:42:0:
../include/drm/amdgpu_drm.h:334:11: note: ‘handle’ declared here
  uint32_t handle;
           ^
amdgpu_bo.c: In function ‘amdgpu_bo_export_flink’:
amdgpu_bo.c:240:10: warning: missing initializer for field ‘handle’ of
‘struct drm_gem_close’ [-Wmissing-field-initializers]
   struct drm_gem_close args = {};
          ^
In file included from ../xf86drm.h:40:0,
                 from amdgpu_bo.c:41:
../include/drm/drm.h:590:8: note: ‘handle’ declared here
  __u32 handle;
        ^
amdgpu_bo.c: In function ‘amdgpu_bo_import’:
amdgpu_bo.c:287:9: warning: missing initializer for field ‘name’ of
‘struct drm_gem_open’ [-Wmissing-field-initializers]
  struct drm_gem_open open_arg = {};
         ^
In file included from ../xf86drm.h:40:0,
                 from amdgpu_bo.c:41:
../include/drm/drm.h:606:8: note: ‘name’ declared here
  __u32 name;
        ^
amdgpu_gpu_info.c: In function ‘amdgpu_query_heap_info’:
amdgpu_gpu_info.c:240:9: warning: missing initializer for field
‘vram_size’ of ‘struct drm_amdgpu_info_vram_gtt’
[-Wmissing-field-initializers]
  struct drm_amdgpu_info_vram_gtt vram_gtt_info = {};
         ^
In file included from amdgpu_gpu_info.c:33:0:
../include/drm/amdgpu_drm.h:586:11: note: ‘vram_size’ declared here
  uint64_t vram_size;
           ^
amdgpu_gpu_info.c: In function ‘amdgpu_query_gds_info’:
amdgpu_gpu_info.c:290:9: warning: missing initializer for field
‘gds_gfx_partition_size’ of ‘struct drm_amdgpu_info_gds’
[-Wmissing-field-initializers]
  struct drm_amdgpu_info_gds gds_config = {};
         ^
In file included from amdgpu_gpu_info.c:33:0:
../include/drm/amdgpu_drm.h:569:11: note: ‘gds_gfx_partition_size’ declared here
  uint32_t gds_gfx_partition_size;
           ^
amdgpu_device.c: In function ‘amdgpu_get_auth’:
amdgpu_device.c:118:2: warning: missing initializer for field ‘idx’ of
‘drm_client_t’ [-Wmissing-field-initializers]
  drm_client_t client = {};
  ^
In file included from ../xf86drm.h:40:0,
                 from amdgpu_device.c:42:
../include/drm/drm.h:227:6: note: ‘idx’ declared here
  int idx;  /**< Which client desired? */
      ^
kms-universal-planes.c: In function ‘main’:
kms-universal-planes.c:212:22: warning: declaration of ‘plane’ shadows
a previous local [-Wshadow]
    struct kms_plane *plane = device->planes[i];
                      ^
kms-universal-planes.c:137:20: warning: shadowed declaration is here [-Wshadow]
  struct kms_plane *plane;
                    ^
modetest.c: In function ‘get_resources’:
modetest.c:559:3: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]
   asprintf(&connector->name, "%s-%u",
   ^
basic_tests.c: In function ‘amdgpu_userptr_test’:
basic_tests.c:1028:2: warning: ignoring return value of
‘posix_memalign’, declared with attribute warn_unused_result
[-Wunused-result]
  posix_memalign(&ptr, sysconf(_SC_PAGE_SIZE), BUFFER_SIZE);
  ^

Marek


More information about the dri-devel mailing list