libc/newlib/libc/include/sys/cdefs.h

169 lines
5.8 KiB
C
Raw Normal View History

* Makefile.am (LIB_OBJECTLISTS): Add libc/search/objectlist.awk.in. * libc/Makefile.am (SUBDIRS): Add search. (SUBLIBS): Add search/libsearch.la. * libc/configure.in (AC_OUTPUT): Add search/Makefile. * libc/search: New directory. * libc/search/Makefile.am: New file. * libc/search/extern.h: New file. * libc/search/hash.c: New file. * libc/search/hash.h: New file. * libc/search/hash_bigkey.c: New file. * libc/search/hash_buf.c: New file. * libc/search/hash_func.c: New file. * libc/search/hash_log2.c: New file. * libc/search/hash_page.c: New file. * libc/search/hcreate.3: New file. * libc/search/hcreate.c: New file. * libc/search/hcreate.c~: New file. * libc/search/hcreate_r.c: New file. * libc/search/ndbm.c: New file. * libc/search/page.h: New file. * libc/search/tdelete.c: New file. * libc/search/tdestroy.c: New file. * libc/search/tfind.c: New file. * libc/search/tsearch.3: New file. * libc/search/tsearch.c: New file. * libc/search/twalk.c: New file. * libc/include/db.h: New file. * libc/include/ndbm.h: New file. * libc/include/search.h: New file. * libc/include/sys/queue.h: New file. * libc/include/sys/cdefs.h: New file. * libc/include/sys/param.h [__IEEE_LITTLE_ENDIAN,__IEEE_BIG_ENDIAN]: Set BYTE_ORDER to LITTLE_ENDIAN or BIG_ENDIAN. * libc/include/sys/errno.h (EFTYPE): New macro. * libc/search/bsearch.c: Move from libc/stdlib. * libc/search/qsort.c: Likewise. * libc/stdlib/Makefile.am (LIB_SOURCES): Remove bsearch.c and qsort.c. (CHEWOUT_FILES): Remove bsearch.def and qsort.def. * libc/stdlib/stdlib.tex: Remove references to bsearch and qsort.
2002-06-20 21:51:40 +02:00
/* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */
/* Written 2000 by Werner Almesberger */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Berkeley Software Design, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
* $FreeBSD: src/sys/sys/cdefs.h,v 1.54 2002/05/11 03:58:24 alfred Exp $
*/
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H
#include <sys/features.h>
#include <stddef.h>
#include <stdint.h>
* Makefile.am (LIB_OBJECTLISTS): Add libc/search/objectlist.awk.in. * libc/Makefile.am (SUBDIRS): Add search. (SUBLIBS): Add search/libsearch.la. * libc/configure.in (AC_OUTPUT): Add search/Makefile. * libc/search: New directory. * libc/search/Makefile.am: New file. * libc/search/extern.h: New file. * libc/search/hash.c: New file. * libc/search/hash.h: New file. * libc/search/hash_bigkey.c: New file. * libc/search/hash_buf.c: New file. * libc/search/hash_func.c: New file. * libc/search/hash_log2.c: New file. * libc/search/hash_page.c: New file. * libc/search/hcreate.3: New file. * libc/search/hcreate.c: New file. * libc/search/hcreate.c~: New file. * libc/search/hcreate_r.c: New file. * libc/search/ndbm.c: New file. * libc/search/page.h: New file. * libc/search/tdelete.c: New file. * libc/search/tdestroy.c: New file. * libc/search/tfind.c: New file. * libc/search/tsearch.3: New file. * libc/search/tsearch.c: New file. * libc/search/twalk.c: New file. * libc/include/db.h: New file. * libc/include/ndbm.h: New file. * libc/include/search.h: New file. * libc/include/sys/queue.h: New file. * libc/include/sys/cdefs.h: New file. * libc/include/sys/param.h [__IEEE_LITTLE_ENDIAN,__IEEE_BIG_ENDIAN]: Set BYTE_ORDER to LITTLE_ENDIAN or BIG_ENDIAN. * libc/include/sys/errno.h (EFTYPE): New macro. * libc/search/bsearch.c: Move from libc/stdlib. * libc/search/qsort.c: Likewise. * libc/stdlib/Makefile.am (LIB_SOURCES): Remove bsearch.c and qsort.c. (CHEWOUT_FILES): Remove bsearch.def and qsort.def. * libc/stdlib/stdlib.tex: Remove references to bsearch and qsort.
2002-06-20 21:51:40 +02:00
#define __FBSDID(x) /* nothing */
/*
* Note: the goal here is not compatibility to K&R C. Since we know that we
* have GCC which understands ANSI C perfectly well, we make use of this.
*/
#define __P(args) args
#define __PMT(args) args
#define __const const
#define __signed signed
#define __volatile volatile
#define __DOTS , ...
#define __THROW
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
* mode -- there must be no spaces between its arguments, and for nested
* __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
* concatenate double-quoted strings produced by the __STRING macro, but
* this only works with ANSI C.
*
* __XSTRING is like __STRING, but it expands any macros in its argument
* first. It is only available with ANSI C.
*/
#define __CONCAT1(x,y) x ## y
#define __CONCAT(x,y) __CONCAT1(x,y)
#define __STRING(x) #x /* stringify without expanding x */
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
#ifdef __GNUC__
# define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
#endif
* Makefile.am (LIB_OBJECTLISTS): Add libc/search/objectlist.awk.in. * libc/Makefile.am (SUBDIRS): Add search. (SUBLIBS): Add search/libsearch.la. * libc/configure.in (AC_OUTPUT): Add search/Makefile. * libc/search: New directory. * libc/search/Makefile.am: New file. * libc/search/extern.h: New file. * libc/search/hash.c: New file. * libc/search/hash.h: New file. * libc/search/hash_bigkey.c: New file. * libc/search/hash_buf.c: New file. * libc/search/hash_func.c: New file. * libc/search/hash_log2.c: New file. * libc/search/hash_page.c: New file. * libc/search/hcreate.3: New file. * libc/search/hcreate.c: New file. * libc/search/hcreate.c~: New file. * libc/search/hcreate_r.c: New file. * libc/search/ndbm.c: New file. * libc/search/page.h: New file. * libc/search/tdelete.c: New file. * libc/search/tdestroy.c: New file. * libc/search/tfind.c: New file. * libc/search/tsearch.3: New file. * libc/search/tsearch.c: New file. * libc/search/twalk.c: New file. * libc/include/db.h: New file. * libc/include/ndbm.h: New file. * libc/include/search.h: New file. * libc/include/sys/queue.h: New file. * libc/include/sys/cdefs.h: New file. * libc/include/sys/param.h [__IEEE_LITTLE_ENDIAN,__IEEE_BIG_ENDIAN]: Set BYTE_ORDER to LITTLE_ENDIAN or BIG_ENDIAN. * libc/include/sys/errno.h (EFTYPE): New macro. * libc/search/bsearch.c: Move from libc/stdlib. * libc/search/qsort.c: Likewise. * libc/stdlib/Makefile.am (LIB_SOURCES): Remove bsearch.c and qsort.c. (CHEWOUT_FILES): Remove bsearch.def and qsort.def. * libc/stdlib/stdlib.tex: Remove references to bsearch and qsort.
2002-06-20 21:51:40 +02:00
#define __ptr_t void *
#define __long_double_t long double
#define __attribute_malloc__
#define __attribute_pure__
#define __attribute_format_strfmon__(a,b)
#define __flexarr [0]
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS
# define __END_DECLS
#endif
#ifndef __BOUNDED_POINTERS__
# define __bounded /* nothing */
# define __unbounded /* nothing */
# define __ptrvalue /* nothing */
#endif
/*
* Given the pointer x to the member m of the struct s, return
* a pointer to the containing structure. When using GCC, we first
* assign pointer x to a local variable, to check that its type is
* compatible with member m.
*/
#if __GNUC_PREREQ(3, 1)
#define __containerof(x, s, m) ({ \
const volatile __typeof__(((s *)0)->m) *__x = (x); \
__DEQUALIFY(s *, (const volatile char *)__x - offsetof(s, m));\
})
#else
#define __containerof(x, s, m) \
__DEQUALIFY(s *, (const volatile char *)(x) - offsetof(s, m))
#endif
#ifndef __DEQUALIFY
#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
#endif
* Makefile.am (LIB_OBJECTLISTS): Add libc/search/objectlist.awk.in. * libc/Makefile.am (SUBDIRS): Add search. (SUBLIBS): Add search/libsearch.la. * libc/configure.in (AC_OUTPUT): Add search/Makefile. * libc/search: New directory. * libc/search/Makefile.am: New file. * libc/search/extern.h: New file. * libc/search/hash.c: New file. * libc/search/hash.h: New file. * libc/search/hash_bigkey.c: New file. * libc/search/hash_buf.c: New file. * libc/search/hash_func.c: New file. * libc/search/hash_log2.c: New file. * libc/search/hash_page.c: New file. * libc/search/hcreate.3: New file. * libc/search/hcreate.c: New file. * libc/search/hcreate.c~: New file. * libc/search/hcreate_r.c: New file. * libc/search/ndbm.c: New file. * libc/search/page.h: New file. * libc/search/tdelete.c: New file. * libc/search/tdestroy.c: New file. * libc/search/tfind.c: New file. * libc/search/tsearch.3: New file. * libc/search/tsearch.c: New file. * libc/search/twalk.c: New file. * libc/include/db.h: New file. * libc/include/ndbm.h: New file. * libc/include/search.h: New file. * libc/include/sys/queue.h: New file. * libc/include/sys/cdefs.h: New file. * libc/include/sys/param.h [__IEEE_LITTLE_ENDIAN,__IEEE_BIG_ENDIAN]: Set BYTE_ORDER to LITTLE_ENDIAN or BIG_ENDIAN. * libc/include/sys/errno.h (EFTYPE): New macro. * libc/search/bsearch.c: Move from libc/stdlib. * libc/search/qsort.c: Likewise. * libc/stdlib/Makefile.am (LIB_SOURCES): Remove bsearch.c and qsort.c. (CHEWOUT_FILES): Remove bsearch.def and qsort.def. * libc/stdlib/stdlib.tex: Remove references to bsearch and qsort.
2002-06-20 21:51:40 +02:00
#ifdef __GNUC__
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
#ifdef __ELF__
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." #sym); \
__asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#else
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
__asm__(".equ alias, sym")
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning.sym"); \
__asm__(".asciz \"msg\""); \
__asm__(".previous")
#endif /* __STDC__ */
#else /* !__ELF__ */
#ifdef __STDC__
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs \"" msg "\",30,0,0,0"); \
__asm__(".stabs \"_" #sym "\",1,0,0,0")
#else
#define __weak_reference(sym,alias) \
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#define __warn_references(sym,msg) \
__asm__(".stabs msg,30,0,0,0"); \
__asm__(".stabs \"_/**/sym\",1,0,0,0")
#endif /* __STDC__ */
#endif /* __ELF__ */
#endif /* __GNUC__ */
#endif /* _SYS_CDEFS_H */