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