am 66bbf159: Merge "Refactoring: C++11 style DISABLE_ bionic marcos"
				
					
				
			* commit '66bbf1595c0fc25d4bc47457d8020b11e135996d': Refactoring: C++11 style DISABLE_ bionic marcos
This commit is contained in:
		@@ -1183,6 +1183,7 @@ libstdcxx_common_src_files := \
 | 
				
			|||||||
include $(CLEAR_VARS)
 | 
					include $(CLEAR_VARS)
 | 
				
			||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
					LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
				
			||||||
LOCAL_CFLAGS := $(libc_common_cflags)
 | 
					LOCAL_CFLAGS := $(libc_common_cflags)
 | 
				
			||||||
 | 
					LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
				
			||||||
LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
					LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
				
			||||||
LOCAL_MODULE:= libstdc++
 | 
					LOCAL_MODULE:= libstdc++
 | 
				
			||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
					LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
				
			||||||
@@ -1195,6 +1196,7 @@ include $(BUILD_SHARED_LIBRARY)
 | 
				
			|||||||
include $(CLEAR_VARS)
 | 
					include $(CLEAR_VARS)
 | 
				
			||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
					LOCAL_C_INCLUDES := $(libc_common_c_includes)
 | 
				
			||||||
LOCAL_CFLAGS := $(libc_common_cflags)
 | 
					LOCAL_CFLAGS := $(libc_common_cflags)
 | 
				
			||||||
 | 
					LOCAL_CPPFLAGS := $(libc_common_cppflags)
 | 
				
			||||||
LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
					LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
 | 
				
			||||||
LOCAL_MODULE:= libstdc++
 | 
					LOCAL_MODULE:= libstdc++
 | 
				
			||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
					LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,10 @@
 | 
				
			|||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef SCOPE_GUARD_H
 | 
					#ifndef _SCOPE_GUARD_H
 | 
				
			||||||
#define SCOPE_GUARD_H
 | 
					#define _SCOPE_GUARD_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "private/bionic_macros.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: include explicit std::move when it becomes available
 | 
					// TODO: include explicit std::move when it becomes available
 | 
				
			||||||
template<typename F>
 | 
					template<typename F>
 | 
				
			||||||
