Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/asm Define DRMCTASSERT() for C...



details:   https://anonhg.NetBSD.org/src/rev/4d480f90b4d9
branches:  trunk
changeset: 459656:4d480f90b4d9
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Sep 20 12:40:23 2019 +0000

description:
Define DRMCTASSERT() for Compile-Time DRMKMS asserts

Switch CTASSERT() to DRMCTASSERT() in BUILD_BUG_ON().

This fixes build issues with disabled compieler optimization.

diffstat:

 sys/external/bsd/drm2/include/asm/bug.h |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (39 lines):

diff -r b8eba70191ee -r 4d480f90b4d9 sys/external/bsd/drm2/include/asm/bug.h
--- a/sys/external/bsd/drm2/include/asm/bug.h   Fri Sep 20 11:29:47 2019 +0000
+++ b/sys/external/bsd/drm2/include/asm/bug.h   Fri Sep 20 12:40:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bug.h,v 1.5 2019/09/20 10:54:07 kamil Exp $    */
+/*     $NetBSD: bug.h,v 1.6 2019/09/20 12:40:23 kamil Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,19 +35,20 @@
 #include <sys/cdefs.h>
 #include <sys/systm.h>
 
+/*
+ * static_assert is violated with runtime-only compiler semantics in a few
+ * places. Instead of breaking the build, stop asserting these corner cases.
+ */
+
+#define DRMCTASSERT(x) CTASSERT((__builtin_choose_expr(                \
+                       __builtin_constant_p(x), (x), 1)))
+
 #define        BUG()                   panic("%s:%d: BUG!", __FILE__, __LINE__)
 #define        BUG_ON(CONDITION)       KASSERT(!(CONDITION))
 
 #define        BUILD_BUG()             do {} while (0)
-#define        BUILD_BUG_ON(CONDITION) 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)))
-
+#define        BUILD_BUG_ON(CONDITION) DRMCTASSERT(!(CONDITION))
+#define        BUILD_BUG_ON_MSG(CONDITION,MSG) DRMCTASSERT(!(CONDITION))
 
 /* XXX Rate limit?  */
 #define WARN(CONDITION, FMT, ...)                                      \



Home | Main Index | Thread Index | Old Index