xref: /minix/external/bsd/dhcp/dist/includes/cdefs.h (revision fb9c64b2)
1 /*	$NetBSD: cdefs.h,v 1.1.1.3 2014/07/12 11:57:52 spz Exp $	*/
2 /* cdefs.h
3 
4    Standard C definitions... */
5 
6 /*
7  * Copyright (c) 1995 RadioMail Corporation.  All rights reserved.
8  * Copyright (c) 2011,2012 by Internet Systems Consortium, Inc. ("ISC")
9  * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
10  * Copyright (c) 1996-2003 by Internet Software Consortium
11  *
12  * Permission to use, copy, modify, and distribute this software for any
13  * purpose with or without fee is hereby granted, provided that the above
14  * copyright notice and this permission notice appear in all copies.
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  *   950 Charter Street
26  *   Redwood City, CA 94063
27  *   <info@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