@@ -40,14 +42,12 @@ class ScopeGuard {
 | 
				
			|||||||
  F f_;
 | 
					  F f_;
 | 
				
			||||||
  bool active_;
 | 
					  bool active_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ScopeGuard() = delete;
 | 
					  DISALLOW_IMPLICIT_CONSTRUCTORS(ScopeGuard);
 | 
				
			||||||
  ScopeGuard(const ScopeGuard&) = delete;
 | 
					 | 
				
			||||||
  ScopeGuard& operator=(const ScopeGuard&) = delete;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
ScopeGuard<T> create_scope_guard(T f) {
 | 
					ScopeGuard<T> make_scope_guard(T f) {
 | 
				
			||||||
  return ScopeGuard<T>(f);
 | 
					  return ScopeGuard<T>(f);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // SCOPE_GUARD_H
 | 
					#endif  // _SCOPE_GUARD_H
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,8 +20,8 @@
 | 
				
			|||||||
// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
 | 
					// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
 | 
				
			||||||
// It goes in the private: declarations in a class.
 | 
					// It goes in the private: declarations in a class.
 | 
				
			||||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
 | 
					#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
 | 
				
			||||||
  TypeName(const TypeName&);               \
 | 
					  TypeName(const TypeName&) = delete;      \
 | 
				
			||||||
  void operator=(const TypeName&)
 | 
					  void operator=(const TypeName&) = delete
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// A macro to disallow all the implicit constructors, namely the
 | 
					// A macro to disallow all the implicit constructors, namely the
 | 
				
			||||||
// default constructor, copy constructor and operator= functions.
 | 
					// default constructor, copy constructor and operator= functions.
 | 
				
			||||||
@@ -30,7 +30,7 @@
 | 
				
			|||||||
// that wants to prevent anyone from instantiating it. This is
 | 
					// that wants to prevent anyone from instantiating it. This is
 | 
				
			||||||
// especially useful for classes containing only static methods.
 | 
					// especially useful for classes containing only static methods.
 | 
				
			||||||
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
 | 
					#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
 | 
				
			||||||
  TypeName();                                    \
 | 
					  TypeName() = delete;                           \
 | 
				
			||||||
  DISALLOW_COPY_AND_ASSIGN(TypeName)
 | 
					  DISALLOW_COPY_AND_ASSIGN(TypeName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BIONIC_ALIGN(value, alignment) \
 | 
					#define BIONIC_ALIGN(value, alignment) \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -929,7 +929,7 @@ static bool find_libraries(const char* const library_names[], size_t library_nam
 | 
				
			|||||||
  SoinfoLinkedList found_libs;
 | 
					  SoinfoLinkedList found_libs;
 | 
				
			||||||
  size_t soinfos_size = 0;
 | 
					  size_t soinfos_size = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto failure_guard = create_scope_guard([&]() {
 | 
					  auto failure_guard = make_scope_guard([&]() {
 | 
				
			||||||
    // Housekeeping
 | 
					    // Housekeeping
 | 
				
			||||||
    load_tasks.for_each([] (LoadTask* t) {
 | 
					    load_tasks.for_each([] (LoadTask* t) {
 | 
				
			||||||
      LoadTask::deleter(t);
 | 
					      LoadTask::deleter(t);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -149,7 +149,7 @@ TEST(dlfcn, dlopen_check_relocation_dt_needed_order) {
 | 
				
			|||||||
  // in both dt_needed libraries, the correct relocation should
 | 
					  // in both dt_needed libraries, the correct relocation should
 | 
				
			||||||
  // use the function defined in libtest_relo_check_dt_needed_order_1.so
 | 
					  // use the function defined in libtest_relo_check_dt_needed_order_1.so
 | 
				
			||||||
  void* handle = nullptr;
 | 
					  void* handle = nullptr;
 | 
				
			||||||
  auto guard = create_scope_guard([&]() {
 | 
					  auto guard = make_scope_guard([&]() {
 | 
				
			||||||
    dlclose(handle);
 | 
					    dlclose(handle);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -762,7 +762,7 @@ TEST(math, erfcl) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, lrint) {
 | 
					TEST(math, lrint) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -786,7 +786,7 @@ TEST(math, lrint) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, rint) {
 | 
					TEST(math, rint) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -816,7 +816,7 @@ TEST(math, rint) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, nearbyint) {
 | 
					TEST(math, nearbyint) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
 | 
					  fesetround(FE_UPWARD); // nearbyint/nearbyintf/nearbyintl obey the rounding mode.
 | 
				
			||||||
@@ -845,7 +845,7 @@ TEST(math, nearbyint) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, lround) {
 | 
					TEST(math, lround) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // lround ignores the rounding mode.
 | 
					  fesetround(FE_UPWARD); // lround ignores the rounding mode.
 | 
				
			||||||
@@ -855,7 +855,7 @@ TEST(math, lround) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, llround) {
 | 
					TEST(math, llround) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // llround ignores the rounding mode.
 | 
					  fesetround(FE_UPWARD); // llround ignores the rounding mode.
 | 
				
			||||||
@@ -952,7 +952,7 @@ TEST(math, fdiml) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, round) {
 | 
					TEST(math, round) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero.
 | 
					  fesetround(FE_TOWARDZERO); // round ignores the rounding mode and always rounds away from zero.
 | 
				
			||||||
@@ -965,7 +965,7 @@ TEST(math, round) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, roundf) {
 | 
					TEST(math, roundf) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero.
 | 
					  fesetround(FE_TOWARDZERO); // roundf ignores the rounding mode and always rounds away from zero.
 | 
				
			||||||
@@ -978,7 +978,7 @@ TEST(math, roundf) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, roundl) {
 | 
					TEST(math, roundl) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero.
 | 
					  fesetround(FE_TOWARDZERO); // roundl ignores the rounding mode and always rounds away from zero.
 | 
				
			||||||
@@ -991,7 +991,7 @@ TEST(math, roundl) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, trunc) {
 | 
					TEST(math, trunc) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero.
 | 
					  fesetround(FE_UPWARD); // trunc ignores the rounding mode and always rounds toward zero.
 | 
				
			||||||
@@ -1004,7 +1004,7 @@ TEST(math, trunc) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, truncf) {
 | 
					TEST(math, truncf) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero.
 | 
					  fesetround(FE_UPWARD); // truncf ignores the rounding mode and always rounds toward zero.
 | 
				
			||||||
@@ -1017,7 +1017,7 @@ TEST(math, truncf) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(math, truncl) {
 | 
					TEST(math, truncl) {
 | 
				
			||||||
  auto guard = create_scope_guard([]() {
 | 
					  auto guard = make_scope_guard([]() {
 | 
				
			||||||
    fesetenv(FE_DFL_ENV);
 | 
					    fesetenv(FE_DFL_ENV);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero.
 | 
					  fesetround(FE_UPWARD); // truncl ignores the rounding mode and always rounds toward zero.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -871,7 +871,7 @@ TEST(pthread, pthread_attr_getstack__main_thread) {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
  EXPECT_EQ(rl.rlim_cur, stack_size);
 | 
					  EXPECT_EQ(rl.rlim_cur, stack_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto guard = create_scope_guard([&rl, original_rlim_cur]() {
 | 
					  auto guard = make_scope_guard([&rl, original_rlim_cur]() {
 | 
				
			||||||
    rl.rlim_cur = original_rlim_cur;
 | 
					    rl.rlim_cur = original_rlim_cur;
 | 
				
			||||||
    ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
 | 
					    ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user