Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Add __unreachable(), which can be used to mark dead ...



details:   https://anonhg.NetBSD.org/src/rev/a2365a267fad
branches:  trunk
changeset: 331332:a2365a267fad
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Aug 08 19:43:49 2014 +0000

description:
Add __unreachable(), which can be used to mark dead branches when the
compiler can't tell side effects.

diffstat:

 sys/sys/cdefs.h |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r abe3d6f8d07a -r a2365a267fad sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Fri Aug 08 19:38:47 2014 +0000
+++ b/sys/sys/cdefs.h   Fri Aug 08 19:43:49 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.120 2014/07/14 18:50:22 plunky Exp $       */
+/*     $NetBSD: cdefs.h,v 1.121 2014/08/08 19:43:49 joerg Exp $        */
 
 /* * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -296,6 +296,12 @@
 #define        __noprofile     /* nothing */
 #endif
 
+#if __GNUC_PREREQ__(4, 6) || defined(__clang__)
+#define        __unreachable() __builtin_unreachable()
+#else
+#define        __unreachable() do {} while (0)
+#endif
+
 #if defined(__cplusplus)
 #define        __BEGIN_EXTERN_C        extern "C" {
 #define        __END_EXTERN_C          }



Home | Main Index | Thread Index | Old Index