aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2024-03-21 20:01:46 +0900
committerYi Kong <yikong@google.com>2024-03-21 22:22:59 +0900
commite7907fb9082f1d8ba17c2764036f184d7008f168 (patch)
tree4b23021b4f1342c8fc736c9b6ab1d7b5c05ee9c8
parent39a9a62d1517f75b9dc4ea695d6a6640a574ab54 (diff)
downloadlibese-e7907fb9082f1d8ba17c2764036f184d7008f168.tar.gz
Fix build with clang-r522817
clang-r522817 no longer allows implicit cast from (void *) 0 to arbitrary pointers. Change the macro to nullptr in C++ mode. Test: presubmit Bug: 322868540 Change-Id: I779993fb43d15534f59a14b9776ba6ac31fde329
-rw-r--r--apps/boot/tests/ese_operations_wrapper.cpp3
-rw-r--r--libese-sysdeps/include/ese/sysdeps.h4
-rw-r--r--libese-teq1/tests/ese_operations_wrapper.cpp3
3 files changed, 6 insertions, 4 deletions
diff --git a/apps/boot/tests/ese_operations_wrapper.cpp b/apps/boot/tests/ese_operations_wrapper.cpp
index cbf1bd5..d6f0d34 100644
--- a/apps/boot/tests/ese_operations_wrapper.cpp
+++ b/apps/boot/tests/ese_operations_wrapper.cpp
@@ -56,8 +56,7 @@ static void EseClose(struct EseInterface *ese) {
return EseOperationsWrapperData::ops_interface->EseClose(ese);
}
-EseOperationsInterface *EseOperationsWrapperData::ops_interface =
- reinterpret_cast<EseOperationsInterface *>(NULL);
+EseOperationsInterface *EseOperationsWrapperData::ops_interface = NULL;
static const char *kErrors[] = {};
const struct EseOperations EseOperationsWrapperData::ops = {
diff --git a/libese-sysdeps/include/ese/sysdeps.h b/libese-sysdeps/include/ese/sysdeps.h
index 7d20e01..2a5f479 100644
--- a/libese-sysdeps/include/ese/sysdeps.h
+++ b/libese-sysdeps/include/ese/sysdeps.h
@@ -22,8 +22,12 @@
#define ESE_UINT32_MAX (UINT32_MAX)
#ifndef NULL
+#ifdef __cplusplus
+#define NULL nullptr
+#else
#define NULL ((void *)(0))
#endif
+#endif
/* Set visibility for exported functions. */
#ifndef ESE_API
diff --git a/libese-teq1/tests/ese_operations_wrapper.cpp b/libese-teq1/tests/ese_operations_wrapper.cpp
index fc3e65b..9d403d9 100644
--- a/libese-teq1/tests/ese_operations_wrapper.cpp
+++ b/libese-teq1/tests/ese_operations_wrapper.cpp
@@ -57,8 +57,7 @@ static void EseClose(struct EseInterface *ese) {
return EseOperationsWrapperData::ops_interface->EseClose(ese);
}
-EseOperationsInterface *EseOperationsWrapperData::ops_interface =
- reinterpret_cast<EseOperationsInterface *>(NULL);
+EseOperationsInterface *EseOperationsWrapperData::ops_interface = NULL;
static const char *kErrors[] = {
TEQ1_ERROR_MESSAGES,