compiler.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 1999 - 2005, Digium, Inc.
  5. *
  6. * Mark Spencer <markster@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*! \file
  19. * \brief Compiler-specific macros and other items
  20. */
  21. #ifndef _ASTERISK_COMPILER_H
  22. #define _ASTERISK_COMPILER_H
  23. #ifdef HAVE_ATTRIBUTE_always_inline
  24. #define force_inline __attribute__((always_inline)) inline
  25. #else
  26. #define force_inline inline
  27. #endif
  28. #ifdef HAVE_ATTRIBUTE_pure
  29. #define attribute_pure __attribute__((pure))
  30. #else
  31. #define attribute_pure
  32. #endif
  33. #ifdef HAVE_ATTRIBUTE_const
  34. #define attribute_const __attribute__((const))
  35. #else
  36. #define attribute_const
  37. #endif
  38. #ifdef HAVE_ATTRIBUTE_deprecated
  39. #define attribute_deprecated __attribute__((deprecated))
  40. #else
  41. #define attribute_deprecated
  42. #endif
  43. #ifdef HAVE_ATTRIBUTE_unused
  44. #define attribute_unused __attribute__((unused))
  45. #else
  46. #define attribute_unused
  47. #endif
  48. #ifdef HAVE_ATTRIBUTE_malloc
  49. #define attribute_malloc __attribute__((malloc))
  50. #else
  51. #define attribute_malloc
  52. #endif
  53. #ifdef HAVE_ATTRIBUTE_sentinel
  54. #define attribute_sentinel __attribute__((sentinel))
  55. #else
  56. #define attribute_sentinel
  57. #endif
  58. #ifdef HAVE_ATTRIBUTE_warn_unused_result
  59. #define attribute_warn_unused_result __attribute__((warn_unused_result))
  60. #else
  61. #define attribute_warn_unused_result
  62. #endif
  63. #ifdef HAVE_ATTRIBUTE_may_alias
  64. #define attribute_may_alias __attribute__((may_alias))
  65. #else
  66. #define attribute_may_alias
  67. #endif
  68. #ifdef HAVE_ATTRIBUTE_noreturn
  69. #define attribute_noreturn __attribute__((noreturn))
  70. #else
  71. #define attribute_noreturn
  72. #endif
  73. /* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
  74. #define SENTINEL ((char *)NULL)
  75. #endif /* _ASTERISK_COMPILER_H */