Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2011 10:23:13 +0100
From:      Tijl Coosemans <tijl@coosemans.org>
To:        Ed Schouten <ed@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r228562 - head/sys/sys
Message-ID:  <201112161023.20013.tijl@coosemans.org>
In-Reply-To: <201112160822.pBG8MODA092847@svn.freebsd.org>
References:  <201112160822.pBG8MODA092847@svn.freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Friday 16 December 2011 09:22:24 Ed Schouten wrote:
> Author: ed
> Date: Fri Dec 16 08:22:23 2011
> New Revision: 228562
> URL: http://svn.freebsd.org/changeset/base/228562
> 
> Log:
>   Process a lot of feedback from bde@ on <sys/cdefs.h>:
>   
>   - Add __alignof() for non-GCC and GCC < 2.95.
>   - Simply implement the C1X keywords on top of the existing __macros.
>   - Add struct __hack to _Static_assert to require consumers to add a
>     semicolon.
>   - Add an extra underscore to __assert_ to allow it to be combined with
>     locally defined versions of CTASSERT in the tree.
>   - Add proper casts to __offsetof() to make it work for cases where
>     sizeof(size_t) != sizeof(uintptr_t).
>   - Globally replace size_t and uintptr_t by __size_t and __uintptr_t.
>     This removes the dependency on <sys/types.h> / <stdint.h>. Practically
>     any header file ends up including <machines/_types.h> somehow.
>   - Change argument names of macros to match with the rest of the file.
>   
>   MFC after:	3 months
> 
> Modified:
>   head/sys/sys/cdefs.h
> 
> Modified: head/sys/sys/cdefs.h
> ==============================================================================
> --- head/sys/sys/cdefs.h	Fri Dec 16 02:09:51 2011	(r228561)
> +++ head/sys/sys/cdefs.h	Fri Dec 16 08:22:23 2011	(r228562)
> @@ -363,10 +360,11 @@
>  #define __offsetof(type, field)	 __builtin_offsetof(type, field)
>  #else
>  #ifndef __cplusplus
> -#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
> +#define	__offsetof(type, field) \
> +	((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->member))

s/member/field/

>  #else
>  #define __offsetof(type, field)					\
> -  (__offsetof__ (reinterpret_cast <size_t>			\
> +  (__offsetof__ (reinterpret_cast <__size_t>			\
>                   (&reinterpret_cast <const volatile char &>	\
>                    (static_cast<type *> (0)->field))))
>  #endif

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iF4EABEIAAYFAk7rDgcACgkQfoCS2CCgtisaiwD6AkKrIEWAoDWVgFfob6VS4Zvy
sKJTTmW0dzg5Uyawl28A/jaY6lmEIv97hz3dQPMRiZfztppaS+DOQbAThQUOEpRB
=bNE0
-----END PGP SIGNATURE-----
help

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