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 /* 6 * Copyright (c) 1991, 1993 7 * The Regents of the University of California. All rights reserved. 8 * 9 * This code is derived from software contributed to Berkeley by 10 * Berkeley Software Design, Inc. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * 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. 24 * 4. Neither the name of the University nor the names of its contributors 25 * may be used to endorse or promote products derived from this software 26 * without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * SUCH DAMAGE. 39 * 40 * @(#)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 $ 42 */ 43 44 #ifndef _SYS_CDEFS_H 45 #define _SYS_CDEFS_H 46 47 #define __FBSDID(x) /* nothing */ 48 /* 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. 51 */ 52 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 60 61 #define __ptr_t void * 62 #define __long_double_t long double 63 64 #define __attribute_malloc__ 65 #define __attribute_pure__ 66 #define __attribute_format_strfmon__(a,b) 67 #define __flexarr [0] 68 69 #ifdef __cplusplus 70 # define __BEGIN_DECLS extern "C" { 71 # define __END_DECLS } 72 #else 73 # define __BEGIN_DECLS 74 # define __END_DECLS 75 #endif 76 77 #ifndef __BOUNDED_POINTERS__ 78 # define __bounded /* nothing */ 79 # define __unbounded /* nothing */ 80 # define __ptrvalue /* nothing */ 81 #endif 82 83 #ifdef __GNUC__ 84 #define __strong_reference(sym,aliassym) \ 85 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); 86 #ifdef __ELF__ 87 #ifdef __STDC__ 88 #define __weak_reference(sym,alias) \ 89 __asm__(".weak " #alias); \ 90 __asm__(".equ " #alias ", " #sym) 91 #define __warn_references(sym,msg) \ 92 __asm__(".section .gnu.warning." #sym); \ 93 __asm__(".asciz \"" msg "\""); \ 94 __asm__(".previous") 95 #else 96 #define __weak_reference(sym,alias) \ 97 __asm__(".weak alias"); \ 98 __asm__(".equ alias, sym") 99 #define __warn_references(sym,msg) \ 100 __asm__(".section .gnu.warning.sym"); \ 101 __asm__(".asciz \"msg\""); \ 102 __asm__(".previous") 103 #endif /* __STDC__ */ 104 #else /* !__ELF__ */ 105 #ifdef __STDC__ 106 #define __weak_reference(sym,alias) \ 107 __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ 108 __asm__(".stabs \"_" #sym "\",1,0,0,0") 109 #define __warn_references(sym,msg) \ 110 __asm__(".stabs \"" msg "\",30,0,0,0"); \ 111 __asm__(".stabs \"_" #sym "\",1,0,0,0") 112 #else 113 #define __weak_reference(sym,alias) \ 114 __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ 115 __asm__(".stabs \"_/**/sym\",1,0,0,0") 116 #define __warn_references(sym,msg) \ 117 __asm__(".stabs msg,30,0,0,0"); \ 118 __asm__(".stabs \"_/**/sym\",1,0,0,0") 119 #endif /* __STDC__ */ 120 #endif /* __ELF__ */ 121 #endif /* __GNUC__ */ 122 123 #endif /* _SYS_CDEFS_H */ 124