00001 /* 00002 * Copyright (c) 1991, 1993 00003 * The Regents of the University of California. All rights reserved. 00004 * 00005 * By using this file, you agree to the terms and conditions set 00006 * forth in the LICENSE file which can be found at the top level of 00007 * the sendmail distribution. 00008 * 00009 * $Id$ 00010 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 00011 */ 00012 00013 #ifndef _CDEFS_H_ 00014 # define _CDEFS_H_ 00015 00016 # if defined(__cplusplus) 00017 # define __BEGIN_DECLS extern "C" { 00018 # define __END_DECLS }; 00019 # else /* defined(__cplusplus) */ 00020 # define __BEGIN_DECLS 00021 # define __END_DECLS 00022 # endif /* defined(__cplusplus) */ 00023 00024 /* 00025 * The __CONCAT macro is used to concatenate parts of symbol names, e.g. 00026 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. 00027 * The __CONCAT macro is a bit tricky -- make sure you don't put spaces 00028 * in between its arguments. __CONCAT can also concatenate double-quoted 00029 * strings produced by the __STRING macro, but this only works with ANSI C. 00030 */ 00031 # if defined(__STDC__) || defined(__cplusplus) 00032 # define __P(protos) protos /* full-blown ANSI C */ 00033 # ifndef __CONCAT 00034 # define __CONCAT(x,y) x ## y 00035 # endif /* ! __CONCAT */ 00036 # define __STRING(x) #x 00037 00038 # ifndef __const 00039 # define __const const /* define reserved names to standard */ 00040 # endif /* ! __const */ 00041 # define __signed signed 00042 # define __volatile volatile 00043 # if defined(__cplusplus) 00044 # define __inline inline /* convert to C++ keyword */ 00045 # else /* defined(__cplusplus) */ 00046 # ifndef __GNUC__ 00047 # define __inline /* delete GCC keyword */ 00048 # endif /* ! __GNUC__ */ 00049 # endif /* defined(__cplusplus) */ 00050 00051 # else /* defined(__STDC__) || defined(__cplusplus) */ 00052 # define __P(protos) () /* traditional C preprocessor */ 00053 # ifndef __CONCAT 00054 # define __CONCAT(x,y) x/**/y 00055 # endif /* ! __CONCAT */ 00056 # define __STRING(x) "x" 00057 00058 # ifndef __GNUC__ 00059 # define __const /* delete pseudo-ANSI C keywords */ 00060 # define __inline 00061 # define __signed 00062 # define __volatile 00063 /* 00064 * In non-ANSI C environments, new programs will want ANSI-only C keywords 00065 * deleted from the program and old programs will want them left alone. 00066 * When using a compiler other than gcc, programs using the ANSI C keywords 00067 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. 00068 * When using "gcc -traditional", we assume that this is the intent; if 00069 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. 00070 */ 00071 # ifndef NO_ANSI_KEYWORDS 00072 # define const /* delete ANSI C keywords */ 00073 # define inline 00074 # define signed 00075 # define volatile 00076 # endif /* ! NO_ANSI_KEYWORDS */ 00077 # endif /* ! __GNUC__ */ 00078 # endif /* defined(__STDC__) || defined(__cplusplus) */ 00079 00080 /* 00081 * GCC1 and some versions of GCC2 declare dead (non-returning) and 00082 * pure (no side effects) functions using "volatile" and "const"; 00083 * unfortunately, these then cause warnings under "-ansi -pedantic". 00084 * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of 00085 * these work for GNU C++ (modulo a slight glitch in the C++ grammar 00086 * in the distribution version of 2.5.5). 00087 */ 00088 # if !defined(__GNUC__) || __GNUC__ < 2 || \ 00089 (__GNUC__ == 2 && __GNUC_MINOR__ < 5) 00090 # define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ 00091 # if defined(__GNUC__) && !defined(__STRICT_ANSI__) 00092 # define __dead __volatile 00093 # define __pure __const 00094 # endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */ 00095 # endif /* !defined(__GNUC__) || __GNUC__ < 2 || \ */ 00096 00097 /* Delete pseudo-keywords wherever they are not available or needed. */ 00098 # ifndef __dead 00099 # define __dead 00100 # define __pure 00101 # endif /* ! __dead */ 00102 00103 #endif /* ! _CDEFS_H_ */