xref: /dflybsd-src/sys/dev/drm/include/linux/bug.h (revision 19c468b4dff0c9c2ceaa37f7e1e4cec69674b238)
10effaaacSFrançois Tigeot /*
2*19c468b4SFrançois Tigeot  * Copyright (c) 2015-2016 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 
32*19c468b4SFrançois Tigeot #include <asm/bug.h>
33*19c468b4SFrançois Tigeot #include <linux/compiler.h>
34*19c468b4SFrançois Tigeot 
350effaaacSFrançois Tigeot #define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
360effaaacSFrançois Tigeot 
37b61dea7fSFrançois Tigeot #define	BUILD_BUG_ON_NOT_POWER_OF_2(n)			      \
38b61dea7fSFrançois Tigeot 	CTASSERT(((n) != 0) && (((n) & ((n) - 1)) == 0))
39b61dea7fSFrançois Tigeot 
40d3bbf4bcSFrançois Tigeot #define BUILD_BUG()	BUILD_BUG_ON(1)
41d3bbf4bcSFrançois Tigeot 
421219e912SFrançois Tigeot #define BUILD_BUG_ON_MSG(cond, msg)
431219e912SFrançois Tigeot 
440effaaacSFrançois Tigeot #endif /* LINUX_BUG_H */
45