Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@574 | 1 | /* |
michael@574 | 2 | ** cdefs.h: ISO C interface |
michael@574 | 3 | ** Most of this file was developed by Sendmail, Incorporated, so: |
michael@574 | 4 | ** |
michael@574 | 5 | ** Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers. |
michael@574 | 6 | ** |
michael@574 | 7 | ** Permission to use, copy, modify, and distribute this software for |
michael@574 | 8 | ** any purpose with or without fee is hereby granted, provided that |
michael@574 | 9 | ** the above copyright notice and this permission notice appear in all |
michael@574 | 10 | ** copies. |
michael@574 | 11 | ** |
michael@574 | 12 | ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@574 | 13 | ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@574 | 14 | ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@574 | 15 | ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@574 | 16 | ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@574 | 17 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@574 | 18 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@574 | 19 | ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@574 | 20 | ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@574 | 21 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@574 | 22 | ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@574 | 23 | ** SUCH DAMAGE. |
michael@574 | 24 | ** |
michael@574 | 25 | */ |
michael@574 | 26 | |
michael@574 | 27 | /* |
michael@574 | 28 | ** BSD and Linux already have <sys/cdefs.h> which defines a set of C |
michael@574 | 29 | ** language portability macros that are a defacto standard in the open |
michael@574 | 30 | ** source community. This file allows for building on platforms lacking |
michael@574 | 31 | ** these definitions. |
michael@574 | 32 | */ |
michael@574 | 33 | #ifndef HOND_CDEFS_H |
michael@574 | 34 | # define HOND_CDEFS_H |
michael@574 | 35 | |
michael@574 | 36 | # if defined(__cplusplus) |
michael@574 | 37 | # define __BEGIN_DECLS extern "C" { |
michael@574 | 38 | # define __END_DECLS }; |
michael@574 | 39 | # else /* defined(__cplusplus) */ |
michael@574 | 40 | # define __BEGIN_DECLS |
michael@574 | 41 | # define __END_DECLS |
michael@574 | 42 | # endif /* defined(__cplusplus) */ |
michael@574 | 43 | # if defined(__STDC__) || defined(__cplusplus) |
michael@574 | 44 | # ifndef __P |
michael@574 | 45 | # define __P(protos) protos |
michael@574 | 46 | # endif /* __P */ |
michael@574 | 47 | # define __CONCAT(x,y) x ## y |
michael@574 | 48 | # define __STRING(x) #x |
michael@574 | 49 | # else /* defined(__STDC__) || defined(__cplusplus) */ |
michael@574 | 50 | # define __P(protos) () |
michael@574 | 51 | # define __CONCAT(x,y) x/**/y |
michael@574 | 52 | # define __STRING(x) "x" |
michael@574 | 53 | # define const |
michael@574 | 54 | # define signed |
michael@574 | 55 | # define volatile |
michael@574 | 56 | # endif /* defined(__STDC__) || defined(__cplusplus) */ |
michael@574 | 57 | |
michael@574 | 58 | /* |
michael@574 | 59 | ** Define HOND_DEAD, a macro used to declare functions that do not return |
michael@574 | 60 | ** to their caller. |
michael@574 | 61 | */ |
michael@574 | 62 | # ifndef HOND_DEAD |
michael@574 | 63 | # if __GNUC__ >= 2 |
michael@574 | 64 | # if __GNUC__ == 2 && __GNUC_MINOR__ < 5 |
michael@574 | 65 | # define HOND_DEAD(proto) volatile proto |
michael@574 | 66 | # else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ |
michael@574 | 67 | # define HOND_DEAD(proto) proto __attribute__((__noreturn__)) |
michael@574 | 68 | # endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ |
michael@574 | 69 | # else /* __GNUC__ >= 2 */ |
michael@574 | 70 | # define HOND_DEAD(proto) proto |
michael@574 | 71 | # endif /* __GNUC__ >= 2 */ |
michael@574 | 72 | # endif /* HOND_DEAD */ |
michael@574 | 73 | |
michael@574 | 74 | /* |
michael@574 | 75 | ** Define HOND_UNUSED, a macro used to declare variables that may be unused. |
michael@574 | 76 | */ |
michael@574 | 77 | # ifndef HOND_UNUSED |
michael@574 | 78 | # if __GNUC__ >= 2 |
michael@574 | 79 | # if __GNUC__ == 2 && __GNUC_MINOR__ < 7 |
michael@574 | 80 | # define HOND_UNUSED(decl) decl |
michael@574 | 81 | # else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */ |
michael@574 | 82 | # define HOND_UNUSED(decl) decl __attribute__((__unused__)) |
michael@574 | 83 | # endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */ |
michael@574 | 84 | # else /* __GNUC__ >= 2 */ |
michael@574 | 85 | # define HOND_UNUSED(decl) decl |
michael@574 | 86 | # endif /* __GNUC__ >= 2 */ |
michael@574 | 87 | # endif /* HOND_UNUSED */ |
michael@574 | 88 | |
michael@574 | 89 | /* |
michael@574 | 90 | ** The HOND_NONVOLATILE macro is used to declare variables that are not |
michael@574 | 91 | ** volatile, but which must be declared volatile when compiling with |
michael@574 | 92 | ** gcc -O -Wall in order to suppress bogus warning messages. |
michael@574 | 93 | ** |
michael@574 | 94 | ** Variables that actually are volatile should be declared volatile |
michael@574 | 95 | ** using the "volatile" keyword. If a variable actually is volatile, |
michael@574 | 96 | ** then HOND_NONVOLATILE should not be used. |
michael@574 | 97 | ** |
michael@574 | 98 | ** To compile source code with gcc and see all non-bogus warnings use: |
michael@574 | 99 | ** |
michael@574 | 100 | ** gcc -O -Wall -DHOND_OMIT_BOGUS_WARNINGS ... |
michael@574 | 101 | ** |
michael@574 | 102 | ** Do not use -DHOND_OMIT_BOGUS_WARNINGS when compiling production |
michael@574 | 103 | ** software, because there is a performance hit. |
michael@574 | 104 | */ |
michael@574 | 105 | # ifdef HOND_OMIT_BOGUS_WARNINGS |
michael@574 | 106 | # define HOND_NONVOLATILE volatile |
michael@574 | 107 | # else /* HOND_OMIT_BOGUS_WARNINGS */ |
michael@574 | 108 | # define HOND_NONVOLATILE |
michael@574 | 109 | # endif /* HOND_OMIT_BOGUS_WARNINGS */ |
michael@574 | 110 | |
michael@574 | 111 | /* |
michael@574 | 112 | ** Turn on format string argument checking. |
michael@574 | 113 | */ |
michael@574 | 114 | # ifndef HOND_CONF_FORMAT_TEST |
michael@574 | 115 | # if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 |
michael@574 | 116 | # define HOND_CONF_FORMAT_TEST 1 |
michael@574 | 117 | # else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */ |
michael@574 | 118 | # define HOND_CONF_FORMAT_TEST 0 |
michael@574 | 119 | # endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */ |
michael@574 | 120 | # endif /* HOND_CONF_FORMAT_TEST */ |
michael@574 | 121 | |
michael@574 | 122 | # ifndef PRINTFLIKE |
michael@574 | 123 | # if HOND_CONF_FORMAT_TEST |
michael@574 | 124 | # define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y))) |
michael@574 | 125 | # else /* HOND_CONF_FORMAT_TEST */ |
michael@574 | 126 | # define PRINTFLIKE(x,y) |
michael@574 | 127 | # endif /* HOND_CONF_FORMAT_TEST */ |
michael@574 | 128 | # endif /* ! PRINTFLIKE */ |
michael@574 | 129 | |
michael@574 | 130 | # ifndef SCANFLIKE |
michael@574 | 131 | # if HOND_CONF_FORMAT_TEST |
michael@574 | 132 | # define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y))) |
michael@574 | 133 | # else /* HOND_CONF_FORMAT_TEST */ |
michael@574 | 134 | # define SCANFLIKE(x,y) |
michael@574 | 135 | # endif /* HOND_CONF_FORMAT_TEST */ |
michael@574 | 136 | # endif /* ! SCANFLIKE */ |
michael@574 | 137 | |
michael@574 | 138 | #endif /* ! HOND_CDEFS_H */ |
michael@574 | 139 |