Changeset 3717
- Timestamp:
- Mar 17, 2011, 7:09:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/sys/cdefs.h
r3715 r3717 1 /* 1 /* $Id: $ */ 2 /** @file 3 * FreeBSD 9.0 4 * 5 * @changed bird: Toolkit compatibility (_CDEFS_H_ and __TCPROTO()). 6 * @changed bird: Check if stuff is defined before accessing it in #if. Stops -Wundef 7 * from bitching. 8 */ 9 10 /*- 2 11 * Copyright (c) 1991, 1993 3 12 * The Regents of the University of California. All rights reserved. … … 31 40 * 32 41 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 33 * $FreeBSD: src/sys/sys/cdefs.h,v 1.84 2004/08/13 00:53:40 julian Exp $ 34 */ 35 36 /** @file 37 * FreeBSD 5.2 38 * 39 * @changed bird: Toolkit compatibility (_CDEFS_H_ and __TCPROTO()). 40 * @changed zap: _System definition for older GCC compilers. 41 * @changed bird: Check if stuff is defined before accessing it in #if. Stops -Wundef 42 * from bitching. 43 * @changed bird: added __GNUCLIKE_XXX from FreeBSD 8.0 (releng/8.0/sys/sys/cdefs.h 193734) 44 */ 45 42 * $FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $ 43 */ 46 44 47 45 #ifndef _SYS_CDEFS_H_ … … 74 72 #define __GNUCLIKE___OFFSETOF 1 75 73 #define __GNUCLIKE___SECTION 1 76 77 #define __GNUCLIKE_ATTRIBUTE_MODE_DI 178 74 79 75 #ifndef __INTEL_COMPILER … … 153 149 #define __inline inline /* convert to C++ keyword */ 154 150 #else 155 #if !(defined(__ GNUC__) || defined(__INTEL_COMPILER))151 #if !(defined(__CC_SUPPORTS___INLINE)) 156 152 #define __inline /* delete GCC keyword */ 157 #endif /* ! (__GNUC__ || __INTEL_COMPILER)*/153 #endif /* ! __CC_SUPPORTS___INLINE */ 158 154 #endif /* !__cplusplus */ 159 155 … … 163 159 #define __STRING(x) "x" 164 160 165 #if ! (defined(__GNUC__) || defined(__INTEL_COMPILER))161 #if !defined(__CC_SUPPORTS___INLINE) 166 162 #define __const /* delete pseudo-ANSI C keywords */ 167 163 #define __inline … … 182 178 #define volatile 183 179 #endif /* !NO_ANSI_KEYWORDS */ 184 #endif /* ! (__GNUC__ || __INTEL_COMPILER)*/180 #endif /* !__CC_SUPPORTS___INLINE */ 185 181 #endif /* !(__STDC__ || __cplusplus) */ 186 182 … … 234 230 235 231 #if __GNUC_PREREQ__(2, 96) 232 #define __malloc_like __attribute__((__malloc__)) 236 233 #define __pure __attribute__((__pure__)) 237 234 #else 235 #define __malloc_like 238 236 #define __pure 239 237 #endif … … 243 241 #else 244 242 #define __always_inline 243 #endif 244 245 #if __GNUC_PREREQ__(3, 1) 246 #define __noinline __attribute__ ((__noinline__)) 247 #else 248 #define __noinline 245 249 #endif 246 250 … … 267 271 */ 268 272 #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) 269 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 273 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) 270 274 #define __restrict 271 275 #else … … 310 314 #endif 311 315 316 #if __GNUC_PREREQ__(4, 2) 317 #define __hidden __attribute__((__visibility__("hidden"))) 318 #define __exported __attribute__((__visibility__("default"))) 319 #else 320 #define __hidden 321 #define __exported 322 #endif 323 312 324 /* 313 325 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> 314 326 * require it. 315 327 */ 328 #if __GNUC_PREREQ__(4, 1) 329 #define __offsetof(type, field) __builtin_offsetof(type, field) 330 #else 331 #ifndef __cplusplus 316 332 #define __offsetof(type, field) ((size_t)(&((type *)0)->field)) 333 #else 334 #define __offsetof(type, field) \ 335 (__offsetof__ (reinterpret_cast <size_t> \ 336 (&reinterpret_cast <const volatile char &> \ 337 (static_cast<type *> (0)->field)))) 338 #endif 339 #endif 317 340 #define __rangeof(type, start, end) \ 318 341 (__offsetof(type, end) - __offsetof(type, start)) … … 327 350 #define __printflike(fmtarg, firstvararg) 328 351 #define __scanflike(fmtarg, firstvararg) 352 #define __format_arg(fmtarg) 329 353 #else 330 354 #define __printflike(fmtarg, firstvararg) \ … … 332 356 #define __scanflike(fmtarg, firstvararg) \ 333 357 __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) 358 #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) 334 359 #endif 335 360 336 361 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ 337 #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER) /* bird: check if defined to avoid -Wundef messages */ 362 #ifdef __FreeBSD_cc_version /* bird */ 363 #if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER) 338 364 #define __printf0like(fmtarg, firstvararg) \ 339 365 __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) … … 341 367 #define __printf0like(fmtarg, firstvararg) 342 368 #endif 343 344 #if 0 /* defined(__GNUC__) || defined(__INTEL_COMPILER) - bird: ELF specific, so skip everything */ 369 #else /* bird */ 370 #define __printf0like(fmtarg, firstvararg) /* bird */ 371 #endif /* bird */ 372 373 #if 0 /* bird - mostly ELF specific, so skip it. */ 374 #if defined(__GNUC__) || defined(__INTEL_COMPILER) 345 375 #ifndef __INTEL_COMPILER 346 376 #define __strong_reference(sym,aliassym) \ 347 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) ;377 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) 348 378 #endif 349 379 #ifdef __STDC__ … … 355 385 __asm__(".asciz \"" msg "\""); \ 356 386 __asm__(".previous") 387 #define __sym_compat(sym,impl,verid) \ 388 __asm__(".symver " #impl ", " #sym "@" #verid) 389 #define __sym_default(sym,impl,verid) \ 390 __asm__(".symver " #impl ", " #sym "@@" #verid) 357 391 #else 358 392 #define __weak_reference(sym,alias) \ … … 363 397 __asm__(".asciz \"msg\""); \ 364 398 __asm__(".previous") 399 #define __sym_compat(sym,impl,verid) \ 400 __asm__(".symver impl, sym@verid") 401 #define __sym_default(impl,sym,verid) \ 402 __asm__(".symver impl, sym@@verid") 365 403 #endif /* __STDC__ */ 366 #else 404 #endif /* __GNUC__ || __INTEL_COMPILER */ 405 #else /* bird */ 367 406 #define __strong_reference(sym,aliassym) \ 368 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); 369 #endif /* __GNUC__ || __INTEL_COMPILER */ 370 371 #if 0 /* defined(__GNUC__) || defined(__INTEL_COMPILER) - ELF specific. */ 407 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); /* bird */ 408 #endif /* bird */ 409 410 #define __GLOBL1(sym) __asm__(".globl " #sym) 411 #define __GLOBL(sym) __GLOBL1(sym) 412 413 #if 0 /* defined(__GNUC__) || defined(__INTEL_COMPILER) - bird: ELF specific. */ 372 414 #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") 373 415 #else … … 385 427 * more recent ELF binutils, we use .ident allowing the ID to be stripped. 386 428 * Usage: 387 * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1. 84 2004/08/13 00:53:40 julian Exp $");429 * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $"); 388 430 */ 389 431 #ifndef __FBSDID … … 453 495 * and the omnibus ISO/IEC 9945-1: 1996 454 496 * _POSIX_C_SOURCE == 200112 1003.1-2001 497 * _POSIX_C_SOURCE == 200809 1003.1-2008 455 498 * 456 499 * In addition, the X/Open Portability Guide, which is now the Single UNIX … … 475 518 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ 476 519 #ifdef _XOPEN_SOURCE 477 #if _XOPEN_SOURCE - 0 >= 600 520 #if _XOPEN_SOURCE - 0 >= 700 521 #define __XSI_VISIBLE 700 522 #undef _POSIX_C_SOURCE 523 #define _POSIX_C_SOURCE 200809 524 #elif _XOPEN_SOURCE - 0 >= 600 478 525 #define __XSI_VISIBLE 600 479 526 #undef _POSIX_C_SOURCE … … 494 541 #endif 495 542 #ifdef _POSIX_C_SOURCE 496 #if _POSIX_C_SOURCE >= 200112 543 #if _POSIX_C_SOURCE >= 200809 544 #define __POSIX_VISIBLE 200809 545 #define __ISO_C_VISIBLE 1999 546 #elif _POSIX_C_SOURCE >= 200112 497 547 #define __POSIX_VISIBLE 200112 498 548 #define __ISO_C_VISIBLE 1999 … … 537 587 #define __ISO_C_VISIBLE 1999 538 588 #else /* Default environment: show everything. */ 539 #define __POSIX_VISIBLE 200 112540 #define __XSI_VISIBLE 600589 #define __POSIX_VISIBLE 200809 590 #define __XSI_VISIBLE 700 541 591 #define __BSD_VISIBLE 1 542 592 #define __ISO_C_VISIBLE 1999 … … 556 606 */ 557 607 #if !defined(__USE_LIBC_TCPIP) && !defined(TCPV40HDRS) && !defined(TCPV41HDRS) 558 # define __USE_LIBC_TCPIP608 # define __USE_LIBC_TCPIP 559 609 #endif 560 610 #if defined(TCPV40HDRS) && defined(TCPV41HDRS) 561 # error Cannot define both TCPV40HDRS and TCPV41HDRS. Make up your mind!611 # error Cannot define both TCPV40HDRS and TCPV41HDRS. Make up your mind! 562 612 #endif 563 613 … … 572 622 #endif 573 623 574 /* zap: For backward compatibility with GCC/EMX */575 #ifndef _System576 #define _System577 #endif578 579 624 /* bird: include the GNU sys/cdefs.h (which fortunately have another 580 625 blocker, _SYS_CDEFS_H). */
Note:
See TracChangeset
for help on using the changeset viewer.