source: rtems-libbsd/patches/newlib-cvs-20121024.diff @ 70555d5

55-freebsd-126-freebsd-12
Last change on this file since 70555d5 was 5e93bed, checked in by Joel Sherrill <joel.sherrill@…>, on 10/24/12 at 20:37:49

Tool patches: Add newlib patch needed

  • Property mode set to 100644
File size: 27.9 KB
  • newlib/configure.host

    RCS file: /cvs/src/src/newlib/configure.host,v
    retrieving revision 1.126
    diff -u -r1.126 configure.host
     
    550550        newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
    551551        # turn off unsupported items in posix directory
    552552        newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN"
     553        newlib_cflags="${newlib_cflags} -Wall"
    553554        ;;
    554555# VxWorks supplies its own version of malloc, and the newlib one
    555556# doesn't work because VxWorks does not have sbrk.
  • newlib/libc/include/pthread.h

    RCS file: /cvs/src/src/newlib/libc/include/pthread.h,v
    retrieving revision 1.9
    diff -u -r1.9 pthread.h
     
    328328
    329329#if defined(_POSIX_READER_WRITER_LOCKS)
    330330
     331/* This is used to statically initialize a pthread_rwlock_t. Example:
     332 
     333    pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER;
     334 */
     335
     336#define PTHREAD_RWLOCK_INITIALIZER  ((pthread_rwlock_t) 0xFFFFFFFF)
     337
    331338int     _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr));
    332339int     _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr));
    333340int     _EXFUN(pthread_rwlockattr_getpshared,
  • newlib/libc/include/sys/cdefs.h

    RCS file: /cvs/src/src/newlib/libc/include/sys/cdefs.h,v
    retrieving revision 1.2
    diff -u -r1.2 cdefs.h
     
    1 /* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */
    2 
    3 /* Written 2000 by Werner Almesberger */
    4 
    5 /*
     1/*-
    62 * Copyright (c) 1991, 1993
    73 *      The Regents of the University of California.  All rights reserved.
    84 *
     
    1713 * 2. Redistributions in binary form must reproduce the above copyright
    1814 *    notice, this list of conditions and the following disclaimer in the
    1915 *    documentation and/or other materials provided with the distribution.
    20  * 3. All advertising materials mentioning features or use of this software
    21  *    must display the following acknowledgement:
    22  *      This product includes software developed by the University of
    23  *      California, Berkeley and its contributors.
    2416 * 4. Neither the name of the University nor the names of its contributors
    2517 *    may be used to endorse or promote products derived from this software
    2618 *    without specific prior written permission.
     
    3830 * SUCH DAMAGE.
    3931 *
    4032 *      @(#)cdefs.h     8.8 (Berkeley) 1/9/95
    41  * $FreeBSD: src/sys/sys/cdefs.h,v 1.54 2002/05/11 03:58:24 alfred Exp $
     33 * $FreeBSD$
    4234 */
    4335
    44 #ifndef _SYS_CDEFS_H
    45 #define _SYS_CDEFS_H
     36/* FreeBSD kernel code depends on sys/cdefs.h using precisely this guard */
     37#ifndef _SYS_CDEFS_HH_
     38#define _SYS_CDEFS_HH_
     39
     40#if defined(__cplusplus)
     41#define __BEGIN_DECLS   extern "C" {
     42#define __END_DECLS     }
     43#else
     44#define __BEGIN_DECLS
     45#define __END_DECLS
     46#endif
    4647
    47 #define __FBSDID(x) /* nothing */
    4848/*
    49  * Note: the goal here is not compatibility to K&R C. Since we know that we
    50  * have GCC which understands ANSI C perfectly well, we make use of this.
     49 * This code has been put in place to help reduce the addition of
     50 * compiler specific defines in FreeBSD code.  It helps to aid in
     51 * having a compiler-agnostic source tree.
    5152 */
    5253
    53 #define __P(args)       args
    54 #define __PMT(args)     args
    55 #define __const         const
    56 #define __signed        signed
    57 #define __volatile      volatile
    58 #define __DOTS          , ...
    59 #define __THROW
     54#if defined(__GNUC__) || defined(__INTEL_COMPILER)
     55
     56#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
     57#define __GNUCLIKE_ASM 3
     58#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
     59#else
     60#define __GNUCLIKE_ASM 2
     61#endif
     62#define __GNUCLIKE___TYPEOF 1
     63#define __GNUCLIKE___OFFSETOF 1
     64#define __GNUCLIKE___SECTION 1
     65
     66#define __GNUCLIKE_ATTRIBUTE_MODE_DI 1
     67
     68#ifndef __INTEL_COMPILER
     69# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
     70#endif
     71
     72#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
     73# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
     74    && __INTEL_COMPILER < 800
     75#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
     76# endif
     77
     78#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
     79# define __GNUCLIKE_BUILTIN_VARARGS 1
     80# define __GNUCLIKE_BUILTIN_STDARG 1
     81# define __GNUCLIKE_BUILTIN_VAALIST 1
     82#endif
     83
     84#if defined(__GNUC__)
     85# define __GNUC_VA_LIST_COMPATIBILITY 1
     86#endif
     87
     88#ifndef __INTEL_COMPILER
     89# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
     90# define __GNUCLIKE_MATH_BUILTIN_RELOPS
     91#endif
     92
     93#define __GNUCLIKE_BUILTIN_MEMCPY 1
     94
     95/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
     96#define __CC_SUPPORTS_INLINE 1
     97#define __CC_SUPPORTS___INLINE 1
     98#define __CC_SUPPORTS___INLINE__ 1
     99
     100#define __CC_SUPPORTS___FUNC__ 1
     101#define __CC_SUPPORTS_WARNING 1
     102
     103#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
     104
     105#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
     106
     107#endif /* __GNUC__ || __INTEL_COMPILER */
     108
     109/*
     110 * Macro to test if we're using a specific version of gcc or later.
     111 */
     112#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
     113#define __GNUC_PREREQ__(ma, mi) \
     114        (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
     115#else
     116#define __GNUC_PREREQ__(ma, mi) 0
     117#endif
    60118
    61119/*
    62120 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
     
    70128 * __XSTRING is like __STRING, but it expands any macros in its argument
    71129 * first.  It is only available with ANSI C.
    72130 */
    73 #define __CONCAT1(x,y)  x ## y
    74 #define __CONCAT(x,y)   __CONCAT1(x,y)
    75 #define __STRING(x)     #x              /* stringify without expanding x */
    76 #define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
     131#if defined(__STDC__) || defined(__cplusplus)
     132#define __P(protos)     protos          /* full-blown ANSI C */
     133#define __CONCAT1(x,y)  x ## y
     134#define __CONCAT(x,y)   __CONCAT1(x,y)
     135#define __STRING(x)     #x              /* stringify without expanding x */
     136#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
    77137
     138/*
     139 * Required to build gcc's libssp. Not part of current FreeBSD version
     140 * but assumed to exist by existing code.
     141 */
    78142#ifdef __GNUC__
    79143# define __ASMNAME(cname)  __XSTRING (__USER_LABEL_PREFIX__) cname
    80144#endif
    81145
    82 #define __ptr_t void *
    83 #define __long_double_t  long double
     146#define __const         const           /* define reserved names to standard */
     147#define __signed        signed
     148#define __volatile      volatile
     149#if defined(__cplusplus)
     150#define __inline        inline          /* convert to C++ keyword */
     151#else
     152#if !(defined(__CC_SUPPORTS___INLINE))
     153#define __inline                        /* delete GCC keyword */
     154#endif /* ! __CC_SUPPORTS___INLINE */
     155#endif /* !__cplusplus */
     156
     157#else   /* !(__STDC__ || __cplusplus) */
     158#define __P(protos)     ()              /* traditional C preprocessor */
     159#define __CONCAT(x,y)   x/**/y
     160#define __STRING(x)     "x"
     161
     162#if !defined(__CC_SUPPORTS___INLINE)
     163#define __const                         /* delete pseudo-ANSI C keywords */
     164#define __inline
     165#define __signed
     166#define __volatile
     167/*
     168 * In non-ANSI C environments, new programs will want ANSI-only C keywords
     169 * deleted from the program and old programs will want them left alone.
     170 * When using a compiler other than gcc, programs using the ANSI C keywords
     171 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
     172 * When using "gcc -traditional", we assume that this is the intent; if
     173 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
     174 */
     175#ifndef NO_ANSI_KEYWORDS
     176#define const                           /* delete ANSI C keywords */
     177#define inline
     178#define signed
     179#define volatile
     180#endif  /* !NO_ANSI_KEYWORDS */
     181#endif  /* !__CC_SUPPORTS___INLINE */
     182#endif  /* !(__STDC__ || __cplusplus) */
    84183
    85 #define __attribute_malloc__
    86 #define __attribute_pure__
    87 #define __attribute_format_strfmon__(a,b)
    88 #define __flexarr      [0]
    89 
    90 #ifdef  __cplusplus
    91 # define __BEGIN_DECLS  extern "C" {
    92 # define __END_DECLS    }
    93 #else
    94 # define __BEGIN_DECLS
    95 # define __END_DECLS
    96 #endif
    97 
    98 #ifndef __BOUNDED_POINTERS__
    99 # define __bounded      /* nothing */
    100 # define __unbounded    /* nothing */
    101 # define __ptrvalue     /* nothing */
     184/*
     185 * Compiler-dependent macros to help declare dead (non-returning) and
     186 * pure (no side effects) functions, and unused variables.  They are
     187 * null except for versions of gcc that are known to support the features
     188 * properly (old versions of gcc-2 supported the dead and pure features
     189 * in a different (wrong) way).  If we do not provide an implementation
     190 * for a given compiler, let the compile fail if it is told to use
     191 * a feature that we cannot live without.
     192 */
     193#ifdef lint
     194#define __dead2
     195#define __pure2
     196#define __unused
     197#define __packed
     198#define __aligned(x)
     199#define __section(x)
     200#else
     201#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
     202#define __dead2
     203#define __pure2
     204#define __unused
     205#endif
     206#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
     207#define __dead2         __attribute__((__noreturn__))
     208#define __pure2         __attribute__((__const__))
     209#define __unused
     210/* XXX Find out what to do for __packed, __aligned and __section */
     211#endif
     212#if __GNUC_PREREQ__(2, 7)
     213#define __dead2         __attribute__((__noreturn__))
     214#define __pure2         __attribute__((__const__))
     215#define __unused        __attribute__((__unused__))
     216#define __used          __attribute__((__used__))
     217#define __packed        __attribute__((__packed__))
     218#define __aligned(x)    __attribute__((__aligned__(x)))
     219#define __section(x)    __attribute__((__section__(x)))
     220#endif
     221#if defined(__INTEL_COMPILER)
     222#define __dead2         __attribute__((__noreturn__))
     223#define __pure2         __attribute__((__const__))
     224#define __unused        __attribute__((__unused__))
     225#define __used          __attribute__((__used__))
     226#define __packed        __attribute__((__packed__))
     227#define __aligned(x)    __attribute__((__aligned__(x)))
     228#define __section(x)    __attribute__((__section__(x)))
     229#endif
    102230#endif
    103231
    104 #ifdef __GNUC__
     232#if __GNUC_PREREQ__(2, 96)
     233#define __malloc_like   __attribute__((__malloc__))
     234#define __pure          __attribute__((__pure__))
     235#else
     236#define __malloc_like
     237#define __pure
     238#endif
     239
     240#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
     241#define __always_inline __attribute__((__always_inline__))
     242#else
     243#define __always_inline
     244#endif
     245
     246#if __GNUC_PREREQ__(4, 2) /* actually 4.1.3 */
     247#define __gnu89_inline  __attribute__((__gnu_inline__)) __inline
     248#else
     249#define __gnu89_inline
     250#endif
     251
     252#if __GNUC_PREREQ__(3, 1)
     253#define __noinline      __attribute__ ((__noinline__))
     254#else
     255#define __noinline
     256#endif
     257
     258#if __GNUC_PREREQ__(3, 3)
     259#define __nonnull(x)    __attribute__((__nonnull__(x)))
     260#else
     261#define __nonnull(x)
     262#endif
     263
     264/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
     265#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
     266#define __func__        NULL
     267#endif
     268
     269#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
     270#define __LONG_LONG_SUPPORTED
     271#endif
     272
     273/*
     274 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
     275 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
     276 * a way to define the `restrict' type qualifier without disturbing older
     277 * software that is unaware of C99 keywords.
     278 */
     279#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
     280#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
     281#define __restrict
     282#else
     283#define __restrict      restrict
     284#endif
     285#endif
     286
     287/*
     288 * GNU C version 2.96 adds explicit branch prediction so that
     289 * the CPU back-end can hint the processor and also so that
     290 * code blocks can be reordered such that the predicted path
     291 * sees a more linear flow, thus improving cache behavior, etc.
     292 *
     293 * The following two macros provide us with a way to utilize this
     294 * compiler feature.  Use __predict_true() if you expect the expression
     295 * to evaluate to true, and __predict_false() if you expect the
     296 * expression to evaluate to false.
     297 *
     298 * A few notes about usage:
     299 *
     300 *      * Generally, __predict_false() error condition checks (unless
     301 *        you have some _strong_ reason to do otherwise, in which case
     302 *        document it), and/or __predict_true() `no-error' condition
     303 *        checks, assuming you want to optimize for the no-error case.
     304 *
     305 *      * Other than that, if you don't know the likelihood of a test
     306 *        succeeding from empirical or other `hard' evidence, don't
     307 *        make predictions.
     308 *
     309 *      * These are meant to be used in places that are run `a lot'.
     310 *        It is wasteful to make predictions in code that is run
     311 *        seldomly (e.g. at subsystem initialization time) as the
     312 *        basic block reordering that this affects can often generate
     313 *        larger code.
     314 */
     315#if __GNUC_PREREQ__(2, 96)
     316#define __predict_true(exp)     __builtin_expect((exp), 1)
     317#define __predict_false(exp)    __builtin_expect((exp), 0)
     318#else
     319#define __predict_true(exp)     (exp)
     320#define __predict_false(exp)    (exp)
     321#endif
     322
     323#if __GNUC_PREREQ__(4, 2)
     324#define __hidden        __attribute__((__visibility__("hidden")))
     325#define __exported      __attribute__((__visibility__("default")))
     326#else
     327#define __hidden
     328#define __exported
     329#endif
     330
     331/*
     332 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
     333 * require it.
     334 */
     335#if __GNUC_PREREQ__(4, 1)
     336#define __offsetof(type, field)  __builtin_offsetof(type, field)
     337#else
     338#ifndef __cplusplus
     339#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
     340#else
     341#define __offsetof(type, field)                                 \
     342  (__offsetof__ (reinterpret_cast <size_t>                      \
     343                 (&reinterpret_cast <const volatile char &>     \
     344                  (static_cast<type *> (0)->field))))
     345#endif
     346#endif
     347#define __rangeof(type, start, end) \
     348        (__offsetof(type, end) - __offsetof(type, start))
     349
     350/*
     351 * Compiler-dependent macros to declare that functions take printf-like
     352 * or scanf-like arguments.  They are null except for versions of gcc
     353 * that are known to support the features properly (old versions of gcc-2
     354 * didn't permit keeping the keywords out of the application namespace).
     355 */
     356#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
     357#define __printflike(fmtarg, firstvararg)
     358#define __scanflike(fmtarg, firstvararg)
     359#define __format_arg(fmtarg)
     360#else
     361#define __printflike(fmtarg, firstvararg) \
     362            __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     363#define __scanflike(fmtarg, firstvararg) \
     364            __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     365#define __format_arg(fmtarg)    __attribute__((__format_arg__ (fmtarg)))
     366#endif
     367
     368/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
     369#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
     370#define __printf0like(fmtarg, firstvararg) \
     371            __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
     372#else
     373#define __printf0like(fmtarg, firstvararg)
     374#endif
     375
     376#if defined(__GNUC__) || defined(__INTEL_COMPILER)
     377#ifndef __INTEL_COMPILER
    105378#define __strong_reference(sym,aliassym)        \
    106         extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
    107 #ifdef __ELF__
     379        extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
     380#endif
    108381#ifdef __STDC__
    109382#define __weak_reference(sym,alias)     \
    110383        __asm__(".weak " #alias);       \
     
    113386        __asm__(".section .gnu.warning." #sym); \
    114387        __asm__(".asciz \"" msg "\"");  \
    115388        __asm__(".previous")
     389#define __sym_compat(sym,impl,verid)    \
     390        __asm__(".symver " #impl ", " #sym "@" #verid)
     391#define __sym_default(sym,impl,verid)   \
     392        __asm__(".symver " #impl ", " #sym "@@" #verid)
    116393#else
    117394#define __weak_reference(sym,alias)     \
    118395        __asm__(".weak alias");         \
     
    121398        __asm__(".section .gnu.warning.sym"); \
    122399        __asm__(".asciz \"msg\"");      \
    123400        __asm__(".previous")
     401#define __sym_compat(sym,impl,verid)    \
     402        __asm__(".symver impl, sym@verid")
     403#define __sym_default(impl,sym,verid)   \
     404        __asm__(".symver impl, sym@@verid")
    124405#endif  /* __STDC__ */
    125 #else   /* !__ELF__ */
    126 #ifdef __STDC__
    127 #define __weak_reference(sym,alias)     \
    128         __asm__(".stabs \"_" #alias "\",11,0,0,0");     \
    129         __asm__(".stabs \"_" #sym "\",1,0,0,0")
    130 #define __warn_references(sym,msg)      \
    131         __asm__(".stabs \"" msg "\",30,0,0,0");         \
    132         __asm__(".stabs \"_" #sym "\",1,0,0,0")
     406#endif  /* __GNUC__ || __INTEL_COMPILER */
     407
     408#if defined(__GNUC__) || defined(__INTEL_COMPILER)
     409#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
    133410#else
    134 #define __weak_reference(sym,alias)     \
    135         __asm__(".stabs \"_/**/alias\",11,0,0,0");      \
    136         __asm__(".stabs \"_/**/sym\",1,0,0,0")
    137 #define __warn_references(sym,msg)      \
    138         __asm__(".stabs msg,30,0,0,0");                 \
    139         __asm__(".stabs \"_/**/sym\",1,0,0,0")
    140 #endif  /* __STDC__ */
    141 #endif  /* __ELF__ */
    142 #endif  /* __GNUC__ */
     411/*
     412 * The following definition might not work well if used in header files,
     413 * but it should be better than nothing.  If you want a "do nothing"
     414 * version, then it should generate some harmless declaration, such as:
     415 *    #define __IDSTRING(name,string)   struct __hack
     416 */
     417#define __IDSTRING(name,string) static const char name[] __unused = string
     418#endif
     419
     420/*
     421 * Embed the rcs id of a source file in the resulting library.  Note that in
     422 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
     423 * Usage:
     424 *      __FBSDID("$FreeBSD$");
     425 */
     426#ifndef __FBSDID
     427#if !defined(lint) && !defined(STRIP_FBSDID)
     428#define __FBSDID(s)     __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     429#else
     430#define __FBSDID(s)     struct __hack
     431#endif
     432#endif
     433
     434#ifndef __RCSID
     435#ifndef NO__RCSID
     436#define __RCSID(s)      __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     437#else
     438#define __RCSID(s)      struct __hack
     439#endif
     440#endif
     441
     442#ifndef __RCSID_SOURCE
     443#ifndef NO__RCSID_SOURCE
     444#define __RCSID_SOURCE(s)       __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
     445#else
     446#define __RCSID_SOURCE(s)       struct __hack
     447#endif
     448#endif
     449
     450#ifndef __SCCSID
     451#ifndef NO__SCCSID
     452#define __SCCSID(s)     __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
     453#else
     454#define __SCCSID(s)     struct __hack
     455#endif
     456#endif
     457
     458#ifndef __COPYRIGHT
     459#ifndef NO__COPYRIGHT
     460#define __COPYRIGHT(s)  __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
     461#else
     462#define __COPYRIGHT(s)  struct __hack
     463#endif
     464#endif
     465
     466#ifndef __DECONST
     467#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
     468#endif
     469
     470#ifndef __DEVOLATILE
     471#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
     472#endif
     473
     474#ifndef __DEQUALIFY
     475#define __DEQUALIFY(type, var)  ((type)(uintptr_t)(const volatile void *)(var))
     476#endif
     477
     478/*
     479 * The following section is directly from the FreeBSD source except for
     480 * the addition of including <sys/features.h>.  This code is desirable
     481 * for RTEMS to include but may not be desirable for other targets.
     482 * In the interest of conservatism, I am leaving it RTEMS specific.
     483 */
     484#ifdef __rtems__
     485/*
     486 * In newlib, <sys/features.h> defines the feature flags the POSIX API set of
     487 * conditionals depend on.
     488 */
     489#include <sys/features.h>
     490
     491/*-
     492 * The following definitions are an extension of the behavior originally
     493 * implemented in <sys/_posix.h>, but with a different level of granularity.
     494 * POSIX.1 requires that the macros we test be defined before any standard
     495 * header file is included.
     496 *
     497 * Here's a quick run-down of the versions:
     498 *  defined(_POSIX_SOURCE)              1003.1-1988
     499 *  _POSIX_C_SOURCE == 1                1003.1-1990
     500 *  _POSIX_C_SOURCE == 2                1003.2-1992 C Language Binding Option
     501 *  _POSIX_C_SOURCE == 199309           1003.1b-1993
     502 *  _POSIX_C_SOURCE == 199506           1003.1c-1995, 1003.1i-1995,
     503 *                                      and the omnibus ISO/IEC 9945-1: 1996
     504 *  _POSIX_C_SOURCE == 200112           1003.1-2001
     505 *  _POSIX_C_SOURCE == 200809           1003.1-2008
     506 *
     507 * In addition, the X/Open Portability Guide, which is now the Single UNIX
     508 * Specification, defines a feature-test macro which indicates the version of
     509 * that specification, and which subsumes _POSIX_C_SOURCE.
     510 *
     511 * Our macros begin with two underscores to avoid namespace screwage.
     512 */
     513
     514/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
     515#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
     516#undef _POSIX_C_SOURCE          /* Probably illegal, but beyond caring now. */
     517#define _POSIX_C_SOURCE         199009
     518#endif
     519
     520/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
     521#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
     522#undef _POSIX_C_SOURCE
     523#define _POSIX_C_SOURCE         199209
     524#endif
     525
     526/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     527#ifdef _XOPEN_SOURCE
     528#if _XOPEN_SOURCE - 0 >= 700
     529#define __XSI_VISIBLE           700
     530#undef _POSIX_C_SOURCE
     531#define _POSIX_C_SOURCE         200809
     532#elif _XOPEN_SOURCE - 0 >= 600
     533#define __XSI_VISIBLE           600
     534#undef _POSIX_C_SOURCE
     535#define _POSIX_C_SOURCE         200112
     536#elif _XOPEN_SOURCE - 0 >= 500
     537#define __XSI_VISIBLE           500
     538#undef _POSIX_C_SOURCE
     539#define _POSIX_C_SOURCE         199506
     540#endif
     541#endif
     542
     543/*
     544 * Deal with all versions of POSIX.  The ordering relative to the tests above is
     545 * important.
     546 */
     547#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     548#define _POSIX_C_SOURCE         198808
     549#endif
     550#ifdef _POSIX_C_SOURCE
     551#if _POSIX_C_SOURCE >= 200809
     552#define __POSIX_VISIBLE         200809
     553#define __ISO_C_VISIBLE         1999
     554#elif _POSIX_C_SOURCE >= 200112
     555#define __POSIX_VISIBLE         200112
     556#define __ISO_C_VISIBLE         1999
     557#elif _POSIX_C_SOURCE >= 199506
     558#define __POSIX_VISIBLE         199506
     559#define __ISO_C_VISIBLE         1990
     560#elif _POSIX_C_SOURCE >= 199309
     561#define __POSIX_VISIBLE         199309
     562#define __ISO_C_VISIBLE         1990
     563#elif _POSIX_C_SOURCE >= 199209
     564#define __POSIX_VISIBLE         199209
     565#define __ISO_C_VISIBLE         1990
     566#elif _POSIX_C_SOURCE >= 199009
     567#define __POSIX_VISIBLE         199009
     568#define __ISO_C_VISIBLE         1990
     569#else
     570#define __POSIX_VISIBLE         198808
     571#define __ISO_C_VISIBLE         0
     572#endif /* _POSIX_C_SOURCE */
     573#else
     574/*-
     575 * Deal with _ANSI_SOURCE:
     576 * If it is defined, and no other compilation environment is explicitly
     577 * requested, then define our internal feature-test macros to zero.  This
     578 * makes no difference to the preprocessor (undefined symbols in preprocessing
     579 * expressions are defined to have value zero), but makes it more convenient for
     580 * a test program to print out the values.
     581 *
     582 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
     583 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
     584 * environment (and in fact we will never get here).
     585 */
     586#if defined(_ANSI_SOURCE)       /* Hide almost everything. */
     587#define __POSIX_VISIBLE         0
     588#define __XSI_VISIBLE           0
     589#define __BSD_VISIBLE           0
     590#define __ISO_C_VISIBLE         1990
     591#elif defined(_C99_SOURCE)      /* Localism to specify strict C99 env. */
     592#define __POSIX_VISIBLE         0
     593#define __XSI_VISIBLE           0
     594#define __BSD_VISIBLE           0
     595#define __ISO_C_VISIBLE         1999
     596#else                           /* Default environment: show everything. */
     597#define __POSIX_VISIBLE         200809
     598#define __XSI_VISIBLE           700
     599#define __BSD_VISIBLE           1
     600#define __ISO_C_VISIBLE         1999
     601#endif
     602#endif
     603#endif
    143604
    144 #endif /* _SYS_CDEFS_H */
     605#endif /* !_SYS_CDEFS_H_ */
  • newlib/libc/include/sys/features.h

    RCS file: /cvs/src/src/newlib/libc/include/sys/features.h,v
    retrieving revision 1.27
    diff -u -r1.27 features.h
     
    2828/* RTEMS adheres to POSIX -- 1003.1b with some features from annexes.  */
    2929
    3030#ifdef __rtems__
     31#define _POSIX_C_SOURCE                 200809L
    3132#define _POSIX_JOB_CONTROL              1
    3233#define _POSIX_SAVED_IDS                1
    33 #define _POSIX_VERSION                  199309L
     34#define _POSIX_VERSION                  200809L
    3435#define _POSIX_ASYNCHRONOUS_IO          1
    3536#define _POSIX_FSYNC                    1
    3637#define _POSIX_MAPPED_FILES             1
     
    4647/* #define _POSIX_SHARED_MEMORY_OBJECTS 1 */
    4748#define _POSIX_SYNCHRONIZED_IO          1
    4849#define _POSIX_TIMERS                   1
    49 #define _POSIX_BARRIERS                 200112L
    50 #define _POSIX_READER_WRITER_LOCKS      200112L
    51 #define _POSIX_SPIN_LOCKS               200112L
     50#define _POSIX_BARRIERS                 200809L
     51#define _POSIX_READER_WRITER_LOCKS      200809L
     52#define _POSIX_SPIN_LOCKS               200809L
    5253
    5354
    5455/* In P1003.1b but defined by drafts at least as early as P1003.1c/D10  */
  • newlib/libc/include/sys/signal.h

    RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
    retrieving revision 1.21
    diff -u -r1.21 signal.h
     
    101101#define sa_sigaction  _signal_handlers._sigaction
    102102#endif
    103103
     104/*
     105 * Structure used in sigaltstack call.
     106 */
     107typedef struct sigalstack {
     108  void     *ss_sp;    /* Stack base or pointer.  */
     109  size_t    ss_size;  /* Stack size.  */
     110  int       ss_flags; /* Flags.  */
     111} stack_t;
     112
    104113#elif defined(__CYGWIN__)
    105114#include <cygwin/signal.h>
    106115#else
     
    158167int _EXFUN(sigsuspend, (const sigset_t *));
    159168int _EXFUN(sigpause, (int));
    160169
     170#if defined(__rtems__)
     171int _EXFUN(sigaltstack, (const stack_t *, stack_t *));
     172#endif
     173
    161174#if defined(_POSIX_THREADS)
    162175#ifdef __CYGWIN__
    163176#  ifndef _CYGWIN_TYPES_H
  • newlib/libc/search/hash.c

    RCS file: /cvs/src/src/newlib/libc/search/hash.c,v
    retrieving revision 1.11
    diff -u -r1.11 hash.c
     
    141141        new_table = 0;
    142142        if (!file || (flags & O_TRUNC) ||
    143143#ifdef __USE_INTERNAL_STAT64
    144             (_stat64(file, &statbuf) && (errno == ENOENT))) {
     144            (stat64(file, &statbuf) && (errno == ENOENT))) {
    145145#else
    146             (_stat(file, &statbuf) && (errno == ENOENT))) {
     146            (stat(file, &statbuf) && (errno == ENOENT))) {
    147147#endif
    148148                if (errno == ENOENT)
    149149                        errno = 0; /* Just in case someone looks at errno */
     
    157157                   a new .db file, then reinitialize the database */
    158158                if ((flags & O_CREAT) &&
    159159#ifdef __USE_INTERNAL_STAT64
    160                      _fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
     160                     fstat64(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
    161161#else
    162                      _fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
     162                     fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
    163163#endif
    164164                        new_table = 1;
    165165
     
    339339        /* Fix bucket size to be optimal for file system */
    340340        if (file != NULL) {
    341341#ifdef __USE_INTERNAL_STAT64
    342                 if (_stat64(file, &statbuf))
     342                if (stat64(file, &statbuf))
    343343#else
    344                 if (_stat(file, &statbuf))
     344                if (stat(file, &statbuf))
    345345#endif
    346346                        return (NULL);
    347347                hashp->BSIZE = statbuf.st_blksize;
  • newlib/libc/sys/rtems/machine/_types.h

    RCS file: /cvs/src/src/newlib/libc/sys/rtems/machine/_types.h,v
    retrieving revision 1.8
    diff -u -r1.8 _types.h
     
    1313 * could be applied here.
    1414 */
    1515
    16 #if defined(__i386__) || defined(__m32r__) || defined(__h8300__) || (defined(__arm__) && !defined(__ARM_EABI__)) || defined(__bfin__) || defined(__m68k__) || defined(__MICROBLAZE__)
     16#if defined(__i386__) || defined(__m32r__) || defined(__h8300__) || defined(__arm__) || defined(__bfin__) || defined(__m68k__) || defined(__v850) || defined(__MICROBLAZE__)
    1717#if defined(__H8300__)
    1818typedef signed int _ssize_t;
    1919#else
  • newlib/libc/sys/rtems/machine/param.h

    RCS file: /cvs/src/src/newlib/libc/sys/rtems/machine/param.h,v
    retrieving revision 1.4
    diff -u -r1.4 param.h
     
    5656 * of the hardware page size.
    5757 */
    5858#ifndef MSIZE
     59/* This increased from the old RTEMS TCP/IP stack to the FreeBSD 8.x one */
     60#ifdef __NEW_RTEMS_BSD__
     61#define MSIZE           256             /* size of an mbuf */
     62#else
    5963#define MSIZE           128             /* size of an mbuf */
     64#endif
    6065#endif  /* MSIZE */
    6166
    6267#ifndef MCLSHIFT
Note: See TracBrowser for help on using the repository browser.