acgcc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: acgcc.h - GCC specific defines, etc.
  5. *
  6. * Copyright (C) 2000 - 2022, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACGCC_H__
  10. #define __ACGCC_H__
  11. #ifndef va_arg
  12. #ifdef __KERNEL__
  13. #include <linux/stdarg.h>
  14. #else
  15. #include <stdarg.h>
  16. #endif /* __KERNEL__ */
  17. #endif /* ! va_arg */
  18. #define ACPI_INLINE __inline__
  19. /* Function name is used for debug output. Non-ANSI, compiler-dependent */
  20. #define ACPI_GET_FUNCTION_NAME __func__
  21. /*
  22. * This macro is used to tag functions as "printf-like" because
  23. * some compilers (like GCC) can catch printf format string problems.
  24. */
  25. #define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
  26. /*
  27. * Some compilers complain about unused variables. Sometimes we don't want to
  28. * use all the variables (for example, _acpi_module_name). This allows us
  29. * to tell the compiler warning in a per-variable manner that a variable
  30. * is unused.
  31. */
  32. #define ACPI_UNUSED_VAR __attribute__ ((unused))
  33. /* GCC supports __VA_ARGS__ in macros */
  34. #define COMPILER_VA_MACRO 1
  35. /* GCC supports native multiply/shift on 32-bit platforms */
  36. #define ACPI_USE_NATIVE_MATH64
  37. /* GCC did not support __has_attribute until 5.1. */
  38. #ifndef __has_attribute
  39. #define __has_attribute(x) 0
  40. #endif
  41. /*
  42. * Explicitly mark intentional explicit fallthrough to silence
  43. * -Wimplicit-fallthrough in GCC 7.1+.
  44. */
  45. #if __has_attribute(__fallthrough__)
  46. #define ACPI_FALLTHROUGH __attribute__((__fallthrough__))
  47. #endif
  48. #endif /* __ACGCC_H__ */