Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jun 2010 21:22:24 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Juli Mallett <jmallett@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   Re: svn commit: r208738 - user/jmallett/octeon/sys/contrib/octeon-sdk
Message-ID:  <20100603205323.P27876@delplex.bde.org>
In-Reply-To: <201006021108.o52B8udH036012@svn.freebsd.org>
References:  <201006021108.o52B8udH036012@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100603205323.P27876>