xref: /dflybsd-src/sys/dev/drm/include/linux/bug.h (revision d3bbf4bc0ba0f0e0146b9d5f49c09de05151074f)
10effaaacSFrançois Tigeot /*
20effaaacSFrançois Tigeot  * Copyright (c) 2015 François Tigeot
30effaaacSFrançois Tigeot  * All rights reserved.
40effaaacSFrançois Tigeot  *
50effaaacSFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
60effaaacSFrançois Tigeot  * modification, are permitted provided that the following conditions
70effaaacSFrançois Tigeot  * are met:
80effaaacSFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
90effaaacSFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
100effaaacSFrançois Tigeot  *    disclaimer.
110effaaacSFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
120effaaacSFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
130effaaacSFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
140effaaacSFrançois Tigeot  *
150effaaacSFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
160effaaacSFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
170effaaacSFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
180effaaacSFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
190effaaacSFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
200effaaacSFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
210effaaacSFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
220effaaacSFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
230effaaacSFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
240effaaacSFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
250effaaacSFrançois Tigeot  */
260effaaacSFrançois Tigeot 
270effaaacSFrançois Tigeot #ifndef LINUX_BUG_H
280effaaacSFrançois Tigeot #define LINUX_BUG_H
290effaaacSFrançois Tigeot 
300effaaacSFrançois Tigeot #include <sys/cdefs.h>
310effaaacSFrançois Tigeot 
320effaaacSFrançois Tigeot #define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
330effaaacSFrançois Tigeot 
34b61dea7fSFrançois Tigeot #define	BUILD_BUG_ON_NOT_POWER_OF_2(n)			      \
35b61dea7fSFrançois Tigeot 	CTASSERT(((n) != 0) && (((n) & ((n) - 1)) == 0))
36b61dea7fSFrançois Tigeot 
37*d3bbf4bcSFrançois Tigeot #define BUILD_BUG()	BUILD_BUG_ON(1)
38*d3bbf4bcSFrançois Tigeot 
390effaaacSFrançois Tigeot #endif /* LINUX_BUG_H */
40