1 /* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)cdefs.h 8.1 (Berkeley) 06/02/93 8 */ 9 10 #ifndef _CDEFS_H_ 11 #define _CDEFS_H_ 12 13 #if defined(__cplusplus) 14 #define __BEGIN_DECLS extern "C" { 15 #define __END_DECLS }; 16 #else 17 #define __BEGIN_DECLS 18 #define __END_DECLS 19 #endif 20 21 /* 22 * The __CONCAT macro is used to concatenate parts of symbol names, e.g. 23 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. 24 * The __CONCAT macro is a bit tricky -- make sure you don't put spaces 25 * in between its arguments. __CONCAT can also concatenate double-quoted 26 * strings produced by the __STRING macro, but this only works with ANSI C. 27 */ 28 #if defined(__STDC__) || defined(__cplusplus) 29 #define __P(protos) protos /* full-blown ANSI C */ 30 #define __CONCAT(x,y) x ## y 31 #define __STRING(x) #x 32 33 #else /* !(__STDC__ || __cplusplus) */ 34 #define __P(protos) () /* traditional C preprocessor */ 35 #define __CONCAT(x,y) x/**/y 36 #define __STRING(x) "x" 37 38 #ifdef __GNUC__ 39 #define const __const /* GCC: ANSI C with -traditional */ 40 #define inline __inline 41 #define signed __signed 42 #define volatile __volatile 43 44 #else /* !__GNUC__ */ 45 #define const /* delete ANSI C keywords */ 46 #define inline 47 #define signed 48 #define volatile 49 #endif /* !__GNUC__ */ 50 #endif /* !(__STDC__ || __cplusplus) */ 51 52 /* 53 * GCC has extensions for declaring functions as `pure' (always returns 54 * the same value given the same inputs, i.e., has no external state and 55 * no side effects) and `dead' (nonreturning). These mainly affect 56 * optimization and warnings. Unfortunately, GCC complains if these are 57 * used under strict ANSI mode (`gcc -ansi -pedantic'), hence we need to 58 * define them only if compiling without this. 59 */ 60 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 61 #define __dead __volatile 62 #define __pure __const 63 #else 64 #define __dead 65 #define __pure 66 #endif 67 68 #endif /* !_CDEFS_H_ */ 69