cc_clang.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2023 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJ_COMPAT_CC_CLANG_H__
  19. #define __PJ_COMPAT_CC_CLANG_H__
  20. /**
  21. * @file cc_clang.h
  22. * @brief Describes CLANG compiler specifics.
  23. */
  24. #ifndef __clang__
  25. # error "This file is only for clang!"
  26. #endif
  27. #define PJ_CC_NAME "clang"
  28. #define PJ_CC_VER_1 __clang_major__
  29. #define PJ_CC_VER_2 __clang_minor__
  30. #define PJ_CC_VER_3 __clang_patchlevel__
  31. #define PJ_THREAD_FUNC
  32. #define PJ_NORETURN
  33. #define PJ_HAS_INT64 1
  34. #ifdef __STRICT_ANSI__
  35. #include <inttypes.h>
  36. typedef int64_t pj_int64_t;
  37. typedef uint64_t pj_uint64_t;
  38. #define PJ_INLINE_SPECIFIER static __inline
  39. #define PJ_ATTR_NORETURN
  40. #define PJ_ATTR_MAY_ALIAS
  41. #else
  42. typedef long long pj_int64_t;
  43. typedef unsigned long long pj_uint64_t;
  44. #define PJ_INLINE_SPECIFIER static inline
  45. #define PJ_ATTR_NORETURN __attribute__ ((noreturn))
  46. #define PJ_ATTR_MAY_ALIAS __attribute__((__may_alias__))
  47. #endif
  48. #define PJ_INT64(val) val##LL
  49. #define PJ_UINT64(val) val##ULL
  50. #define PJ_INT64_FMT "L"
  51. #define PJ_UNREACHED(x)
  52. #define PJ_ALIGN_DATA(declaration, alignment) declaration __attribute__((aligned(alignment)))
  53. #endif /* __PJ_COMPAT_CC_CLANG_H__ */