acgcc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACGCC_H__
  10. #define __ACGCC_H__
  11. /*
  12. * Use compiler specific <stdarg.h> is a good practice for even when
  13. * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
  14. */
  15. #ifndef va_arg
  16. #ifdef ACPI_USE_BUILTIN_STDARG
  17. typedef __builtin_va_list va_list;
  18. #define va_start(v, l) __builtin_va_start(v, l)
  19. #define va_end(v) __builtin_va_end(v)
  20. #define va_arg(v, l) __builtin_va_arg(v, l)
  21. #define va_copy(d, s) __builtin_va_copy(d, s)
  22. #else
  23. #include <stdarg.h>
  24. #endif
  25. #endif
  26. #define ACPI_INLINE __inline__
  27. /* Function name is used for debug output. Non-ANSI, compiler-dependent */
  28. #define ACPI_GET_FUNCTION_NAME __func__
  29. /*
  30. * This macro is used to tag functions as "printf-like" because
  31. * some compilers (like GCC) can catch printf format string problems.
  32. */
  33. #define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
  34. /*
  35. * Some compilers complain about unused variables. Sometimes we don't want to
  36. * use all the variables (for example, _acpi_module_name). This allows us
  37. * to tell the compiler warning in a per-variable manner that a variable
  38. * is unused.
  39. */
  40. #define ACPI_UNUSED_VAR __attribute__ ((unused))
  41. /* GCC supports __VA_ARGS__ in macros */
  42. #define COMPILER_VA_MACRO 1
  43. /* GCC supports native multiply/shift on 32-bit platforms */
  44. #define ACPI_USE_NATIVE_MATH64
  45. #endif /* __ACGCC_H__ */