svn commit: r208738 - user/jmallett/octeon/sys/contrib/octeon-sdk

Bruce Evans brde at optusnet.com.au
Thu Jun 3 11:22:29 UTC 2010


> Log:
>  Spell typeof in the preferred way for the FreeBSD kernel.

Thanks, but that way is __typeof...

> Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h
> ==============================================================================
> --- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h	Wed Jun  2 11:06:03 2010	(r208737)
> +++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h	Wed Jun  2 11:08:56 2010	(r208738)
> @@ -225,12 +225,12 @@ extern "C" {
>       unsigned long _v;							\
>       ASM_STMT ("rdhwr\t%0,$31\n"					\
> 		"\tsll\t%0,%0,0" : "=d"(_v));				\
> -      result = (typeof(result))_v;					\
> +      result = (__typeof__(result))_v;					\
>     }									\

... typeof is not just an unpreferred spelling, but a syntax error (if
compiled by a C compiler or by gcc -pedantic), while __typeof__ is a
just an unpreferred (gnuish) spelling.

>   } else {								\
>     unsigned long _v;							\
>     ASM_STMT ("rdhwr\t%0,$" CVMX_TMP_STR(regstr) : "=d"(_v));		\
> -    result = (typeof(result))_v;					\
> +    result = (__typeof__(result))_v;					\
>   }})

More syntax errors.  Careful code uses __extension__.  Here the excessive
underscores must be used because the gnuish spelling for __extension__ is
not aliased to a good spelling.

27 lines in RELENG_9 use some form of typeof, and 10 of them actually
have the preferred spelling, with the unpreferred one mainly in newer
non-core code:

xfs: 6 lines with typeof, but 2 of these #define typeof as __typeof if
      typeof is not defined, which should be always
reiserfs: 2 lines with __typeof__
drm: 4 lines with __typeof
nxge: 1 line with __typeof
net: 1 line with __typeof
i386/include: 1 line with _typeof by me; 2 lines with __typeof__ (xen)
xen: 5 lines with typeof
amd64/include: 1 line with _typeof by me; 2 lines with __typeof__ (xen)
sys: 2 lines with __typeof

Bruce


More information about the svn-src-user mailing list