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