cdefs.h revision 1.3 1 /* $NetBSD: cdefs.h,v 1.3 2022/04/03 01:10:58 christos Exp $ */
2
3 /* cdefs.h
4
5 Standard C definitions... */
6
7 /*
8 * Copyright (c) 1995 RadioMail Corporation. All rights reserved.
9 * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC")
10 * Copyright (c) 1996-2003 by Internet Software Consortium
11 *
12 * This Source Code Form is subject to the terms of the Mozilla Public
13 * License, v. 2.0. If a copy of the MPL was not distributed with this
14 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
17 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
19 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
22 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 *
24 * Internet Systems Consortium, Inc.
25 * PO Box 360
26 * Newmarket, NH 03857 USA
27 * <info (at) isc.org>
28 * https://www.isc.org/
29 *
30 * This software was written for RadioMail Corporation by Ted Lemon
31 * under a contract with Vixie Enterprises. Further modifications have
32 * been made for Internet Systems Consortium under a contract
33 * with Vixie Laboratories.
34 */
35
36 #if !defined (__ISC_DHCP_CDEFS_H__)
37 #define __ISC_DHCP_CDEFS_H__
38 /* Delete attributes if not gcc or not the right version of gcc. */
39 #if !defined(__GNUC__) || __GNUC__ < 2 || \
40 (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined (darwin)
41 #define __attribute__(x)
42 #endif
43
44 /* The following macro handles the case of unwanted return values. In
45 * GCC one can specify an attribute for a function to generate a warning
46 * if the return value of the function is ignored and one can't dispose of
47 * the warning by the use of void. In conjunction with the use of -Werror
48 * these warnings prohibit the compilation of the package. This macro
49 * allows us to assign the return value to a variable and then ignore it.
50 *
51 * __attribute__((unused)) is added for avoiding another warning about set,
52 * but unused variable. This is produced by unused-but-set-variable switch
53 * that is enabled by default in gcc 4.6.
54 */
55 #if !defined(__GNUC__) || (__GNUC__ < 4)
56 #define IGNORE_RET(x) (void) x
57 #else
58 #define IGNORE_RET(x) \
59 do { \
60 int __attribute__((unused)) ignore_return ;\
61 ignore_return = x; \
62 } while (0)
63 #endif
64
65 /* This macro is defined to avoid unused-but-set-variable warning
66 * that is enabled in gcc 4.6
67 */
68
69 #define IGNORE_UNUSED(x) { x = x; }
70
71 #endif /* __ISC_DHCP_CDEFS_H__ */
72