Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

83 lines
2.6KB

  1. /* Provide support for both ANSI and non-ANSI environments. */
  2. /* To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
  3. "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
  4. files aren't affected). */
  5. #ifndef _ANSIDECL_H_
  6. #define _ANSIDECL_H_
  7. #include <newlib.h>
  8. #include <sys/config.h>
  9. /* ISO C++. */
  10. #ifdef __cplusplus
  11. #if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
  12. #ifdef _HAVE_STD_CXX
  13. #define _BEGIN_STD_C namespace std { extern "C" {
  14. #define _END_STD_C } }
  15. #else
  16. #define _BEGIN_STD_C extern "C" {
  17. #define _END_STD_C }
  18. #endif
  19. #if __GNUC_PREREQ (3, 3)
  20. #define _NOTHROW __attribute__ ((__nothrow__))
  21. #else
  22. #define _NOTHROW throw()
  23. #endif
  24. #endif
  25. #else
  26. #define _BEGIN_STD_C
  27. #define _END_STD_C
  28. #define _NOTHROW
  29. #endif
  30. #ifndef _LONG_DOUBLE
  31. #define _LONG_DOUBLE long double
  32. #endif
  33. /* Support gcc's __attribute__ facility. */
  34. #ifdef __GNUC__
  35. #define _ATTRIBUTE(attrs) __attribute__ (attrs)
  36. #else
  37. #define _ATTRIBUTE(attrs)
  38. #endif
  39. /* The traditional meaning of 'extern inline' for GCC is not
  40. to emit the function body unless the address is explicitly
  41. taken. However this behaviour is changing to match the C99
  42. standard, which uses 'extern inline' to indicate that the
  43. function body *must* be emitted. Likewise, a function declared
  44. without either 'extern' or 'static' defaults to extern linkage
  45. (C99 6.2.2p5), and the compiler may choose whether to use the
  46. inline version or call the extern linkage version (6.7.4p6).
  47. If we are using GCC, but do not have the new behaviour, we need
  48. to use extern inline; if we are using a new GCC with the
  49. C99-compatible behaviour, or a non-GCC compiler (which we will
  50. have to hope is C99, since there is no other way to achieve the
  51. effect of omitting the function if it isn't referenced) we use
  52. 'static inline', which c99 defines to mean more-or-less the same
  53. as the Gnu C 'extern inline'. */
  54. #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__)
  55. /* We're using GCC, but without the new C99-compatible behaviour. */
  56. #define _ELIDABLE_INLINE extern __inline__ _ATTRIBUTE ((__always_inline__))
  57. #else
  58. /* We're using GCC in C99 mode, or an unknown compiler which
  59. we just have to hope obeys the C99 semantics of inline. */
  60. #define _ELIDABLE_INLINE static __inline__
  61. #endif
  62. #if __GNUC_PREREQ (3, 1)
  63. #define _NOINLINE __attribute__ ((__noinline__))
  64. #define _NOINLINE_STATIC _NOINLINE static
  65. #else
  66. /* On non-GNU compilers and GCC prior to version 3.1 the compiler can't be
  67. trusted not to inline if it is static. */
  68. #define _NOINLINE
  69. #define _NOINLINE_STATIC
  70. #endif
  71. #endif /* _ANSIDECL_H_ */