/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */1/******************************************************************************2*3* Name: acgcc.h - GCC specific defines, etc.4*5* Copyright (C) 2000 - 2025, Intel Corp.6*7*****************************************************************************/89#ifndef __ACGCC_H__10#define __ACGCC_H__1112#ifndef va_arg13#ifdef __KERNEL__14#include <linux/stdarg.h>15#else16#include <stdarg.h>17#endif /* __KERNEL__ */18#endif /* ! va_arg */1920#define ACPI_INLINE __inline__2122/* Function name is used for debug output. Non-ANSI, compiler-dependent */2324#define ACPI_GET_FUNCTION_NAME __func__2526/*27* This macro is used to tag functions as "printf-like" because28* some compilers (like GCC) can catch printf format string problems.29*/30#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))3132/*33* Some compilers complain about unused variables. Sometimes we don't want to34* use all the variables (for example, _acpi_module_name). This allows us35* to tell the compiler warning in a per-variable manner that a variable36* is unused.37*/38#define ACPI_UNUSED_VAR __attribute__ ((unused))3940/* GCC supports __VA_ARGS__ in macros */4142#define COMPILER_VA_MACRO 14344/* GCC supports native multiply/shift on 32-bit platforms */4546#define ACPI_USE_NATIVE_MATH644748/* GCC did not support __has_attribute until 5.1. */4950#ifndef __has_attribute51#define __has_attribute(x) 052#endif5354/*55* Explicitly mark intentional explicit fallthrough to silence56* -Wimplicit-fallthrough in GCC 7.1+.57*/5859#if __has_attribute(__fallthrough__)60#define ACPI_FALLTHROUGH __attribute__((__fallthrough__))61#endif6263/*64* Flexible array members are not allowed to be part of a union under65* C99, but this is not for any technical reason. Work around the66* limitation.67*/68#define ACPI_FLEX_ARRAY(TYPE, NAME) \69struct { \70struct { } __Empty_ ## NAME; \71TYPE NAME[]; \72}7374/*75* Explicitly mark strings that lack a terminating NUL character so76* that ACPICA can be built with -Wunterminated-string-initialization.77*/78#if __has_attribute(__nonstring__)79#define ACPI_NONSTRING __attribute__((__nonstring__))80#endif8182#endif /* __ACGCC_H__ */838485