Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Brad King
CMake
Commits
f0489856
Commit
f0489856
authored
Sep 21, 2017
by
Matthias Männich
Browse files
Retire std::auto_ptr and its macro CM_AUTO_PTR
Signed-off-by:
Matthias Maennich
<
matthias@maennich.net
>
parent
eae3765b
Changes
54
Hide whitespace changes
Inline
Side-by-side
.clang-tidy
View file @
f0489856
...
...
@@ -10,7 +10,6 @@ modernize-*,\
-modernize-deprecated-headers,\
-modernize-pass-by-value,\
-modernize-raw-string-literal,\
-modernize-replace-auto-ptr,\
-modernize-use-auto,\
-modernize-use-default-member-init,\
-modernize-use-emplace,\
...
...
Help/dev/source.rst
View file @
f0489856
...
...
@@ -26,11 +26,9 @@ C++ Subset Permitted
CMake requires compiling as C++11 or above. However, in order to support
building on older toolchains some constructs need to be handled with care:
* Do not use
``CM_AUTO_PTR`` or
``std::auto_ptr``.
* Do not use ``std::auto_ptr``.
The ``std::auto_ptr`` template is deprecated in C++11. The ``CM_AUTO_PTR``
macro remains leftover from C++98 support until its uses can be ported to
``std::unique_ptr``. Do not add new uses of the macro.
The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
* Use ``CM_EQ_DELETE;`` instead of ``= delete;``.
...
...
Source/CMakeLists.txt
View file @
f0489856
...
...
@@ -587,7 +587,6 @@ set(SRCS
cmWriteFileCommand.cxx
cmWriteFileCommand.h
cm_auto_ptr.hxx
cm_get_date.h
cm_get_date.c
cm_utf8.h
...
...
Source/CPack/cmCPackGenerator.cxx
View file @
f0489856
...
...
@@ -6,6 +6,7 @@
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <memory> // IWYU pragma: keep
#include <utility>
#include "cmCPackComponentGroup.h"
...
...
@@ -17,7 +18,6 @@
#include "cmStateSnapshot.h"
#include "cmWorkingDirectory.h"
#include "cmXMLSafe.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(__HAIKU__)
...
...
@@ -156,7 +156,7 @@ int cmCPackGenerator::PrepareNames()
}
const
char
*
algoSignature
=
this
->
GetOption
(
"CPACK_PACKAGE_CHECKSUM"
);
if
(
algoSignature
)
{
if
(
cmCryptoHash
::
New
(
algoSignature
)
.
get
()
==
nullptr
)
{
if
(
!
cmCryptoHash
::
New
(
algoSignature
))
{
cmCPackLogger
(
cmCPackLog
::
LOG_ERROR
,
"Cannot recognize algorithm: "
<<
algoSignature
<<
std
::
endl
);
return
0
;
...
...
@@ -610,8 +610,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm
.
AddCMakePaths
();
cm
.
SetProgressCallback
(
cmCPackGeneratorProgress
,
this
);
cmGlobalGenerator
gg
(
&
cm
);
CM_AUTO_PTR
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
cmMakefile
mf
(
&
gg
,
cm
.
GetCurrentSnapshot
());
if
(
!
installSubDirectory
.
empty
()
&&
installSubDirectory
!=
"/"
&&
installSubDirectory
!=
"."
)
{
tempInstallDirectory
+=
installSubDirectory
;
...
...
@@ -657,11 +656,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
if
(
this
->
GetOption
(
"CPACK_INSTALL_PREFIX"
))
{
dir
+=
this
->
GetOption
(
"CPACK_INSTALL_PREFIX"
);
}
mf
->
AddDefinition
(
"CMAKE_INSTALL_PREFIX"
,
dir
.
c_str
());
mf
.
AddDefinition
(
"CMAKE_INSTALL_PREFIX"
,
dir
.
c_str
());
cmCPackLogger
(
cmCPackLog
::
LOG_DEBUG
,
"- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf
->
AddDefinition)"
"- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf
.
AddDefinition)"
<<
std
::
endl
);
cmCPackLogger
(
cmCPackLog
::
LOG_DEBUG
,
"- Setting CMAKE_INSTALL_PREFIX to '"
<<
dir
<<
"'"
...
...
@@ -698,8 +697,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
return
0
;
}
}
else
{
mf
->
AddDefinition
(
"CMAKE_INSTALL_PREFIX"
,
tempInstallDirectory
.
c_str
());
mf
.
AddDefinition
(
"CMAKE_INSTALL_PREFIX"
,
tempInstallDirectory
.
c_str
());
if
(
!
cmsys
::
SystemTools
::
MakeDirectory
(
tempInstallDirectory
.
c_str
()))
{
...
...
@@ -710,7 +709,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
cmCPackLogger
(
cmCPackLog
::
LOG_DEBUG
,
"- Using non-DESTDIR install... (mf
->
AddDefinition)"
"- Using non-DESTDIR install... (mf
.
AddDefinition)"
<<
std
::
endl
);
cmCPackLogger
(
cmCPackLog
::
LOG_DEBUG
,
"- Setting CMAKE_INSTALL_PREFIX to '"
...
...
@@ -718,19 +717,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
if
(
!
buildConfig
.
empty
())
{
mf
->
AddDefinition
(
"BUILD_TYPE"
,
buildConfig
.
c_str
());
mf
.
AddDefinition
(
"BUILD_TYPE"
,
buildConfig
.
c_str
());
}
std
::
string
installComponentLowerCase
=
cmSystemTools
::
LowerCase
(
installComponent
);
if
(
installComponentLowerCase
!=
"all"
)
{
mf
->
AddDefinition
(
"CMAKE_INSTALL_COMPONENT"
,
installComponent
.
c_str
());
mf
.
AddDefinition
(
"CMAKE_INSTALL_COMPONENT"
,
installComponent
.
c_str
());
}
// strip on TRUE, ON, 1, one or several file names, but not on
// FALSE, OFF, 0 and an empty string
if
(
!
cmSystemTools
::
IsOff
(
this
->
GetOption
(
"CPACK_STRIP_FILES"
)))
{
mf
->
AddDefinition
(
"CMAKE_INSTALL_DO_STRIP"
,
"1"
);
mf
.
AddDefinition
(
"CMAKE_INSTALL_DO_STRIP"
,
"1"
);
}
// Remember the list of files before installation
// of the current component (if we are in component install)
...
...
@@ -750,7 +749,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION
// then forward request to cmake_install.cmake script
if
(
this
->
IsOn
(
"CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"
))
{
mf
->
AddDefinition
(
"CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"
,
"1"
);
mf
.
AddDefinition
(
"CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"
,
"1"
);
}
// If current CPack generator does support
// ABSOLUTE INSTALL DESTINATION or CPack has been asked for
...
...
@@ -758,18 +757,17 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// as soon as it occurs (before installing file)
if
(
!
SupportsAbsoluteDestination
()
||
this
->
IsOn
(
"CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"
))
{
mf
->
AddDefinition
(
"CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"
,
"1"
);
mf
.
AddDefinition
(
"CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"
,
"1"
);
}
// do installation
int
res
=
mf
->
ReadListFile
(
installFile
.
c_str
());
int
res
=
mf
.
ReadListFile
(
installFile
.
c_str
());
// forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES
// to CPack (may be used by generators like CPack RPM or DEB)
// in order to transparently handle ABSOLUTE PATH
if
(
mf
->
GetDefinition
(
"CMAKE_ABSOLUTE_DESTINATION_FILES"
))
{
mf
->
AddDefinition
(
if
(
mf
.
GetDefinition
(
"CMAKE_ABSOLUTE_DESTINATION_FILES"
))
{
mf
.
AddDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
,
mf
->
GetDefinition
(
"CMAKE_ABSOLUTE_DESTINATION_FILES"
));
mf
.
GetDefinition
(
"CMAKE_ABSOLUTE_DESTINATION_FILES"
));
}
// Now rebuild the list of files after installation
...
...
@@ -803,12 +801,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
}
if
(
nullptr
!=
mf
->
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
))
{
if
(
nullptr
!=
mf
.
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
))
{
if
(
!
absoluteDestFiles
.
empty
())
{
absoluteDestFiles
+=
";"
;
}
absoluteDestFiles
+=
mf
->
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
);
mf
.
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
);
cmCPackLogger
(
cmCPackLog
::
LOG_DEBUG
,
"Got some ABSOLUTE DESTINATION FILES: "
<<
absoluteDestFiles
<<
std
::
endl
);
...
...
@@ -822,13 +820,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
this
->
GetOption
(
absoluteDestFileComponent
);
absoluteDestFilesListComponent
+=
";"
;
absoluteDestFilesListComponent
+=
mf
->
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
);
mf
.
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
);
this
->
SetOption
(
absoluteDestFileComponent
,
absoluteDestFilesListComponent
.
c_str
());
}
else
{
this
->
SetOption
(
absoluteDestFileComponent
,
mf
->
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
));
mf
.
GetDefinition
(
"CPACK_ABSOLUTE_DESTINATION_FILES"
));
}
}
}
...
...
@@ -964,7 +962,7 @@ int cmCPackGenerator::DoPackage()
/* Prepare checksum algorithm*/
const
char
*
algo
=
this
->
GetOption
(
"CPACK_PACKAGE_CHECKSUM"
);
CM_AUTO_PTR
<
cmCryptoHash
>
crypto
=
cmCryptoHash
::
New
(
algo
?
algo
:
""
);
std
::
unique_ptr
<
cmCryptoHash
>
crypto
=
cmCryptoHash
::
New
(
algo
?
algo
:
""
);
/*
* Copy the generated packages to final destination
...
...
@@ -997,7 +995,7 @@ int cmCPackGenerator::DoPackage()
<<
packageFileName
<<
" generated."
<<
std
::
endl
);
/* Generate checksum file */
if
(
crypto
.
get
()
!=
nullptr
)
{
if
(
crypto
)
{
std
::
string
hashFile
(
this
->
GetOption
(
"CPACK_OUTPUT_FILE_PREFIX"
));
hashFile
+=
"/"
+
filename
;
hashFile
+=
"."
+
cmSystemTools
::
LowerCase
(
algo
);
...
...
Source/CPack/cpack.cxx
View file @
f0489856
...
...
@@ -5,6 +5,7 @@
#include "cmsys/Encoding.hxx"
#include <iostream>
#include <map>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stddef.h>
#include <string>
...
...
@@ -24,7 +25,6 @@
#include "cmMakefile.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
static
const
char
*
cmDocumentationName
[][
2
]
=
{
...
...
@@ -192,8 +192,7 @@ int main(int argc, char const* const* argv)
cminst
.
SetHomeOutputDirectory
(
""
);
cminst
.
GetCurrentSnapshot
().
SetDefaultDefinitions
();
cmGlobalGenerator
cmgg
(
&
cminst
);
CM_AUTO_PTR
<
cmMakefile
>
globalMF
(
new
cmMakefile
(
&
cmgg
,
cminst
.
GetCurrentSnapshot
()));
cmMakefile
globalMF
(
&
cmgg
,
cminst
.
GetCurrentSnapshot
());
#if defined(__CYGWIN__)
globalMF
->
AddDefinition
(
"CMAKE_LEGACY_CYGWIN_WIN32"
,
"0"
);
#endif
...
...
@@ -225,16 +224,16 @@ int main(int argc, char const* const* argv)
// find out which system cpack is running on, so it can setup the search
// paths, so FIND_XXX() commands can be used in scripts
std
::
string
systemFile
=
globalMF
->
GetModulesFile
(
"CMakeDetermineSystem.cmake"
);
if
(
!
globalMF
->
ReadListFile
(
systemFile
.
c_str
()))
{
globalMF
.
GetModulesFile
(
"CMakeDetermineSystem.cmake"
);
if
(
!
globalMF
.
ReadListFile
(
systemFile
.
c_str
()))
{
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_ERROR
,
"Error reading CMakeDetermineSystem.cmake"
<<
std
::
endl
);
return
1
;
}
systemFile
=
globalMF
->
GetModulesFile
(
"CMakeSystemSpecificInformation.cmake"
);
if
(
!
globalMF
->
ReadListFile
(
systemFile
.
c_str
()))
{
globalMF
.
GetModulesFile
(
"CMakeSystemSpecificInformation.cmake"
);
if
(
!
globalMF
.
ReadListFile
(
systemFile
.
c_str
()))
{
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_ERROR
,
"Error reading CMakeSystemSpecificInformation.cmake"
<<
std
::
endl
);
...
...
@@ -242,7 +241,7 @@ int main(int argc, char const* const* argv)
}
if
(
!
cpackBuildConfig
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_BUILD_CONFIG"
,
cpackBuildConfig
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_BUILD_CONFIG"
,
cpackBuildConfig
.
c_str
());
}
if
(
cmSystemTools
::
FileExists
(
cpackConfigFile
.
c_str
()))
{
...
...
@@ -250,7 +249,7 @@ int main(int argc, char const* const* argv)
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_VERBOSE
,
"Read CPack configuration file: "
<<
cpackConfigFile
<<
std
::
endl
);
if
(
!
globalMF
->
ReadListFile
(
cpackConfigFile
.
c_str
()))
{
if
(
!
globalMF
.
ReadListFile
(
cpackConfigFile
.
c_str
()))
{
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_ERROR
,
"Problem reading CPack config file:
\"
"
<<
cpackConfigFile
<<
"
\"
"
<<
std
::
endl
);
...
...
@@ -264,45 +263,44 @@ int main(int argc, char const* const* argv)
}
if
(
!
generator
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_GENERATOR"
,
generator
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_GENERATOR"
,
generator
.
c_str
());
}
if
(
!
cpackProjectName
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_PACKAGE_NAME"
,
cpackProjectName
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_PACKAGE_NAME"
,
cpackProjectName
.
c_str
());
}
if
(
!
cpackProjectVersion
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_PACKAGE_VERSION"
,
cpackProjectVersion
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_PACKAGE_VERSION"
,
cpackProjectVersion
.
c_str
());
}
if
(
!
cpackProjectVendor
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_PACKAGE_VENDOR"
,
cpackProjectVendor
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_PACKAGE_VENDOR"
,
cpackProjectVendor
.
c_str
());
}
// if this is not empty it has been set on the command line
// go for it. Command line override values set in config file.
if
(
!
cpackProjectDirectory
.
empty
())
{
globalMF
->
AddDefinition
(
"CPACK_PACKAGE_DIRECTORY"
,
cpackProjectDirectory
.
c_str
());
globalMF
.
AddDefinition
(
"CPACK_PACKAGE_DIRECTORY"
,
cpackProjectDirectory
.
c_str
());
}
// The value has not been set on the command line
else
{
// get a default value (current working directory)
cpackProjectDirectory
=
cmsys
::
SystemTools
::
GetCurrentWorkingDirectory
();
// use default value iff no value has been provided by the config file
if
(
!
globalMF
->
IsSet
(
"CPACK_PACKAGE_DIRECTORY"
))
{
globalMF
->
AddDefinition
(
"CPACK_PACKAGE_DIRECTORY"
,
cpackProjectDirectory
.
c_str
());
if
(
!
globalMF
.
IsSet
(
"CPACK_PACKAGE_DIRECTORY"
))
{
globalMF
.
AddDefinition
(
"CPACK_PACKAGE_DIRECTORY"
,
cpackProjectDirectory
.
c_str
());
}
}
for
(
auto
const
&
cd
:
definitions
.
Map
)
{
globalMF
->
AddDefinition
(
cd
.
first
,
cd
.
second
.
c_str
());
globalMF
.
AddDefinition
(
cd
.
first
,
cd
.
second
.
c_str
());
}
const
char
*
cpackModulesPath
=
globalMF
->
GetDefinition
(
"CPACK_MODULE_PATH"
);
const
char
*
cpackModulesPath
=
globalMF
.
GetDefinition
(
"CPACK_MODULE_PATH"
);
if
(
cpackModulesPath
)
{
globalMF
->
AddDefinition
(
"CMAKE_MODULE_PATH"
,
cpackModulesPath
);
globalMF
.
AddDefinition
(
"CMAKE_MODULE_PATH"
,
cpackModulesPath
);
}
const
char
*
genList
=
globalMF
->
GetDefinition
(
"CPACK_GENERATOR"
);
const
char
*
genList
=
globalMF
.
GetDefinition
(
"CPACK_GENERATOR"
);
if
(
!
genList
)
{
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_ERROR
,
"CPack generator not specified"
<<
std
::
endl
);
...
...
@@ -310,8 +308,8 @@ int main(int argc, char const* const* argv)
std
::
vector
<
std
::
string
>
generatorsVector
;
cmSystemTools
::
ExpandListArgument
(
genList
,
generatorsVector
);
for
(
std
::
string
const
&
gen
:
generatorsVector
)
{
cmMakefile
::
ScopePushPop
raii
(
globalMF
.
get
()
);
cmMakefile
*
mf
=
globalMF
.
get
()
;
cmMakefile
::
ScopePushPop
raii
(
&
globalMF
);
cmMakefile
*
mf
=
&
globalMF
;
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_VERBOSE
,
"Specified generator: "
<<
gen
<<
std
::
endl
);
if
(
parsed
&&
!
mf
->
GetDefinition
(
"CPACK_PACKAGE_NAME"
))
{
...
...
Source/CTest/cmCTestLaunch.cxx
View file @
f0489856
...
...
@@ -6,6 +6,7 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include <iostream>
#include <memory> // IWYU pragma: keep
#include <stdlib.h>
#include <string.h>
...
...
@@ -17,7 +18,6 @@
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
#ifdef _WIN32
...
...
@@ -626,12 +626,12 @@ void cmCTestLaunch::LoadConfig()
cm
.
SetHomeOutputDirectory
(
""
);
cm
.
GetCurrentSnapshot
().
SetDefaultDefinitions
();
cmGlobalGenerator
gg
(
&
cm
);
CM_AUTO_PTR
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
())
)
;
cmMakefile
mf
(
&
gg
,
cm
.
GetCurrentSnapshot
());
std
::
string
fname
=
this
->
LogDir
;
fname
+=
"CTestLaunchConfig.cmake"
;
if
(
cmSystemTools
::
FileExists
(
fname
.
c_str
())
&&
mf
->
ReadListFile
(
fname
.
c_str
()))
{
this
->
SourceDir
=
mf
->
GetSafeDefinition
(
"CTEST_SOURCE_DIRECTORY"
);
mf
.
ReadListFile
(
fname
.
c_str
()))
{
this
->
SourceDir
=
mf
.
GetSafeDefinition
(
"CTEST_SOURCE_DIRECTORY"
);
cmSystemTools
::
ConvertToUnixSlashes
(
this
->
SourceDir
);
}
}
Source/CTest/cmCTestTestHandler.cxx
View file @
f0489856
...
...
@@ -8,6 +8,7 @@
#include <functional>
#include <iomanip>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <set>
#include <sstream>
#include <stdio.h>
...
...
@@ -28,7 +29,6 @@
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
#include "cmXMLWriter.h"
#include "cm_auto_ptr.hxx"
#include "cm_utf8.h"
#include "cmake.h"
#include "cmsys/FStream.hxx"
...
...
@@ -1636,9 +1636,9 @@ void cmCTestTestHandler::GetListOfTests()
cm
.
SetHomeOutputDirectory
(
""
);
cm
.
GetCurrentSnapshot
().
SetDefaultDefinitions
();
cmGlobalGenerator
gg
(
&
cm
);
CM_AUTO_PTR
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
())
)
;
mf
->
AddDefinition
(
"CTEST_CONFIGURATION_TYPE"
,
this
->
CTest
->
GetConfigType
().
c_str
());
cmMakefile
mf
(
&
gg
,
cm
.
GetCurrentSnapshot
());
mf
.
AddDefinition
(
"CTEST_CONFIGURATION_TYPE"
,
this
->
CTest
->
GetConfigType
().
c_str
());
// Add handler for ADD_TEST
cmCTestAddTestCommand
*
newCom1
=
new
cmCTestAddTestCommand
;
...
...
@@ -1678,7 +1678,7 @@ void cmCTestTestHandler::GetListOfTests()
return
;
}
if
(
!
mf
->
ReadListFile
(
testFilename
))
{
if
(
!
mf
.
ReadListFile
(
testFilename
))
{
return
;
}
if
(
cmSystemTools
::
GetErrorOccuredFlag
())
{
...
...
Source/CTest/cmCTestUpdateHandler.cxx
View file @
f0489856
...
...
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestUpdateHandler.h"
#include "cmAlgorithms.h"
#include "cmCLocaleEnvironmentScope.h"
#include "cmCTest.h"
#include "cmCTestBZR.h"
...
...
@@ -16,7 +17,7 @@
#include "cmVersion.h"
#include "cmXMLWriter.h"
#include
"cm_auto_ptr.hxx"
#include
<memory> // IWYU pragma: keep
#include <sstream>
static
const
char
*
cmCTestUpdateHandlerUpdateStrings
[]
=
{
...
...
@@ -134,28 +135,28 @@ int cmCTestUpdateHandler::ProcessHandler()
,
this
->
Quiet
);
// Create an object to interact with the VCS tool.
CM_AUTO_PTR
<
cmCTestVC
>
vc
;
std
::
unique_ptr
<
cmCTestVC
>
vc
;
switch
(
this
->
UpdateType
)
{
case
e_CVS
:
vc
.
reset
(
new
cmCTestCVS
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestCVS
>
(
this
->
CTest
,
ofs
);
break
;
case
e_SVN
:
vc
.
reset
(
new
cmCTestSVN
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestSVN
>
(
this
->
CTest
,
ofs
);
break
;
case
e_BZR
:
vc
.
reset
(
new
cmCTestBZR
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestBZR
>
(
this
->
CTest
,
ofs
);
break
;
case
e_GIT
:
vc
.
reset
(
new
cmCTestGIT
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestGIT
>
(
this
->
CTest
,
ofs
);
break
;
case
e_HG
:
vc
.
reset
(
new
cmCTestHG
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestHG
>
(
this
->
CTest
,
ofs
);
break
;
case
e_P4
:
vc
.
reset
(
new
cmCTestP4
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestP4
>
(
this
->
CTest
,
ofs
);
break
;
default:
vc
.
reset
(
new
cmCTestVC
(
this
->
CTest
,
ofs
)
)
;
vc
=
cm
::
make_unique
<
cmCTestVC
>
(
this
->
CTest
,
ofs
);
break
;
}
vc
->
SetCommandLineTool
(
this
->
UpdateCommand
);
...
...
Source/cmCTest.cxx
View file @
f0489856
...
...
@@ -15,6 +15,7 @@
#include <ctype.h>
#include <iostream>
#include <map>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -50,7 +51,6 @@
#include "cmVersion.h"
#include "cmVersionConfig.h"
#include "cmXMLWriter.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(__BEOS__) || defined(__HAIKU__)
...
...
@@ -421,9 +421,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm
.
SetHomeOutputDirectory
(
""
);
cm
.
GetCurrentSnapshot
().
SetDefaultDefinitions
();
cmGlobalGenerator
gg
(
&
cm
);
CM_AUTO_PTR
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
if
(
!
this
->
ReadCustomConfigurationFileTree
(
this
->
BinaryDir
.
c_str
(),
mf
.
get
()))
{
cmMakefile
mf
(
&
gg
,
cm
.
GetCurrentSnapshot
());
if
(
!
this
->
ReadCustomConfigurationFileTree
(
this
->
BinaryDir
.
c_str
(),
&
mf
))
{
cmCTestOptionalLog
(
this
,
DEBUG
,
"Cannot find custom configuration file tree"
<<
std
::
endl
,
quiet
);
...
...
@@ -1123,9 +1122,9 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
*
log
<<
"* Run internal CTest"
<<
std
::
endl
;
}
CM_AUTO_PTR
<
cmSystemTools
::
SaveRestoreEnvironment
>
saveEnv
;
std
::
unique_ptr
<
cmSystemTools
::
SaveRestoreEnvironment
>
saveEnv
;
if
(
modifyEnv
)
{
saveEnv
.
reset
(
new
cmSystemTools
::
SaveRestoreEnvironment
);
saveEnv
=
cm
::
make_unique
<
cmSystemTools
::
SaveRestoreEnvironment
>
(
);
cmSystemTools
::
AppendEnv
(
*
environment
);
}
...
...
@@ -1150,9 +1149,9 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
output
->
clear
();
}
CM_AUTO_PTR
<
cmSystemTools
::
SaveRestoreEnvironment
>
saveEnv
;
std
::
unique_ptr
<
cmSystemTools
::
SaveRestoreEnvironment
>
saveEnv
;
if
(
modifyEnv
)
{
saveEnv
.
reset
(
new
cmSystemTools
::
SaveRestoreEnvironment
);
saveEnv
=
cm
::
make_unique
<
cmSystemTools
::
SaveRestoreEnvironment
>
(
);
cmSystemTools
::
AppendEnv
(
*
environment
);
}
...
...
Source/cmCryptoHash.cxx
View file @
f0489856
...
...
@@ -2,11 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCryptoHash.h"
#include "cmAlgorithms.h"
#include "cm_kwiml.h"
#include "cm_rhash.h"
#include "cmsys/FStream.hxx"
#include <string.h>
#include <memory> // IWYU pragma: keep
static
unsigned
int
const
cmCryptoHashAlgoToId
[]
=
{
/* clang-format needs this comment to break after the opening brace */
RHASH_MD5
,
//
...
...
@@ -43,39 +46,39 @@ cmCryptoHash::~cmCryptoHash()
rhash_free
(
this
->
CTX
);
}
CM_AUTO_PTR
<
cmCryptoHash
>
cmCryptoHash
::
New
(
const
char
*
algo
)
std
::
unique_ptr
<
cmCryptoHash
>
cmCryptoHash
::
New
(
const
char
*
algo
)
{
if
(
strcmp
(
algo
,
"MD5"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoMD5
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoMD5
);
}
if
(
strcmp
(
algo
,
"SHA1"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA1
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA1
);
}
if
(
strcmp
(
algo
,
"SHA224"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA224
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA224
);
}
if
(
strcmp
(
algo
,
"SHA256"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA256
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA256
);
}
if
(
strcmp
(
algo
,
"SHA384"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA384
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA384
);
}
if
(
strcmp
(
algo
,
"SHA512"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA512
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA512
);
}
if
(
strcmp
(
algo
,
"SHA3_224"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA3_224
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA3_224
);
}
if
(
strcmp
(
algo
,
"SHA3_256"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA3_256
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA3_256
);
}
if
(
strcmp
(
algo
,
"SHA3_384"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA3_384
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA3_384
);
}
if
(
strcmp
(
algo
,
"SHA3_512"
)
==
0
)
{
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
new
cmCryptoHash
(
AlgoSHA3_512
)
)
;
return
cm
::
make_unique
<
cmCryptoHash
>
(
AlgoSHA3_512
);
}
return
CM_AUTO_PTR
<
cmCryptoHash
>
(
nullptr
);
return
std
::
unique_ptr
<
cmCryptoHash
>
(
nullptr
);
}
bool
cmCryptoHash
::
IntFromHexDigit
(
char
input
,
char
&
output
)
...
...
Source/cmCryptoHash.h
View file @
f0489856
...
...
@@ -5,12 +5,11 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory> // IWYU pragma: keep
#include <stddef.h>
#include <string>
#include <vector>
#include "cm_auto_ptr.hxx"
/**
* @brief Abstract base class for cryptographic hash generators
*/
...
...
@@ -42,7 +41,7 @@ public:
/// SHA3_224, SHA3_256, SHA3_384, SHA3_512
/// @return A valid auto pointer if algo is supported or
/// an invalid/NULL pointer otherwise
static
CM_AUTO_PTR
<
cmCryptoHash
>
New
(
const
char
*
algo
);
static
std
::
unique_ptr
<
cmCryptoHash
>
New
(
const
char
*
algo
);
/// @brief Converts a hex character to its binary value (4 bits)
/// @arg input Hex character [0-9a-fA-F].
...
...
Source/cmCustomCommandGenerator.cxx
View file @
f0489856
...
...
@@ -11,8 +11,8 @@
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include <memory> // IWYU pragma: keep
#include <stddef.h>
cmCustomCommandGenerator
::
cmCustomCommandGenerator
(
cmCustomCommand
const
&
cc
,
...
...
@@ -29,7 +29,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,