Commit 5fb3ab84 authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

ACPICA: Clib: Cleanup va_arg related code

ACPICA commit 32701b33cdc48d9bc43da8c9274cf172135b68fc

We in fact always use the compiler specific stdarg.h for GCC even
when ACPI_USE_STANDARD_HEADERS is not defined. So that the va_arg usages
can always be correct for different compiler options.

Likewise, the va_arg implemented in acenv.h is actually MSVC specific,
this patch also moves it to acmsvc.h and tunes acwin.h to correctly use
it.

After cleaning up, this patch removes all <stdarg.h> inclusions from
other files, but doesn't touch the BSD headers. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/32701b33
Link: https://bugs.acpica.org/show_bug.cgi?id=1298Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent b597664f
...@@ -342,52 +342,12 @@ ...@@ -342,52 +342,12 @@
/* Use the standard headers from the standard locations */ /* Use the standard headers from the standard locations */
#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#endif /* ACPI_USE_STANDARD_HEADERS */ #endif /* ACPI_USE_STANDARD_HEADERS */
/* We will be linking to the standard Clib functions */
#else
/******************************************************************************
*
* Not using native C library, use local implementations
*
*****************************************************************************/
/*
* Use local definitions of C library macros and functions. These function
* implementations may not be as efficient as an inline or assembly code
* implementation provided by a native C library, but they are functionally
* equivalent.
*/
#ifndef va_arg
#ifndef _VALIST
#define _VALIST
typedef char *va_list;
#endif /* _VALIST */
/* Storage alignment properties */
#define _AUPBND (sizeof (acpi_native_int) - 1)
#define _ADNBND (sizeof (acpi_native_int) - 1)
/* Variable argument list macro definitions */
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
#define va_end(ap) (ap = (va_list) NULL)
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
#endif /* va_arg */
/* Use the local (ACPICA) definitions of the clib functions */
#endif /* ACPI_USE_SYSTEM_CLIBRARY */ #endif /* ACPI_USE_SYSTEM_CLIBRARY */
#ifndef ACPI_FILE #ifndef ACPI_FILE
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
#ifndef __ACGCC_H__ #ifndef __ACGCC_H__
#define __ACGCC_H__ #define __ACGCC_H__
/*
* Use compiler specific <stdarg.h> is a good practice for even when
* -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
*/
#include <stdarg.h>
#define ACPI_INLINE __inline__ #define ACPI_INLINE __inline__
/* Function name is used for debug output. Non-ANSI, compiler-dependent */ /* Function name is used for debug output. Non-ANSI, compiler-dependent */
......
...@@ -180,7 +180,6 @@ ...@@ -180,7 +180,6 @@
#else /* !__KERNEL__ */ #else /* !__KERNEL__ */
#include <stdarg.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment