diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-09-01 22:32:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-09-01 22:32:42 +0000 |
commit | 43824e72c7bccb934b8689af6abdb0552d420ce9 (patch) | |
tree | 863ff9b279c68741d725f762d9ed36ea08a02a74 /base/include/android-base | |
parent | 8e7ae1e381b3aefa460d61eb5840ee83c76a4173 (diff) | |
parent | 22847131da5606126c68bb1650d87f7823f5f560 (diff) | |
download | core-43824e72c7bccb934b8689af6abdb0552d420ce9.tar.gz core-43824e72c7bccb934b8689af6abdb0552d420ce9.tar.bz2 core-43824e72c7bccb934b8689af6abdb0552d420ce9.zip |
Merge "Base: assume and use C++11 in libbase"
Diffstat (limited to 'base/include/android-base')
-rw-r--r-- | base/include/android-base/logging.h | 4 | ||||
-rw-r--r-- | base/include/android-base/macros.h | 28 |
2 files changed, 7 insertions, 25 deletions
diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h index 66d60c96c..721ecceca 100644 --- a/base/include/android-base/logging.h +++ b/base/include/android-base/logging.h @@ -265,7 +265,7 @@ static constexpr bool kEnableDChecks = true; // MakeEagerEvaluator to infer the types of LHS and RHS. template <typename LHS, typename RHS> struct EagerEvaluator { - EagerEvaluator(LHS l, RHS r) : lhs(l), rhs(r) { + constexpr EagerEvaluator(LHS l, RHS r) : lhs(l), rhs(r) { } LHS lhs; RHS rhs; @@ -273,7 +273,7 @@ struct EagerEvaluator { // Helper function for CHECK_xx. template <typename LHS, typename RHS> -static inline EagerEvaluator<LHS, RHS> MakeEagerEvaluator(LHS lhs, RHS rhs) { +constexpr EagerEvaluator<LHS, RHS> MakeEagerEvaluator(LHS lhs, RHS rhs) { return EagerEvaluator<LHS, RHS>(lhs, rhs); } diff --git a/base/include/android-base/macros.h b/base/include/android-base/macros.h index ee16d023c..88bbe8a73 100644 --- a/base/include/android-base/macros.h +++ b/base/include/android-base/macros.h @@ -41,18 +41,9 @@ // Note, that most uses of DISALLOW_ASSIGN and DISALLOW_COPY are broken // semantically, one should either use disallow both or neither. Try to // avoid these in new code. -// -// When building with C++11 toolchains, just use the language support -// for explicitly deleted methods. -#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 // A macro to disallow all the implicit constructors, namely the // default constructor, copy constructor and operator= functions. @@ -60,18 +51,9 @@ // This should be used in the private: declarations for a class // that wants to prevent anyone from instantiating it. This is // especially useful for classes containing only static methods. -// -// When building with C++11 toolchains, just use the language support -// for explicitly deleted methods. -#if __cplusplus >= 201103L #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ TypeName() = delete; \ DISALLOW_COPY_AND_ASSIGN(TypeName) -#else -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ - DISALLOW_COPY_AND_ASSIGN(TypeName) -#endif // The arraysize(arr) macro returns the # of elements in an array arr. // The expression is a compile-time constant, and therefore can be @@ -174,10 +156,10 @@ void UNUSED(const T&...) { // only if there are no statements on the execution path between it and the // next switch label. // -// When compiled with clang in C++11 mode, the FALLTHROUGH_INTENDED macro is -// expanded to [[clang::fallthrough]] attribute, which is analysed when -// performing switch labels fall-through diagnostic ('-Wimplicit-fallthrough'). -// See clang documentation on language extensions for details: +// When compiled with clang, the FALLTHROUGH_INTENDED macro is expanded to +// [[clang::fallthrough]] attribute, which is analysed when performing switch +// labels fall-through diagnostic ('-Wimplicit-fallthrough'). See clang +// documentation on language extensions for details: // http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough // // When used with unsupported compilers, the FALLTHROUGH_INTENDED macro has no @@ -185,7 +167,7 @@ void UNUSED(const T&...) { // // In either case this macro has no effect on runtime behavior and performance // of code. -#if defined(__clang__) && __cplusplus >= 201103L && defined(__has_warning) +#if defined(__clang__) && defined(__has_warning) #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") #define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT #endif |