Changeset 3715


Ignore:
Timestamp:
Mar 17, 2011, 6:31:19 PM (14 years ago)
Author:
bird
Message:

386/stdarg.h,sys/cdefs.h: Synced in bit from more recent FreeBSDs so that the stdarg.h macros will work with more recent GCC versions. References #212

Location:
trunk/libc/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/386/stdarg.h

    r1506 r3715  
    11/* $Id$ */
    22/** @file
    3  * FreeBSD 5.1
     3 * FreeBSD 9.0
    44 * @changed bird: EMXisms.
    55 */
     
    3838 *
    3939 *      @(#)stdarg.h    8.1 (Berkeley) 6/10/93
    40  * $FreeBSD: src/sys/i386/include/stdarg.h,v 1.18 2002/11/27 16:28:18 obrien Exp $
     40 * $FreeBSD: src/sys/i386/include/stdarg.h,v 1.21 2006/09/21 01:37:02 kan Exp $
    4141 */
    4242
     
    5353#endif
    5454
    55 #if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
     55#ifdef __GNUCLIKE_BUILTIN_STDARG
    5656
    5757#define va_start(ap, last) \
    58         __builtin_stdarg_start((ap), (last))
     58        __builtin_va_start((ap), (last))
    5959
    6060#define va_arg(ap, type) \
     
    6969        __builtin_va_end(ap)
    7070
    71 #else   /* ! __GNUC__ post GCC 2.95 */
     71#else   /* !__GNUCLIKE_BUILTIN_STDARG */
    7272
    7373#define __va_size(type) \
    7474        (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
    7575
    76 #ifdef __GNUC__
     76#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG
    7777#define va_start(ap, last) \
    7878        ((ap) = (va_list)__builtin_next_arg(last))
    79 #else   /* non-GNU compiler */
     79#else   /* !__GNUCLIKE_BUILTIN_NEXT_ARG */
    8080#define va_start(ap, last) \
    8181        ((ap) = (va_list)&(last) + __va_size(last))
    82 #endif  /* __GNUC__ */
     82#endif  /* __GNUCLIKE_BUILTIN_NEXT_ARG */
    8383
    8484#define va_arg(ap, type) \
    8585        (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
    8686
     87#if __ISO_C_VISIBLE >= 1999
     88#define va_copy(dest, src) \
     89        ((dest) = (src))
     90#endif
     91
    8792#define va_end(ap)
    8893
    89 #endif /* __GNUC__ post GCC 2.95 */
     94#endif /* __GNUCLIKE_BUILTIN_STDARG */
    9095
    9196#endif /* !_MACHINE_STDARG_H_ */
     97
  • trunk/libc/include/sys/cdefs.h

    r2150 r3715  
    4141 * @changed bird: Check if stuff is defined before accessing it in #if. Stops -Wundef
    4242 *                from bitching.
     43 * @changed bird: added __GNUCLIKE_XXX from FreeBSD 8.0 (releng/8.0/sys/sys/cdefs.h 193734)
    4344 */
    4445
     
    5556#define __END_DECLS
    5657#endif
     58
     59/*
     60 * This code has been put in place to help reduce the addition of
     61 * compiler specific defines in FreeBSD code.  It helps to aid in
     62 * having a compiler-agnostic source tree.
     63 */
     64
     65#if defined(__GNUC__) || defined(__INTEL_COMPILER)
     66
     67#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
     68#define __GNUCLIKE_ASM 3
     69#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
     70#else
     71#define __GNUCLIKE_ASM 2
     72#endif
     73#define __GNUCLIKE___TYPEOF 1
     74#define __GNUCLIKE___OFFSETOF 1
     75#define __GNUCLIKE___SECTION 1
     76
     77#define __GNUCLIKE_ATTRIBUTE_MODE_DI 1
     78
     79#ifndef __INTEL_COMPILER
     80# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
     81#endif
     82
     83#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
     84# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
     85    && __INTEL_COMPILER < 800
     86#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
     87# endif
     88
     89#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
     90# define __GNUCLIKE_BUILTIN_VARARGS 1
     91# define __GNUCLIKE_BUILTIN_STDARG 1
     92# define __GNUCLIKE_BUILTIN_VAALIST 1
     93#endif
     94
     95#if defined(__GNUC__)
     96# define __GNUC_VA_LIST_COMPATIBILITY 1
     97#endif
     98
     99#ifndef __INTEL_COMPILER
     100# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
     101# define __GNUCLIKE_MATH_BUILTIN_RELOPS
     102#endif
     103
     104#define __GNUCLIKE_BUILTIN_MEMCPY 1
     105
     106/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
     107#define __CC_SUPPORTS_INLINE 1
     108#define __CC_SUPPORTS___INLINE 1
     109#define __CC_SUPPORTS___INLINE__ 1
     110
     111#define __CC_SUPPORTS___FUNC__ 1
     112#define __CC_SUPPORTS_WARNING 1
     113
     114#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
     115
     116#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
     117
     118#endif /* __GNUC__ || __INTEL_COMPILER */
    57119
    58120/*
Note: See TracChangeset for help on using the changeset viewer.