summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakuto Ikuta <tikuta@google.com>2018-10-17 17:37:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-17 17:37:41 +0000
commit785a26dc649af80c593f899a606dff4dae7c48fd (patch)
treedf97b59c4e4583d0a0ce73663fbe830bdaa0779d
parentd4b59aed2e03944cdcd3a8ecd6ab26573d709f76 (diff)
downloadpdfium-785a26dc649af80c593f899a606dff4dae7c48fd.tar.xz
Do not do null pointer arithmeticchromium/3584
Let me introduce builtin function instead. This is a preparation CL to remove -Wno-null-pointer-arithmetic warning suppression. Bug: chromium:766891 Change-Id: I05434ba0c525fd2fddf916c042d1443b1f25d7d7 Reviewed-on: https://pdfium-review.googlesource.com/c/44191 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--third_party/base/logging.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/third_party/base/logging.h b/third_party/base/logging.h
index 2aeca31b85..76555f563e 100644
--- a/third_party/base/logging.h
+++ b/third_party/base/logging.h
@@ -9,16 +9,15 @@
#include <stdlib.h>
#ifndef _WIN32
-#define NULL_DEREF_IF_POSSIBLE \
- *(reinterpret_cast<volatile char*>(NULL) + 42) = 0x42;
+#define NULL_DEREF_IF_POSSIBLE __builtin_unreachable()
#else
-#define NULL_DEREF_IF_POSSIBLE
+#define NULL_DEREF_IF_POSSIBLE __assume(0)
#endif
#define CHECK(condition) \
if (!(condition)) { \
abort(); \
- NULL_DEREF_IF_POSSIBLE \
+ NULL_DEREF_IF_POSSIBLE;\
}
// TODO(palmer): These are quick hacks to import PartitionAlloc with minimum