On Thu, 23 Apr 2009, Denis Onischenko wrote: > The following errors appears when I tried to compile linux kernel > 2.6.30-rc2 with GCC 4.5: > > > linux-2.6/drivers/gpu/drm/drm_drv.c:59: error: nonconstant array index > in initializer > linux-2.6/drivers/gpu/drm/drm_drv.c:59: error: (near initialization > for 'drm_ioctls') > ... > > compiled code looks like this: > > static struct drm_ioctl_desc drm_ioctls[] = { > DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, 0), > DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), > ... > > where DRM_IOCTL_DEF defined as > > #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ > [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
And how is DRM_IOCTL_NR defined? To be used here it should be defined to expand to an integer constant expression. > If it is not a bug, is there a way to disable this conformance rules > checking with GCC 4.5 ? There is no general way. In particular cases the errors can be made into pedwarns or pedwarns-if-pedantic if there seems to be a good reason for a coding style not letting proper integer constant expressions be used in a particular case. -- Joseph S. Myers jos...@codesourcery.com