[Midnightbsd-cvs] src [10986] trunk/include/assert.h: add static assert
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Jun 15 16:36:11 EDT 2018
Revision: 10986
http://svnweb.midnightbsd.org/src/?rev=10986
Author: laffer1
Date: 2018-06-15 16:36:10 -0400 (Fri, 15 Jun 2018)
Log Message:
-----------
add static assert
Modified Paths:
--------------
trunk/include/assert.h
Modified: trunk/include/assert.h
===================================================================
--- trunk/include/assert.h 2018-06-15 20:35:57 UTC (rev 10985)
+++ trunk/include/assert.h 2018-06-15 20:36:10 UTC (rev 10986)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)assert.h 8.2 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/include/assert.h 228955 2011-12-29 14:41:17Z ed $
*/
#include <sys/cdefs.h>
@@ -57,7 +58,22 @@
#ifndef _ASSERT_H_
#define _ASSERT_H_
+
+/*
+ * Static assertions. In principle we could define static_assert for
+ * C++ older than C++11, but this breaks if _Static_assert is
+ * implemented as a macro.
+ *
+ * C++ template parameters may contain commas, even if not enclosed in
+ * parentheses, causing the _Static_assert macro to be invoked with more
+ * than two parameters.
+ */
+#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus)
+#define static_assert _Static_assert
+#endif
+
__BEGIN_DECLS
void __assert(const char *, const char *, int, const char *) __dead2;
__END_DECLS
+
#endif /* !_ASSERT_H_ */
More information about the Midnightbsd-cvs
mailing list