From ad8d7e39d84712cefdc422598518ea1707a18d57 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Wed, 9 Feb 2022 09:07:54 -0800 Subject: Clean up some compiler warnings NOLINT was on the wrong line of code in remote_provisioning_utils.h C++14 does not appear to be fully supported everywhere that android_keymaster_messages.h is included, which results in build spam around the C++14 use of a constexpr function. Remove constexpr for now and just rely on the compiler to do the optimization. Test: keymaster_tests Change-Id: Id9db41700fbb796c823b90f686cc60095c6adc39 --- android_keymaster/android_keymaster.cpp | 2 +- include/keymaster/android_keymaster.h | 4 ++-- include/keymaster/android_keymaster_messages.h | 2 +- include/keymaster/remote_provisioning_utils.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android_keymaster/android_keymaster.cpp b/android_keymaster/android_keymaster.cpp index 3a721d0..14fc367 100644 --- a/android_keymaster/android_keymaster.cpp +++ b/android_keymaster/android_keymaster.cpp @@ -131,7 +131,7 @@ constexpr int kP256AffinePointSize = 32; } // anonymous namespace AndroidKeymaster::AndroidKeymaster(KeymasterContext* context, size_t operation_table_size, - uint32_t message_version) + int32_t message_version) : context_(context), operation_table_(new (std::nothrow) OperationTable(operation_table_size)), message_version_(message_version) {} diff --git a/include/keymaster/android_keymaster.h b/include/keymaster/android_keymaster.h index bbeb81a..c463e68 100644 --- a/include/keymaster/android_keymaster.h +++ b/include/keymaster/android_keymaster.h @@ -47,7 +47,7 @@ class OperationTable; class AndroidKeymaster { public: AndroidKeymaster(KeymasterContext* context, size_t operation_table_size, - uint32_t message_version = kDefaultMessageVersion); + int32_t message_version = kDefaultMessageVersion); virtual ~AndroidKeymaster(); AndroidKeymaster(AndroidKeymaster&&); @@ -103,7 +103,7 @@ class AndroidKeymaster { // Returns the message version negotiated in GetVersion2. All response messages should have // this passed to their constructors. This is done automatically for the methods that return a // response by value. The caller must do it for the methods that take a response pointer. - uint32_t message_version() const { return message_version_; } + int32_t message_version() const { return message_version_; } private: // Loads the KM key from `key_blob`, getting app ID and app data from `additional_params`, if diff --git a/include/keymaster/android_keymaster_messages.h b/include/keymaster/android_keymaster_messages.h index 2d21a62..de674b8 100644 --- a/include/keymaster/android_keymaster_messages.h +++ b/include/keymaster/android_keymaster_messages.h @@ -112,7 +112,7 @@ constexpr int32_t kDefaultMessageVersion = 3; * date in YYYYMMDD format (it's not recommended to change message formats within a KM version, but * it could happen). */ -inline constexpr int32_t MessageVersion(KmVersion version, uint32_t /* km_date */ = 0) { +inline int32_t MessageVersion(KmVersion version, uint32_t /* km_date */ = 0) { switch (version) { case KmVersion::KEYMASTER_1: return 1; diff --git a/include/keymaster/remote_provisioning_utils.h b/include/keymaster/remote_provisioning_utils.h index 76acdc7..9fc0d2e 100644 --- a/include/keymaster/remote_provisioning_utils.h +++ b/include/keymaster/remote_provisioning_utils.h @@ -35,8 +35,8 @@ template class StatusOr { public: StatusOr(int32_t status_code) // NOLINT(google-explicit-constructor) : status_code_(status_code) {} - StatusOr(T val) - : status_code_(0), value_(std::move(val)) {} // NOLINT(google-explicit-constructor) + StatusOr(T val) // NOLINT(google-explicit-constructor) + : status_code_(0), value_(std::move(val)) {} bool isOk() { return status_code_ == 0; } -- cgit v1.2.3