Implement CTASSERT using _Static_assert

Prevents warnings about "unused typedef" with GCC-6

Reported by:	GCC-6
MFC after:	18 days
X-MFC-With:	329722
This commit is contained in:
Alan Somers 2018-02-24 16:01:21 +00:00
parent b8f7774edf
commit 92bd443160
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329910

View File

@ -133,8 +133,8 @@ _NOTE(CONSTCOND) } while (0)
#ifndef CTASSERT
#define CTASSERT(x) _CTASSERT(x, __LINE__)
#define _CTASSERT(x, y) __CTASSERT(x, y)
#define __CTASSERT(x, y) \
typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1]
#define __CTASSERT(x, y) \
_Static_assert((x), "Static assert failed at " #y)
#endif
#ifdef _KERNEL