aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-08-04 04:44:38 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-08-12 21:09:34 -0400
commit5fb3ab848b35b68e9bc757f52e4562481e801882 (patch)
tree44a7edc1863916794a22f7741486d0f372ebb500
parentb597664f8f87a19611e2433888f743f31442532c (diff)
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=1298 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--include/acpi/platform/acenv.h40
-rw-r--r--include/acpi/platform/acgcc.h6
-rw-r--r--include/acpi/platform/aclinux.h1
3 files changed, 6 insertions, 41 deletions
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 50ae2d6900e6..f40511335a98 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -342,52 +342,12 @@
342 342
343/* Use the standard headers from the standard locations */ 343/* Use the standard headers from the standard locations */
344 344
345#include <stdarg.h>
346#include <stdlib.h> 345#include <stdlib.h>
347#include <string.h> 346#include <string.h>
348#include <ctype.h> 347#include <ctype.h>
349 348
350#endif /* ACPI_USE_STANDARD_HEADERS */ 349#endif /* ACPI_USE_STANDARD_HEADERS */
351 350
352/* We will be linking to the standard Clib functions */
353
354#else
355
356/******************************************************************************
357 *
358 * Not using native C library, use local implementations
359 *
360 *****************************************************************************/
361
362/*
363 * Use local definitions of C library macros and functions. These function
364 * implementations may not be as efficient as an inline or assembly code
365 * implementation provided by a native C library, but they are functionally
366 * equivalent.
367 */
368#ifndef va_arg
369
370#ifndef _VALIST
371#define _VALIST
372typedef char *va_list;
373#endif /* _VALIST */
374
375/* Storage alignment properties */
376
377#define _AUPBND (sizeof (acpi_native_int) - 1)
378#define _ADNBND (sizeof (acpi_native_int) - 1)
379
380/* Variable argument list macro definitions */
381
382#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
383#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
384#define va_end(ap) (ap = (va_list) NULL)
385#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
386
387#endif /* va_arg */
388
389/* Use the local (ACPICA) definitions of the clib functions */
390
391#endif /* ACPI_USE_SYSTEM_CLIBRARY */ 351#endif /* ACPI_USE_SYSTEM_CLIBRARY */
392 352
393#ifndef ACPI_FILE 353#ifndef ACPI_FILE
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index c5a216c976fa..9f79e98e549b 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -44,6 +44,12 @@
44#ifndef __ACGCC_H__ 44#ifndef __ACGCC_H__
45#define __ACGCC_H__ 45#define __ACGCC_H__
46 46
47/*
48 * Use compiler specific <stdarg.h> is a good practice for even when
49 * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
50 */
51#include <stdarg.h>
52
47#define ACPI_INLINE __inline__ 53#define ACPI_INLINE __inline__
48 54
49/* Function name is used for debug output. Non-ANSI, compiler-dependent */ 55/* Function name is used for debug output. Non-ANSI, compiler-dependent */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index cde6f33916a5..447c33f303b0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -180,7 +180,6 @@
180 180
181#else /* !__KERNEL__ */ 181#else /* !__KERNEL__ */
182 182
183#include <stdarg.h>
184#include <string.h> 183#include <string.h>
185#include <stdlib.h> 184#include <stdlib.h>
186#include <ctype.h> 185#include <ctype.h>