diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-02 03:45:18 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-02 03:58:05 (GMT) |
commit | a820877d033069062f2cac83d9e611d5af905d0a (patch) | |
tree | c82f66e8e3ff1d11f5a996c7a0dd51e362588e43 /Source/cmExportCommand.cxx | |
parent | 5cf7018af6a5f5f0c84c9b7d5b31d9f849503886 (diff) | |
download | CMake-a820877d033069062f2cac83d9e611d5af905d0a.zip CMake-a820877d033069062f2cac83d9e611d5af905d0a.tar.gz CMake-a820877d033069062f2cac83d9e611d5af905d0a.tar.bz2 |
errors: avoid constructing a stream before getting the last error
Constructing a stream may involve operations that change the global
error state. Avoid the streams by using `cmStrCat` instead.
Diffstat (limited to 'Source/cmExportCommand.cxx')
-rw-r--r-- | Source/cmExportCommand.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index e78b869..7e44210 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -385,13 +385,11 @@ static void StorePackageRegistry(cmMakefile& mf, std::string const& package, if (entry) { entry << content << "\n"; } else { - std::ostringstream e; - /* clang-format off */ - e << "Cannot create package registry file:\n" - << " " << fname << "\n" - << cmSystemTools::GetLastSystemError() << "\n"; - /* clang-format on */ - mf.IssueMessage(MessageType::WARNING, e.str()); + mf.IssueMessage(MessageType::WARNING, + cmStrCat("Cannot create package registry file:\n" + " ", + fname, '\n', + cmSystemTools::GetLastSystemError(), '\n')); } } } |