| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: cdefs.h,v 1.79 2010/07/31 00:04:43 joerg Exp $ */ | | 1 | /* $NetBSD: cdefs.h,v 1.80 2010/08/07 21:03:18 joerg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1991, 1993 | | 4 | * Copyright (c) 1991, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Berkeley Software Design, Inc. | | 8 | * Berkeley Software Design, Inc. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -53,36 +53,26 @@ | | | @@ -53,36 +53,26 @@ |
53 | ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ | | 53 | ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ |
54 | (__GNUC__ > (x))) | | 54 | (__GNUC__ > (x))) |
55 | #else | | 55 | #else |
56 | #define __GNUC_PREREQ__(x, y) 0 | | 56 | #define __GNUC_PREREQ__(x, y) 0 |
57 | #endif | | 57 | #endif |
58 | | | 58 | |
59 | #include <machine/cdefs.h> | | 59 | #include <machine/cdefs.h> |
60 | #ifdef __ELF__ | | 60 | #ifdef __ELF__ |
61 | #include <sys/cdefs_elf.h> | | 61 | #include <sys/cdefs_elf.h> |
62 | #else | | 62 | #else |
63 | #include <sys/cdefs_aout.h> | | 63 | #include <sys/cdefs_aout.h> |
64 | #endif | | 64 | #endif |
65 | | | 65 | |
66 | #if defined(__cplusplus) | | | |
67 | #define __BEGIN_DECLS extern "C" { | | | |
68 | #define __END_DECLS } | | | |
69 | #define __static_cast(x,y) static_cast<x>(y) | | | |
70 | #else | | | |
71 | #define __BEGIN_DECLS | | | |
72 | #define __END_DECLS | | | |
73 | #define __static_cast(x,y) (x)y | | | |
74 | #endif | | | |
75 | | | | |
76 | /* | | 66 | /* |
77 | * The __CONCAT macro is used to concatenate parts of symbol names, e.g. | | 67 | * The __CONCAT macro is used to concatenate parts of symbol names, e.g. |
78 | * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. | | 68 | * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. |
79 | * The __CONCAT macro is a bit tricky -- make sure you don't put spaces | | 69 | * The __CONCAT macro is a bit tricky -- make sure you don't put spaces |
80 | * in between its arguments. __CONCAT can also concatenate double-quoted | | 70 | * in between its arguments. __CONCAT can also concatenate double-quoted |
81 | * strings produced by the __STRING macro, but this only works with ANSI C. | | 71 | * strings produced by the __STRING macro, but this only works with ANSI C. |
82 | */ | | 72 | */ |
83 | | | 73 | |
84 | #define ___STRING(x) __STRING(x) | | 74 | #define ___STRING(x) __STRING(x) |
85 | #define ___CONCAT(x,y) __CONCAT(x,y) | | 75 | #define ___CONCAT(x,y) __CONCAT(x,y) |
86 | | | 76 | |
87 | #if __STDC__ || defined(__cplusplus) | | 77 | #if __STDC__ || defined(__cplusplus) |
88 | #define __P(protos) protos /* full-blown ANSI C */ | | 78 | #define __P(protos) protos /* full-blown ANSI C */ |
| @@ -218,26 +208,53 @@ | | | @@ -218,26 +208,53 @@ |
218 | | | 208 | |
219 | #if __GNUC_PREREQ__(2, 7) | | 209 | #if __GNUC_PREREQ__(2, 7) |
220 | #define __unused __attribute__((__unused__)) | | 210 | #define __unused __attribute__((__unused__)) |
221 | #else | | 211 | #else |
222 | #define __unused /* delete */ | | 212 | #define __unused /* delete */ |
223 | #endif | | 213 | #endif |
224 | | | 214 | |
225 | #if __GNUC_PREREQ__(3, 1) | | 215 | #if __GNUC_PREREQ__(3, 1) |
226 | #define __used __attribute__((__used__)) | | 216 | #define __used __attribute__((__used__)) |
227 | #else | | 217 | #else |
228 | #define __used __unused | | 218 | #define __used __unused |
229 | #endif | | 219 | #endif |
230 | | | 220 | |
| | | 221 | #if __GNUC_PREREQ__(4, 0) |
| | | 222 | # define __dso_public __attribute__((__visibility__("default"))) |
| | | 223 | # define __dso_hidden __attribute__((__visibility__("hidden"))) |
| | | 224 | # define __BEGIN_PUBLIC _Pragma("GCC visibility push(default)") |
| | | 225 | # define __END_PUBLIC _Pragma("GCC visibility pop") |
| | | 226 | # define __BEGIN_HIDDEN _Pragma("GCC visibility push(hidden)") |
| | | 227 | # define __END_HIDDEN _Pragma("GCC visibility pop") |
| | | 228 | #else |
| | | 229 | # define __dso_public |
| | | 230 | # define __dso_hidden |
| | | 231 | # define __BEGIN_PUBLIC |
| | | 232 | # define __END_PUBLIC |
| | | 233 | # define __BEGIN_HIDDEN |
| | | 234 | # define __END_HIDDEN |
| | | 235 | #endif |
| | | 236 | |
| | | 237 | |
| | | 238 | #if defined(__cplusplus) |
| | | 239 | #define __BEGIN_DECLS __BEGIN_PUBLIC extern "C" { |
| | | 240 | #define __END_DECLS } __END_PUBLIC |
| | | 241 | #define __static_cast(x,y) static_cast<x>(y) |
| | | 242 | #else |
| | | 243 | #define __BEGIN_DECLS __BEGIN_PUBLIC |
| | | 244 | #define __END_DECLS __END_PUBLIC |
| | | 245 | #define __static_cast(x,y) (x)y |
| | | 246 | #endif |
| | | 247 | |
231 | /* | | 248 | /* |
232 | * Non-static C99 inline functions are optional bodies. They don't | | 249 | * Non-static C99 inline functions are optional bodies. They don't |
233 | * create global symbols if not used, but can be replaced if desirable. | | 250 | * create global symbols if not used, but can be replaced if desirable. |
234 | * This differs from the behavior of GCC before version 4.3. The nearest | | 251 | * This differs from the behavior of GCC before version 4.3. The nearest |
235 | * equivalent for older GCC is `extern inline'. For newer GCC, use the | | 252 | * equivalent for older GCC is `extern inline'. For newer GCC, use the |
236 | * gnu_inline attribute additionally to get the old behavior. | | 253 | * gnu_inline attribute additionally to get the old behavior. |
237 | * | | 254 | * |
238 | * For C99 compilers other than GCC, the C99 behavior is expected. | | 255 | * For C99 compilers other than GCC, the C99 behavior is expected. |
239 | */ | | 256 | */ |
240 | #if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) | | 257 | #if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) |
241 | #define __c99inline extern __attribute__((__gnu_inline__)) __inline | | 258 | #define __c99inline extern __attribute__((__gnu_inline__)) __inline |
242 | #elif defined(__GNUC__) | | 259 | #elif defined(__GNUC__) |
243 | #define __c99inline extern __inline | | 260 | #define __c99inline extern __inline |