use builtin va_arg in GCC 4.x
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1400 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
8e5f428777
commit
43a6a907da
@ -13,6 +13,7 @@
|
|||||||
* 2008-07-12 Bernard remove all rt_int8, rt_uint32_t etc typedef
|
* 2008-07-12 Bernard remove all rt_int8, rt_uint32_t etc typedef
|
||||||
* 2010-10-26 yi.qiu add module support
|
* 2010-10-26 yi.qiu add module support
|
||||||
* 2010-11-10 Bernard add cleanup callback function in thread exit.
|
* 2010-11-10 Bernard add cleanup callback function in thread exit.
|
||||||
|
* 2011-05-09 Bernard use builtin va_arg in GCC 4.x
|
||||||
*/
|
*/
|
||||||
#ifndef __RT_DEF_H__
|
#ifndef __RT_DEF_H__
|
||||||
#define __RT_DEF_H__
|
#define __RT_DEF_H__
|
||||||
@ -97,6 +98,7 @@ typedef rt_uint32_t rt_off_t; /**< Type for offset */
|
|||||||
#ifdef RT_USING_NEWLIB
|
#ifdef RT_USING_NEWLIB
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
#else
|
||||||
|
#if __GNUC__ < 4
|
||||||
typedef void *__sys_va_list;
|
typedef void *__sys_va_list;
|
||||||
typedef __sys_va_list va_list;
|
typedef __sys_va_list va_list;
|
||||||
#define __va_rounded_size(type) \
|
#define __va_rounded_size(type) \
|
||||||
@ -108,6 +110,13 @@ typedef rt_uint32_t rt_off_t; /**< Type for offset */
|
|||||||
#define va_arg(ap, type) \
|
#define va_arg(ap, type) \
|
||||||
(ap = (__sys_va_list) ((char *) (ap) + __va_rounded_size (type)), \
|
(ap = (__sys_va_list) ((char *) (ap) + __va_rounded_size (type)), \
|
||||||
*((type *) (void *) ((char *) (ap) - __va_rounded_size (type))))
|
*((type *) (void *) ((char *) (ap) - __va_rounded_size (type))))
|
||||||
|
#else
|
||||||
|
typedef __builtin_va_list __gnuc_va_list;
|
||||||
|
typedef __gnuc_va_list va_list;
|
||||||
|
#define va_start(v,l) __builtin_va_start(v,l)
|
||||||
|
#define va_end(v) __builtin_va_end(v)
|
||||||
|
#define va_arg(v,l) __builtin_va_arg(v,l)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SECTION(x) __attribute__((section(x)))
|
#define SECTION(x) __attribute__((section(x)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user