Merge topic 'cxx11-eq-delete'

b8018135 Use C++11 '= delete' instead of CM_EQ_DELETE
42f4e697 Drop unused CMake_HAVE_CXX_UNIQUE_PTR macro

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1326
This commit is contained in:
Brad King
2017-09-29 12:48:56 +00:00
committed by Kitware Robot
6 changed files with 3 additions and 36 deletions
-8
View File
@@ -30,14 +30,6 @@ building on older toolchains some constructs need to be handled with care:
The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
* Use ``CM_EQ_DELETE;`` instead of ``= delete;``.
Older C++11 compilers do not support deleting functions. Using
``CM_EQ_DELETE`` will delete the functions if the compiler supports it and
give them no implementation otherwise. Calling such a function will lead
to compiler errors if the compiler supports *deleted* functions and linker
errors otherwise.
* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable.
The ``CM_DISABLE_COPY`` macro should be used in the private section of a
-14
View File
@@ -1,14 +0,0 @@
struct Foo
{
Foo() {}
~Foo() {}
Foo(Foo const&) = delete;
Foo& operator=(Foo const&) = delete;
int test() const { return 0; }
};
int main()
{
Foo const foo;
return foo.test();
}
-1
View File
@@ -41,7 +41,6 @@ function(cm_check_cxx_feature name)
endif()
endfunction()
cm_check_cxx_feature(eq_delete)
cm_check_cxx_feature(fallthrough)
if(NOT CMake_HAVE_CXX_FALLTHROUGH)
cm_check_cxx_feature(gnu_fallthrough)
+2 -10
View File
@@ -19,21 +19,13 @@
#cmakedefine HAVE_UNSETENV
#cmakedefine CMAKE_USE_ELF_PARSER
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMake_HAVE_CXX_EQ_DELETE
#cmakedefine CMake_HAVE_CXX_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_GNU_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_UNIQUE_PTR
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
#ifdef CMake_HAVE_CXX_EQ_DELETE
#define CM_EQ_DELETE = delete
#else
#define CM_EQ_DELETE
#endif
#if defined(CMake_HAVE_CXX_FALLTHROUGH)
#define CM_FALLTHROUGH [[fallthrough]]
#elif defined(CMake_HAVE_CXX_GNU_FALLTHROUGH)
@@ -45,7 +37,7 @@
#endif
#define CM_DISABLE_COPY(Class) \
Class(Class const&) CM_EQ_DELETE; \
Class& operator=(Class const&) CM_EQ_DELETE;
Class(Class const&) = delete; \
Class& operator=(Class const&) = delete;
#endif
+1 -2
View File
@@ -90,8 +90,7 @@ private:
void Update(cmSourceFileLocation const& loc);
void UpdateExtension(const std::string& name);
cmSourceFileLocation& operator=(const cmSourceFileLocation& loc)
CM_EQ_DELETE;
cmSourceFileLocation& operator=(const cmSourceFileLocation& loc) = delete;
};
#endif
-1
View File
@@ -1270,7 +1270,6 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE"
cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH"
cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"