1244557Sbrooks/* $FreeBSD: releng/11.0/lib/libnetbsd/sys/cdefs.h 273482 2014-10-22 21:04:54Z ngie $ */ 2244557Sbrooks 3244557Sbrooks/*- 4244557Sbrooks * Copyright (c) 2012 SRI International 5244557Sbrooks * Copyright (c) 1992, 1993 6244557Sbrooks * The Regents of the University of California. All rights reserved. 7244557Sbrooks * 8244557Sbrooks * Redistribution and use in source and binary forms, with or without 9244557Sbrooks * modification, are permitted provided that the following conditions 10244557Sbrooks * are met: 11244557Sbrooks * 1. Redistributions of source code must retain the above copyright 12244557Sbrooks * notice, this list of conditions and the following disclaimer. 13244557Sbrooks * 2. Redistributions in binary form must reproduce the above copyright 14244557Sbrooks * notice, this list of conditions and the following disclaimer in the 15244557Sbrooks * documentation and/or other materials provided with the distribution. 16244557Sbrooks * 3. Neither the name of the University nor the names of its contributors 17244557Sbrooks * may be used to endorse or promote products derived from this software 18244557Sbrooks * without specific prior written permission. 19244557Sbrooks * 20244557Sbrooks * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21244557Sbrooks * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22244557Sbrooks * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23244557Sbrooks * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24244557Sbrooks * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25244557Sbrooks * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26244557Sbrooks * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27244557Sbrooks * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28244557Sbrooks * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29244557Sbrooks * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30244557Sbrooks * SUCH DAMAGE. 31244557Sbrooks */ 32244557Sbrooks 33244557Sbrooks#ifndef _LIBNETBSD_SYS_CDEFS_H_ 34244557Sbrooks#define _LIBNETBSD_SYS_CDEFS_H_ 35244557Sbrooks 36244557Sbrooks#include_next <sys/cdefs.h> 37244557Sbrooks 38244557Sbrooks#ifdef __dead2 39244557Sbrooks#define __dead __dead2 40244557Sbrooks#else 41244557Sbrooks#define __dead 42244557Sbrooks#endif 43244557Sbrooks 44244557Sbrooks/* 45273482Sngie * The __CONCAT macro is used to concatenate parts of symbol names, e.g. 46273482Sngie * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. 47273482Sngie * The __CONCAT macro is a bit tricky -- make sure you don't put spaces 48273482Sngie * in between its arguments. __CONCAT can also concatenate double-quoted 49273482Sngie * strings produced by the __STRING macro, but this only works with ANSI C. 50273482Sngie */ 51273482Sngie 52273482Sngie#define ___STRING(x) __STRING(x) 53273482Sngie#define ___CONCAT(x,y) __CONCAT(x,y) 54273482Sngie 55273482Sngie/* 56273482Sngie * The following macro is used to remove const cast-away warnings 57273482Sngie * from gcc -Wcast-qual; it should be used with caution because it 58273482Sngie * can hide valid errors; in particular most valid uses are in 59273482Sngie * situations where the API requires it, not to cast away string 60273482Sngie * constants. We don't use *intptr_t on purpose here and we are 61273482Sngie * explicit about unsigned long so that we don't have additional 62273482Sngie * dependencies. 63273482Sngie */ 64273482Sngie#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) 65273482Sngie 66273482Sngie/* 67244557Sbrooks * Return the number of elements in a statically-allocated array, 68244557Sbrooks * __x. 69244557Sbrooks */ 70244557Sbrooks#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) 71244557Sbrooks 72244557Sbrooks#endif /* _LIBNETBSD_SYS_CDEFS_H_ */ 73