cdefs.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. *
  3. * Redistribution and use in source and binary forms, with or without
  4. * modification, are permitted provided that the following conditions
  5. * are met:
  6. * 1. Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * 2. Redistributions in binary form must reproduce the above copyright
  9. * notice, this list of conditions and the following disclaimer in the
  10. * documentation and/or other materials provided with the distribution.
  11. * 3. All advertising materials mentioning features or use of this software
  12. * must display the following acknowledgement:
  13. * This product includes software developed by the University of
  14. * California, Berkeley and its contributors.
  15. * 4. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. *
  31. */
  32. #ifndef _SYS_CDEFS_H_
  33. #define _SYS_CDEFS_H_
  34. #if defined(__cplusplus)
  35. #define __BEGIN_DECLS extern "C" {
  36. #define __END_DECLS }
  37. #else
  38. #define __BEGIN_DECLS
  39. #define __END_DECLS
  40. #endif
  41. #ifndef NULL
  42. #define NULL 0
  43. #endif
  44. #if defined(__STDC__) || defined(__cplusplus)
  45. #define __P(protos) protos /* full-blown ANSI C */
  46. #define __CONCAT1(x,y) x ## y
  47. #define __CONCAT(x,y) __CONCAT1(x,y)
  48. #define __STRING(x) #x /* stringify without expanding x */
  49. #define __XSTRING(x) __STRING(x) /* expand x, then stringify */
  50. #define __const const /* define reserved names to standard */
  51. #define __signed signed
  52. #define __volatile volatile
  53. #if defined(__cplusplus)
  54. #define __inline inline /* convert to C++ keyword */
  55. #else
  56. #ifndef __GNUC__
  57. #define __inline /* delete GCC keyword */
  58. #endif /* !__GNUC__ */
  59. #endif /* !__cplusplus */
  60. #else /* !(__STDC__ || __cplusplus) */
  61. #define __P(protos) () /* traditional C preprocessor */
  62. #define __CONCAT(x,y) x/**/y
  63. #define __STRING(x) "x"
  64. #ifndef __GNUC__
  65. #define __const /* delete pseudo-ANSI C keywords */
  66. #define __inline
  67. #define __signed
  68. #define __volatile
  69. /*
  70. * In non-ANSI C environments, new programs will want ANSI-only C keywords
  71. * deleted from the program and old programs will want them left alone.
  72. * When using a compiler other than gcc, programs using the ANSI C keywords
  73. * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
  74. * When using "gcc -traditional", we assume that this is the intent; if
  75. * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
  76. */
  77. #ifndef NO_ANSI_KEYWORDS
  78. #define const /* delete ANSI C keywords */
  79. #define inline
  80. #define signed
  81. #define volatile
  82. #endif /* !NO_ANSI_KEYWORDS */
  83. #endif /* !__GNUC__ */
  84. #endif /* !(__STDC__ || __cplusplus) */
  85. #endif /* !_SYS_CDEFS_H_ */