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