honeyd/cdefs.h

changeset 574
1074e5934dd9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/honeyd/cdefs.h	Tue Aug 28 18:35:30 2012 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +/*
     1.5 +** cdefs.h: ISO C interface
     1.6 +** Most of this file was developed by Sendmail, Incorporated, so:
     1.7 +**
     1.8 +** Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
     1.9 +**
    1.10 +** Permission to use, copy, modify, and distribute this software for
    1.11 +** any purpose with or without fee is hereby granted, provided that
    1.12 +** the above copyright notice and this permission notice appear in all
    1.13 +** copies.
    1.14 +**
    1.15 +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.16 +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.17 +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.18 +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.19 +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.20 +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.21 +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.22 +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.23 +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.24 +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.25 +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.26 +** SUCH DAMAGE.
    1.27 +**
    1.28 +*/
    1.29 +
    1.30 +/*
    1.31 +**  BSD and Linux already have <sys/cdefs.h> which defines a set of C
    1.32 +**  language portability macros that are a defacto standard in the open
    1.33 +**  source community. This file allows for building on platforms lacking
    1.34 +**  these definitions.
    1.35 +*/
    1.36 +#ifndef HOND_CDEFS_H
    1.37 +# define HOND_CDEFS_H
    1.38 +
    1.39 +# if defined(__cplusplus)
    1.40 +#  define    __BEGIN_DECLS    extern "C" {
    1.41 +#  define    __END_DECLS    };
    1.42 +# else /* defined(__cplusplus) */
    1.43 +#  define    __BEGIN_DECLS
    1.44 +#  define    __END_DECLS
    1.45 +# endif /* defined(__cplusplus) */
    1.46 +# if defined(__STDC__) || defined(__cplusplus)
    1.47 +#  ifndef __P
    1.48 +#   define    __P(protos)    protos
    1.49 +#  endif /* __P */
    1.50 +#  define    __CONCAT(x,y)    x ## y
    1.51 +#  define    __STRING(x)    #x
    1.52 +# else /* defined(__STDC__) || defined(__cplusplus) */
    1.53 +#  define    __P(protos)    ()
    1.54 +#  define    __CONCAT(x,y)    x/**/y
    1.55 +#  define    __STRING(x)    "x"
    1.56 +#  define    const
    1.57 +#  define    signed
    1.58 +#  define    volatile
    1.59 +# endif /* defined(__STDC__) || defined(__cplusplus) */
    1.60 +
    1.61 +/*
    1.62 +**  Define HOND_DEAD, a macro used to declare functions that do not return
    1.63 +**  to their caller.
    1.64 +*/
    1.65 +# ifndef HOND_DEAD
    1.66 +#  if __GNUC__ >= 2
    1.67 +#   if __GNUC__ == 2 && __GNUC_MINOR__ < 5
    1.68 +#    define HOND_DEAD(proto) volatile proto
    1.69 +#   else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
    1.70 +#    define HOND_DEAD(proto) proto __attribute__((__noreturn__))
    1.71 +#   endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */
    1.72 +#  else /* __GNUC__ >= 2 */
    1.73 +#   define HOND_DEAD(proto) proto
    1.74 +#  endif /* __GNUC__ >= 2 */
    1.75 +# endif /* HOND_DEAD */
    1.76 +
    1.77 +/*
    1.78 +**  Define HOND_UNUSED, a macro used to declare variables that may be unused.
    1.79 +*/
    1.80 +# ifndef HOND_UNUSED
    1.81 +#  if __GNUC__ >= 2
    1.82 +#   if __GNUC__ == 2 && __GNUC_MINOR__ < 7
    1.83 +#    define HOND_UNUSED(decl) decl
    1.84 +#   else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
    1.85 +#    define HOND_UNUSED(decl) decl __attribute__((__unused__))
    1.86 +#   endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */
    1.87 +#  else /* __GNUC__ >= 2 */
    1.88 +#   define HOND_UNUSED(decl) decl
    1.89 +#  endif /* __GNUC__ >= 2 */
    1.90 +# endif /* HOND_UNUSED */
    1.91 +
    1.92 +/*
    1.93 +**  The HOND_NONVOLATILE macro is used to declare variables that are not
    1.94 +**  volatile, but which must be declared volatile when compiling with
    1.95 +**  gcc -O -Wall in order to suppress bogus warning messages.
    1.96 +**
    1.97 +**  Variables that actually are volatile should be declared volatile
    1.98 +**  using the "volatile" keyword.  If a variable actually is volatile,
    1.99 +**  then HOND_NONVOLATILE should not be used.
   1.100 +**
   1.101 +**  To compile source code with gcc and see all non-bogus warnings use:
   1.102 +**
   1.103 +**      gcc -O -Wall -DHOND_OMIT_BOGUS_WARNINGS ...
   1.104 +**
   1.105 +**  Do not use -DHOND_OMIT_BOGUS_WARNINGS when compiling production
   1.106 +**  software, because there is a performance hit.
   1.107 +*/
   1.108 +# ifdef HOND_OMIT_BOGUS_WARNINGS
   1.109 +#  define HOND_NONVOLATILE volatile
   1.110 +# else /* HOND_OMIT_BOGUS_WARNINGS */
   1.111 +#  define HOND_NONVOLATILE
   1.112 +# endif /* HOND_OMIT_BOGUS_WARNINGS */
   1.113 +
   1.114 +/*
   1.115 +**  Turn on format string argument checking.
   1.116 +*/
   1.117 +# ifndef HOND_CONF_FORMAT_TEST
   1.118 +#  if __GNUC__ == 2 && __GNUC_MINOR__ >= 7
   1.119 +#   define HOND_CONF_FORMAT_TEST    1
   1.120 +#  else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
   1.121 +#   define HOND_CONF_FORMAT_TEST    0
   1.122 +#  endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */
   1.123 +# endif /* HOND_CONF_FORMAT_TEST */
   1.124 +
   1.125 +# ifndef PRINTFLIKE
   1.126 +#  if HOND_CONF_FORMAT_TEST
   1.127 +#   define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
   1.128 +#  else /* HOND_CONF_FORMAT_TEST */
   1.129 +#   define PRINTFLIKE(x,y)
   1.130 +#  endif /* HOND_CONF_FORMAT_TEST */
   1.131 +# endif /* ! PRINTFLIKE */
   1.132 +
   1.133 +# ifndef SCANFLIKE
   1.134 +#  if HOND_CONF_FORMAT_TEST
   1.135 +#   define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y)))
   1.136 +#  else /* HOND_CONF_FORMAT_TEST */
   1.137 +#   define SCANFLIKE(x,y)
   1.138 +#  endif /* HOND_CONF_FORMAT_TEST */
   1.139 +# endif /* ! SCANFLIKE */
   1.140 +
   1.141 +#endif /* ! HOND_CDEFS_H */
   1.142 +

mercurial