r247835: drm2 code breaks buildkernel

J.R. Oldroyd fbsd at opal.com
Tue Mar 5 14:54:31 UTC 2013


On Tue, 05 Mar 2013 15:13:12 +0100 Jean-Sébastien Pédron <dumbbell at FreeBSD.org> wrote:
>
> On 05.03.2013 13:30, Glen Barber wrote:
> > dev/drm2/ttm/ttm_lock.h:208: warning: redundant redeclaration of 'ttm_write_unlock' [-Wredundant-decls]
> > dev/drm2/ttm/ttm_lock.h:134: warning: previous declaration of 'ttm_write_unlock' was here
> > dev/drm2/ttm/ttm_lock.h:220: warning: redundant redeclaration of 'ttm_write_lock' [-Wredundant-decls]
> > dev/drm2/ttm/ttm_lock.h:146: warning: previous declaration of 'ttm_write_lock' was here
> 
> Those redundant declarations weren't spotted by clang.
> 
> Konstantin, would you like me to commit the fix for this? And we need to
> upstream it too.
> 
A fix for these is in my big "get it to compile" patch that I emailed
you both the other day.

> > dev/drm2/ttm/ttm_page_alloc.c:122: warning: declaration does not declare anything
> > dev/drm2/ttm/ttm_page_alloc.c:123: warning: declaration does not declare anything
> 
> These errors and the following are caused by unnamed structs and unions
> inside another struct:
> 
> struct ttm_pool_manager {
>         ...
> 
>         union {
>                 struct ttm_page_pool    pools[NUM_POOLS];
>                 struct {
>                         ...
>                 } ;
>         };
> };
> 
> With default options, clang accepts this but apparently, not gcc.
>
Experimentation shows that this warning is triggered because we use
-std=iso9899:1999.  It can be turned off again by adding --ms-extensions
too.

Alternatively, my big patch replaces all these anon unions with
named ones.  There are lots of these in this code, though.  Doing
this adds lots of patch bloat.

> I would like an opinion from the toolchain gurus, because I don't know
> what's the proper way to fix this one.
> 
> J.R. Oldroyd CC'd, because he started to work on radeonkms backport to 9
> and faced exactly those issues.
> 
There is a further problem not mentioned here.  Three of the files
make use of a pointer to a volatile int but later cast this to a
(void *).  Because we also have -Wcast-qual, this cast triggers
"cast discards qualifier on pointer target type" warnings and because
of -Werror, this then aborts.  What's the best way to fix that?

	-jr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20130305/31c96bc1/attachment.sig>


More information about the freebsd-current mailing list