1 /*- |
1 /*- |
2 * © Portions copyright (c) 2005 Nokia Corporation. All rights reserved. |
2 * |
3 * Copyright (c) 1991, 1993 |
3 * Copyright (c) 1991, 1993 |
4 * The Regents of the University of California. All rights reserved. |
4 * The Regents of the University of California. All rights reserved. |
5 * |
5 * |
6 * This code is derived from software contributed to Berkeley by |
6 * This code is derived from software contributed to Berkeley by |
7 * Berkeley Software Design, Inc. |
7 * Berkeley Software Design, Inc. |
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
31 * SUCH DAMAGE. |
31 * SUCH DAMAGE. |
32 * © Portions copyright (c) 2007-2008 Symbian Software Ltd. All rights reserved. |
32 * © Portions Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
33 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 |
33 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 |
34 * $FreeBSD: src/sys/sys/cdefs.h,v 1.88.2.1 2005/10/09 07:48:48 netchild Exp $ |
34 * $FreeBSD: src/sys/sys/cdefs.h,v 1.88.2.1 2005/10/09 07:48:48 netchild Exp $ |
35 */ |
35 */ |
36 |
36 |
37 #ifndef _SYS_CDEFS_H_ |
37 #ifndef _SYS_CDEFS_H_ |
245 #else |
245 #else |
246 #define __nonnull(x) |
246 #define __nonnull(x) |
247 #endif |
247 #endif |
248 |
248 |
249 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ |
249 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ |
|
250 #if __STDC_VERSION__ < 199901 |
250 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) |
251 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) |
251 #define __func__ NULL |
252 #define __func__ "" |
|
253 #endif |
252 #endif |
254 #endif |
253 |
255 |
254 #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 |
256 #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 |
255 #ifdef __SYMBIAN32__ |
257 #ifdef __SYMBIAN32__ |
256 #ifndef __LONG_LONG_SUPPORTED |
258 #ifndef __LONG_LONG_SUPPORTED |
322 |
324 |
323 /* |
325 /* |
324 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> |
326 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> |
325 * require it. |
327 * require it. |
326 */ |
328 */ |
327 |
329 #if !defined(__cplusplus) |
328 #if !defined(__cplusplus) || defined(__SYMBIAN32__) |
|
329 #define __offsetof(type, field) ((size_t)(&((type *)0)->field)) |
330 #define __offsetof(type, field) ((size_t)(&((type *)0)->field)) |
330 #else |
331 #else |
|
332 #if defined(__GNUC__) |
|
333 #if(__GNUC__ > 3) |
331 #define __offsetof(type, field) \ |
334 #define __offsetof(type, field) \ |
332 (__offsetof__ (reinterpret_cast <size_t> \ |
335 (__builtin_offsetof (type,field)) |
333 (&reinterpret_cast <const volatile char &> \ |
336 #else |
334 (static_cast<type *> (0)->field)))) |
337 #define __offsetof(type, field) \ |
335 #endif |
338 (__offsetof__ (type,field)) |
|
339 #endif |
|
340 #else |
|
341 #define __offsetof(type, field) (reinterpret_cast <size_t> \ |
|
342 (&reinterpret_cast <const volatile char &> \ |
|
343 (static_cast<type *> (0)->field))) |
|
344 #endif |
|
345 #endif |
|
346 |
336 #define __rangeof(type, start, end) \ |
347 #define __rangeof(type, start, end) \ |
337 (__offsetof(type, end) - __offsetof(type, start)) |
348 (__offsetof(type, end) - __offsetof(type, start)) |
338 |
349 |
339 /* |
350 /* |
340 * Compiler-dependent macros to declare that functions take printf-like |
351 * Compiler-dependent macros to declare that functions take printf-like |