Module Name:    src
Committed By:   kamil
Date:           Fri Sep 20 10:54:07 UTC 2019

Modified Files:
        src/sys/external/bsd/drm2/include/asm: bug.h

Log Message:
Adapt DRMKMS BUILD_BUG_ON_MSG() to static_assert semantics

static_assert is violated with runtime-only compiler semantics in a few
places. Instead of breaking the build, stop asserting these corner cases.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/asm/bug.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.4 src/sys/external/bsd/drm2/include/asm/bug.h:1.5
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.4	Mon Aug 27 06:19:16 2018
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Fri Sep 20 10:54:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.4 2018/08/27 06:19:16 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.5 2019/09/20 10:54:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,7 +40,13 @@
 
 #define	BUILD_BUG()		do {} while (0)
 #define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
-#define	BUILD_BUG_ON_MSG(CONDITION,MSG)	CTASSERT(!(CONDITION))
+/*
+ * static_assert is violated with runtime-only compiler semantics in a few
+ * places. Instead of breaking the build, stop asserting these corner cases.
+ */
+#define	BUILD_BUG_ON_MSG(CONDITION,MSG)					\
+	CTASSERT((__builtin_choose_expr(				\
+		__builtin_constant_p(CONDITION), !(CONDITION), 1)))
 
 
 /* XXX Rate limit?  */

Reply via email to