Module Name: src
Committed By: kamil
Date: Wed Feb 13 17:17:02 UTC 2019
Modified Files:
src/common/lib/libc/misc: ubsan.c
Log Message:
Fix kUBSan build with GCC7
Add missing __unreachable() and FALLTHROUGH keywords.
Reported by <Akul Pillai>
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/misc/ubsan.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/misc/ubsan.c
diff -u src/common/lib/libc/misc/ubsan.c:1.4 src/common/lib/libc/misc/ubsan.c:1.5
--- src/common/lib/libc/misc/ubsan.c:1.4 Mon Feb 4 22:07:41 2019
+++ src/common/lib/libc/misc/ubsan.c Wed Feb 13 17:17:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $ */
+/* $NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
#include <sys/cdefs.h>
#if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
#else
-__RCSID("$NetBSD: ubsan.c,v 1.4 2019/02/04 22:07:41 mrg Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.5 2019/02/13 17:17:02 kamil Exp $");
#endif
#if defined(_KERNEL)
@@ -110,7 +110,7 @@ __RCSID("$NetBSD: ubsan.c,v 1.4 2019/02/
#define NUMBER_SIGNED_BIT 1U
-#if __SIZEOF_INT128__
+#ifdef __SIZEOF_INT128__
typedef __int128 longest;
typedef unsigned __int128 ulongest;
#else
@@ -1192,6 +1192,7 @@ Report(bool isFatal, const char *pFormat
}
if (isFatal || ISSET(ubsan_flags, UBSAN_ABORT)) {
abort();
+ __unreachable();
/* NOTREACHED */
}
#endif
@@ -1291,6 +1292,7 @@ DeserializeNumberSigned(char *pBuffer, s
switch (zDeserializeTypeWidth(pType)) {
default:
ASSERT(0 && "Invalid codepath");
+ __unreachable();
/* NOTREACHED */
#ifdef __SIZEOF_INT128__
case WIDTH_128:
@@ -1298,8 +1300,11 @@ DeserializeNumberSigned(char *pBuffer, s
break;
#endif
case WIDTH_64:
+ /* FALLTHROUGH */
case WIDTH_32:
+ /* FALLTHROUGH */
case WIDTH_16:
+ /* FALLTHROUGH */
case WIDTH_8:
snprintf(pBuffer, zBUfferLength, "%" PRId64, STATIC_CAST(int64_t, L));
break;
@@ -1318,6 +1323,7 @@ DeserializeNumberUnsigned(char *pBuffer,
switch (zDeserializeTypeWidth(pType)) {
default:
ASSERT(0 && "Invalid codepath");
+ __unreachable();
/* NOTREACHED */
#ifdef __SIZEOF_INT128__
case WIDTH_128:
@@ -1325,8 +1331,11 @@ DeserializeNumberUnsigned(char *pBuffer,
break;
#endif
case WIDTH_64:
+ /* FALLTHROUGH */
case WIDTH_32:
+ /* FALLTHROUGH */
case WIDTH_16:
+ /* FALLTHROUGH */
case WIDTH_8:
snprintf(pBuffer, zBUfferLength, "%" PRIu64, STATIC_CAST(uint64_t, L));
break;
@@ -1358,7 +1367,9 @@ DeserializeFloatOverPointer(char *pBuffe
switch (zDeserializeTypeWidth(pType)) {
#ifdef __HAVE_LONG_DOUBLE
case WIDTH_128:
+ /* FALLTHROUGH */
case WIDTH_96:
+ /* FALLTHROUGH */
case WIDTH_80:
memcpy(&LD, pNumber, sizeof(long double));
snprintf(pBuffer, zBUfferLength, "%Lg", LD);
@@ -1512,7 +1523,9 @@ DeserializeNumberFloat(char *szLocation,
/* NOTREACHED */
#ifdef __HAVE_LONG_DOUBLE
case WIDTH_128:
+ /* FALLTHROUGH */
case WIDTH_96:
+ /* FALLTHROUGH */
case WIDTH_80:
DeserializeFloatOverPointer(pBuffer, zBUfferLength, pType, REINTERPRET_CAST(unsigned long *, ulNumber));
break;
@@ -1524,6 +1537,7 @@ DeserializeNumberFloat(char *szLocation,
}
/* FALLTHROUGH */
case WIDTH_32:
+ /* FALLTHROUGH */
case WIDTH_16:
DeserializeFloatInlined(pBuffer, zBUfferLength, pType, ulNumber);
break;