Merge "libnativehelper: minor C++ modernization"
diff --git a/header_only_include/nativehelper/nativehelper_utils.h b/header_only_include/nativehelper/nativehelper_utils.h
index da0c647..d7289f9 100644
--- a/header_only_include/nativehelper/nativehelper_utils.h
+++ b/header_only_include/nativehelper/nativehelper_utils.h
@@ -22,15 +22,9 @@
 #if !defined(DISALLOW_COPY_AND_ASSIGN)
 // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. It goes in the private:
 // declarations in a class.
-#if __cplusplus >= 201103L
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
   TypeName(const TypeName&) = delete;  \
   void operator=(const TypeName&) = delete
-#else
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&);  \
-  void operator=(const TypeName&)
-#endif  // __has_feature(cxx_deleted_functions)
 #endif  // !defined(DISALLOW_COPY_AND_ASSIGN)
 
 #ifndef NATIVEHELPER_JNIHELP_H_
diff --git a/header_only_include/nativehelper/scoped_local_ref.h b/header_only_include/nativehelper/scoped_local_ref.h
index 458c87f..3eb21d9 100644
--- a/header_only_include/nativehelper/scoped_local_ref.h
+++ b/header_only_include/nativehelper/scoped_local_ref.h
@@ -29,6 +29,12 @@
     ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) {
     }
 
+    ScopedLocalRef(ScopedLocalRef&& s) noexcept : mEnv(s.mEnv), mLocalRef(s.release()) {
+    }
+
+    explicit ScopedLocalRef(JNIEnv* env) : mEnv(env), mLocalRef(nullptr) {
+    }
+
     ~ScopedLocalRef() {
         reset();
     }
@@ -52,14 +58,6 @@
         return mLocalRef;
     }
 
-// Some better C++11 support.
-#if __cplusplus >= 201103L
-    // Move constructor.
-    ScopedLocalRef(ScopedLocalRef&& s) : mEnv(s.mEnv), mLocalRef(s.release()) {
-    }
-
-    explicit ScopedLocalRef(JNIEnv* env) : mEnv(env), mLocalRef(nullptr) {
-    }
 
     // We do not expose an empty constructor as it can easily lead to errors
     // using common idioms, e.g.:
@@ -67,7 +65,7 @@
     //   ref.reset(...);
 
     // Move assignment operator.
-    ScopedLocalRef& operator=(ScopedLocalRef&& s) {
+    ScopedLocalRef& operator=(ScopedLocalRef&& s) noexcept {
         reset(s.release());
         mEnv = s.mEnv;
         return *this;
@@ -82,7 +80,6 @@
     bool operator!=(std::nullptr_t) const {
         return mLocalRef != nullptr;
     }
-#endif
 
 private:
     JNIEnv* mEnv;
diff --git a/header_only_include/nativehelper/scoped_utf_chars.h b/header_only_include/nativehelper/scoped_utf_chars.h
index 75cbe50..bab7cb7 100644
--- a/header_only_include/nativehelper/scoped_utf_chars.h
+++ b/header_only_include/nativehelper/scoped_utf_chars.h
@@ -42,7 +42,7 @@
     }
   }
 
-  ScopedUtfChars(ScopedUtfChars&& rhs) :
+  ScopedUtfChars(ScopedUtfChars&& rhs) noexcept :
       env_(rhs.env_), string_(rhs.string_), utf_chars_(rhs.utf_chars_) {
     rhs.env_ = nullptr;
     rhs.string_ = nullptr;
@@ -55,7 +55,7 @@
     }
   }
 
-  ScopedUtfChars& operator=(ScopedUtfChars&& rhs) {
+  ScopedUtfChars& operator=(ScopedUtfChars&& rhs) noexcept {
     if (this != &rhs) {
       // Delete the currently owned UTF chars.
       this->~ScopedUtfChars();
diff --git a/include/nativehelper/JNIHelp.h b/include/nativehelper/JNIHelp.h
index c3c0ecc..d70fdad 100644
--- a/include/nativehelper/JNIHelp.h
+++ b/include/nativehelper/JNIHelp.h
@@ -188,11 +188,9 @@
     return jniCreateString(&env->functions, unicodeChars, len);
 }
 
-#if __cplusplus >= 201103L
 inline jstring jniCreateString(JNIEnv* env, const char16_t* unicodeChars, jsize len) {
     return jniCreateString(&env->functions, reinterpret_cast<const jchar*>(unicodeChars), len);
 }
-#endif  // __cplusplus >= 201103L
 
 inline void jniLogException(JNIEnv* env, int priority, const char* tag, jthrowable exception = NULL) {
     jniLogException(&env->functions, priority, tag, exception);
@@ -201,15 +199,9 @@
 #if !defined(DISALLOW_COPY_AND_ASSIGN)
 // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. It goes in the private:
 // declarations in a class.
-#if __cplusplus >= 201103L
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
   TypeName(const TypeName&) = delete;  \
   void operator=(const TypeName&) = delete
-#else
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&);  \
-  void operator=(const TypeName&)
-#endif  // __has_feature(cxx_deleted_functions)
 #endif  // !defined(DISALLOW_COPY_AND_ASSIGN)
 
 #endif