Ver código fonte

Merge topic 'drop-cmsys-std-layer'

04e708d8 Remove use of include <cmsys/IOStream.hxx> from KWSys
e8585f45 Remove use of include <cmsys/stl/*> and cmsys_stl::*
6db713c0 Remove use of include <cmsys/ios/*> and cmsys_ios::*
Brad King 10 anos atrás
pai
commit
ddb7f280ce

+ 6 - 5
Source/CPack/OSXScriptLauncher.cxx

@@ -11,17 +11,18 @@
 ============================================================================*/
 ============================================================================*/
 #include <cmsys/SystemTools.hxx>
 #include <cmsys/SystemTools.hxx>
 #include <cmsys/Process.h>
 #include <cmsys/Process.h>
-#include <cmsys/ios/iostream>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 
 
+#include <iostream>
+
 #include <CoreFoundation/CoreFoundation.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 
 // For the PATH_MAX constant
 // For the PATH_MAX constant
 #include <sys/syslimits.h>
 #include <sys/syslimits.h>
 
 
 #define DebugError(x) \
 #define DebugError(x) \
-  ofs << x << cmsys_ios::endl; \
-  cmsys_ios::cout << x << cmsys_ios::endl
+  ofs << x << std::endl; \
+  std::cout << x << std::endl
 
 
 int main(int argc, char* argv[])
 int main(int argc, char* argv[])
 {
 {
@@ -77,7 +78,7 @@ int main(int argc, char* argv[])
 
 
   std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(
   std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(
     fullScriptPath);
     fullScriptPath);
-  ofs << fullScriptPath.c_str() << cmsys_ios::endl;
+  ofs << fullScriptPath.c_str() << std::endl;
   std::vector<const char*> args;
   std::vector<const char*> args;
   args.push_back(fullScriptPath.c_str());
   args.push_back(fullScriptPath.c_str());
   int cc;
   int cc;
@@ -109,7 +110,7 @@ int main(int argc, char* argv[])
         data[i] = ' ';
         data[i] = ' ';
         }
         }
       }
       }
-    cmsys_ios::cout.write(data, length);
+    std::cout.write(data, length);
     }
     }
 
 
   cmsysProcess_WaitForExit(cp, 0);
   cmsysProcess_WaitForExit(cp, 0);

+ 1 - 2
Source/CPack/cmCPackSTGZGenerator.cxx

@@ -19,7 +19,6 @@
 #include "cmMakefile.h"
 #include "cmMakefile.h"
 #include "cmCPackLog.h"
 #include "cmCPackLog.h"
 
 
-#include <cmsys/ios/sstream>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
@@ -85,7 +84,7 @@ int cmCPackSTGZGenerator::PackageFiles()
 int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
 int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
 {
 {
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl);
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl);
-  cmsys_ios::ostringstream str;
+  std::ostringstream str;
   int counter = 0;
   int counter = 0;
 
 
   std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
   std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");

+ 0 - 2
Source/CTest/cmCTestCoverageHandler.cxx

@@ -27,8 +27,6 @@
 #include <cmsys/Process.h>
 #include <cmsys/Process.h>
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/Glob.hxx>
 #include <cmsys/Glob.hxx>
-#include <cmsys/stl/iterator>
-#include <cmsys/stl/algorithm>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 
 
 #include <stdlib.h>
 #include <stdlib.h>

+ 0 - 1
Source/CTest/cmCTestGIT.cxx

@@ -17,7 +17,6 @@
 #include "cmXMLSafe.h"
 #include "cmXMLSafe.h"
 
 
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/RegularExpression.hxx>
-#include <cmsys/ios/sstream>
 #include <cmsys/Process.h>
 #include <cmsys/Process.h>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 
 

+ 0 - 1
Source/CTest/cmCTestP4.cxx

@@ -16,7 +16,6 @@
 #include "cmXMLSafe.h"
 #include "cmXMLSafe.h"
 
 
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/RegularExpression.hxx>
-#include <cmsys/ios/sstream>
 #include <cmsys/Process.h>
 #include <cmsys/Process.h>
 
 
 #include <sys/types.h>
 #include <sys/types.h>

+ 3 - 4
Source/cmArchiveWrite.cxx

@@ -13,7 +13,6 @@
 
 
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 #include "cmLocale.h"
 #include "cmLocale.h"
-#include <cmsys/ios/iostream>
 #include <cmsys/Directory.hxx>
 #include <cmsys/Directory.hxx>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 #include <cm_libarchive.h>
 #include <cm_libarchive.h>
@@ -67,7 +66,7 @@ struct cmArchiveWrite::Callback
     {
     {
     cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd);
     cmArchiveWrite* self = static_cast<cmArchiveWrite*>(cd);
     if(self->Stream.write(static_cast<const char*>(b),
     if(self->Stream.write(static_cast<const char*>(b),
-                          static_cast<cmsys_ios::streamsize>(n)))
+                          static_cast<std::streamsize>(n)))
       {
       {
       return static_cast<__LA_SSIZE_T>(n);
       return static_cast<__LA_SSIZE_T>(n);
       }
       }
@@ -313,7 +312,7 @@ bool cmArchiveWrite::AddFile(const char* file,
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmArchiveWrite::AddData(const char* file, size_t size)
 bool cmArchiveWrite::AddData(const char* file, size_t size)
 {
 {
-  cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+  cmsys::ifstream fin(file, std::ios::in | std::ios::binary);
   if(!fin)
   if(!fin)
     {
     {
     this->Error = "Error opening \"";
     this->Error = "Error opening \"";
@@ -327,7 +326,7 @@ bool cmArchiveWrite::AddData(const char* file, size_t size)
   size_t nleft = size;
   size_t nleft = size;
   while(nleft > 0)
   while(nleft > 0)
     {
     {
-    typedef cmsys_ios::streamsize ssize_type;
+    typedef std::streamsize ssize_type;
     size_t const nnext = nleft > sizeof(buffer)? sizeof(buffer) : nleft;
     size_t const nnext = nleft > sizeof(buffer)? sizeof(buffer) : nleft;
     ssize_type const nnext_s = static_cast<ssize_type>(nnext);
     ssize_type const nnext_s = static_cast<ssize_type>(nnext);
     fin.read(buffer, nnext_s);
     fin.read(buffer, nnext_s);

+ 1 - 3
Source/cmCMakeHostSystemInformationCommand.cxx

@@ -11,8 +11,6 @@
 ============================================================================*/
 ============================================================================*/
 #include "cmCMakeHostSystemInformationCommand.h"
 #include "cmCMakeHostSystemInformationCommand.h"
 
 
-#include <cmsys/ios/sstream>
-
 // cmCMakeHostSystemInformation
 // cmCMakeHostSystemInformation
 bool cmCMakeHostSystemInformationCommand
 bool cmCMakeHostSystemInformationCommand
 ::InitialPass(std::vector<std::string> const &args, cmExecutionStatus &)
 ::InitialPass(std::vector<std::string> const &args, cmExecutionStatus &)
@@ -107,7 +105,7 @@ bool cmCMakeHostSystemInformationCommand
 std::string cmCMakeHostSystemInformationCommand
 std::string cmCMakeHostSystemInformationCommand
 ::ValueToString(size_t value) const
 ::ValueToString(size_t value) const
 {
 {
-  cmsys_ios::stringstream tmp;
+  std::stringstream tmp;
   tmp << value;
   tmp << value;
   return tmp.str();
   return tmp.str();
 }
 }

+ 0 - 2
Source/cmComputeLinkDepends.cxx

@@ -18,8 +18,6 @@
 #include "cmake.h"
 #include "cmake.h"
 #include "cmAlgorithms.h"
 #include "cmAlgorithms.h"
 
 
-#include <cmsys/stl/algorithm>
-
 #include <assert.h>
 #include <assert.h>
 
 
 /*
 /*

+ 1 - 1
Source/cmCryptoHash.cxx

@@ -46,7 +46,7 @@ std::string cmCryptoHash::HashString(const std::string& input)
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string cmCryptoHash::HashFile(const std::string& file)
 std::string cmCryptoHash::HashFile(const std::string& file)
 {
 {
-  cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary);
+  cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary);
   if(!fin)
   if(!fin)
     {
     {
     return "";
     return "";

+ 0 - 1
Source/cmFindLibraryCommand.cxx

@@ -11,7 +11,6 @@
 ============================================================================*/
 ============================================================================*/
 #include "cmFindLibraryCommand.h"
 #include "cmFindLibraryCommand.h"
 #include <cmsys/Directory.hxx>
 #include <cmsys/Directory.hxx>
-#include <cmsys/stl/algorithm>
 
 
 cmFindLibraryCommand::cmFindLibraryCommand()
 cmFindLibraryCommand::cmFindLibraryCommand()
 {
 {

+ 1 - 1
Source/cmFindPackageCommand.cxx

@@ -1378,7 +1378,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir,
       cmFindPackageCommandHoldFile holdFile(fname.c_str());
       cmFindPackageCommandHoldFile holdFile(fname.c_str());
 
 
       // Load the file.
       // Load the file.
-      cmsys::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
+      cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
       std::string fentry;
       std::string fentry;
       if(fin && cmSystemTools::GetLineFromStream(fin, fentry) &&
       if(fin && cmSystemTools::GetLineFromStream(fin, fentry) &&
          this->CheckPackageRegistryEntry(fentry, outPaths))
          this->CheckPackageRegistryEntry(fentry, outPaths))

+ 2 - 3
Source/cmQtAutoGenerators.cxx

@@ -26,7 +26,6 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
 #include <cmsys/Terminal.h>
 #include <cmsys/Terminal.h>
-#include <cmsys/ios/sstream>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 #include <assert.h>
 #include <assert.h>
 
 
@@ -122,7 +121,7 @@ static void copyTargetProperty(cmTarget* destinationTarget,
 static std::string ReadAll(const std::string& filename)
 static std::string ReadAll(const std::string& filename)
 {
 {
   cmsys::ifstream file(filename.c_str());
   cmsys::ifstream file(filename.c_str());
-  cmsys_ios::stringstream stream;
+  std::stringstream stream;
   stream << file.rdbuf();
   stream << file.rdbuf();
   file.close();
   file.close();
   return stream.str();
   return stream.str();
@@ -1640,7 +1639,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
     this->GenerateQrc();
     this->GenerateQrc();
     }
     }
 
 
-  cmsys_ios::stringstream outStream;
+  std::stringstream outStream;
   outStream << "/* This file is autogenerated, do not edit*/\n";
   outStream << "/* This file is autogenerated, do not edit*/\n";
 
 
   bool automocCppChanged = false;
   bool automocCppChanged = false;

+ 0 - 8
Source/cmStandardIncludes.h

@@ -33,14 +33,6 @@
 // Provide fixed-size integer types.
 // Provide fixed-size integer types.
 #include <cmIML/INT.h>
 #include <cmIML/INT.h>
 
 
-// Include stream compatibility layer from KWSys.
-// This is needed to work with large file support
-// on some platforms whose stream operators do not
-// support the large integer types.
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-# include <cmsys/IOStream.hxx>
-#endif
-
 #include <fstream>
 #include <fstream>
 #include <iostream>
 #include <iostream>
 #include <iomanip>
 #include <iomanip>

+ 1 - 2
Source/cmSystemTools.cxx

@@ -30,7 +30,6 @@
 # include "cmLocale.h"
 # include "cmLocale.h"
 # include <cm_libarchive.h>
 # include <cm_libarchive.h>
 #endif
 #endif
-#include <cmsys/stl/algorithm>
 #include <cmsys/FStream.hxx>
 #include <cmsys/FStream.hxx>
 #include <cmsys/Terminal.h>
 #include <cmsys/Terminal.h>
 
 
@@ -1482,7 +1481,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
 {
 {
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
-  cmsys::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
+  cmsys::ofstream fout(outFileName, std::ios::out | std::ios::binary);
   if(!fout)
   if(!fout)
     {
     {
     std::string e = "Cannot open output file \"";
     std::string e = "Cannot open output file \"";

+ 4 - 4
Source/cmXMLSafe.cxx

@@ -13,8 +13,8 @@
 
 
 #include "cm_utf8.h"
 #include "cm_utf8.h"
 
 
-#include <cmsys/ios/iostream>
-#include <cmsys/ios/sstream>
+#include <iostream>
+#include <sstream>
 
 
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -45,13 +45,13 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b)
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 std::string cmXMLSafe::str()
 std::string cmXMLSafe::str()
 {
 {
-  cmsys_ios::ostringstream ss;
+  std::ostringstream ss;
   ss << *this;
   ss << *this;
   return ss.str();
   return ss.str();
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
-cmsys_ios::ostream& operator<<(cmsys_ios::ostream& os, cmXMLSafe const& self)
+std::ostream& operator<<(std::ostream& os, cmXMLSafe const& self)
 {
 {
   char const* first = self.Data;
   char const* first = self.Data;
   char const* last = self.Data + self.Size;
   char const* last = self.Data + self.Size;

+ 4 - 4
Source/cmXMLSafe.h

@@ -12,8 +12,9 @@
 #ifndef cmXMLSafe_h
 #ifndef cmXMLSafe_h
 #define cmXMLSafe_h
 #define cmXMLSafe_h
 
 
-#include <cmsys/stl/string>
-#include <cmsys/ios/iosfwd>
+#include <cmsys/Configure.hxx>
+#include <string>
+#include <iosfwd>
 
 
 /** \class cmXMLSafe
 /** \class cmXMLSafe
  * \brief Write strings to XML with proper escapes
  * \brief Write strings to XML with proper escapes
@@ -37,8 +38,7 @@ private:
   char const* Data;
   char const* Data;
   unsigned long Size;
   unsigned long Size;
   bool DoQuotes;
   bool DoQuotes;
-  friend cmsys_ios::ostream& operator<<(cmsys_ios::ostream&,
-                                        cmXMLSafe const&);
+  friend std::ostream& operator<<(std::ostream&, cmXMLSafe const&);
 };
 };
 
 
 #endif
 #endif

+ 30 - 30
Tests/CMakeLib/testVisualStudioSlnParser.cxx

@@ -3,7 +3,7 @@
 #include "cmVisualStudioSlnData.h"
 #include "cmVisualStudioSlnData.h"
 #include "cmVisualStudioSlnParser.h"
 #include "cmVisualStudioSlnParser.h"
 
 
-#include <cmsys/ios/iostream>
+#include <iostream>
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 static bool parsedRight(cmVisualStudioSlnParser& parser,
 static bool parsedRight(cmVisualStudioSlnParser& parser,
@@ -27,10 +27,10 @@ static bool parsedRight(cmVisualStudioSlnParser& parser,
       return true;
       return true;
       }
       }
     }
     }
-  cmsys_ios::cerr << "cmVisualStudioSlnParser mis-parsed " << file
-                  << "." SLN_EXTENSION << "; expected result " << expected
-                  << ", got " << parser.GetParseResult()
-                  << cmsys_ios::endl;
+  std::cerr << "cmVisualStudioSlnParser mis-parsed " << file
+            << "." SLN_EXTENSION << "; expected result " << expected
+            << ", got " << parser.GetParseResult()
+            << std::endl;
   return false;
   return false;
 }
 }
 
 
@@ -42,8 +42,8 @@ int testVisualStudioSlnParser(int, char*[])
   // Test clean parser
   // Test clean parser
   if (parser.GetParseResult() != cmVisualStudioSlnParser::ResultOK)
   if (parser.GetParseResult() != cmVisualStudioSlnParser::ResultOK)
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser initialisation failed"
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser initialisation failed"
+              << std::endl;
     return 1;
     return 1;
     }
     }
 
 
@@ -73,38 +73,38 @@ int testVisualStudioSlnParser(int, char*[])
   const size_t expectedProjectCount = sizeof(names) / sizeof(*names);
   const size_t expectedProjectCount = sizeof(names) / sizeof(*names);
   if (projects.size() != expectedProjectCount)
   if (projects.size() != expectedProjectCount)
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad number of "
-                    << "projects (" << projects.size() << " instead of "
-                    << expectedProjectCount << ')'
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser returned bad number of "
+              << "projects (" << projects.size() << " instead of "
+              << expectedProjectCount << ')'
+              << std::endl;
     return 1;
     return 1;
     }
     }
   for (size_t idx = 0; idx < expectedProjectCount; ++idx)
   for (size_t idx = 0; idx < expectedProjectCount; ++idx)
     {
     {
     if (projects[idx].GetName() != names[idx])
     if (projects[idx].GetName() != names[idx])
       {
       {
-      cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad project #"
-                      << idx << "; expected \"" << names[idx] << "\", got \""
-                      << projects[idx].GetName() << '"'
-                      << cmsys_ios::endl;
+      std::cerr << "cmVisualStudioSlnParser returned bad project #"
+                << idx << "; expected \"" << names[idx] << "\", got \""
+                << projects[idx].GetName() << '"'
+                << std::endl;
       return 1;
       return 1;
       }
       }
     }
     }
   if (projects[0].GetRelativePath() != "Utilities\\3rdParty")
   if (projects[0].GetRelativePath() != "Utilities\\3rdParty")
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad relative path of "
-                    << "project 3rdParty; expected \"Utilities\\3rdParty\", "
-                    << "got \"" << projects[0].GetRelativePath() << '"'
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser returned bad relative path of "
+              << "project 3rdParty; expected \"Utilities\\3rdParty\", "
+              << "got \"" << projects[0].GetRelativePath() << '"'
+              << std::endl;
     return 1;
     return 1;
     }
     }
   if (projects[2].GetGUID() != "{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}")
   if (projects[2].GetGUID() != "{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}")
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser returned bad relative path of "
-                    << "project CMakeLib; expected "
-                    << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", "
-                    << "got \"" << projects[2].GetGUID() << '"'
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser returned bad relative path of "
+              << "project CMakeLib; expected "
+              << "\"{59BCCCCD-3AD1-4491-B8F4-C5793AC007E2}\", "
+              << "got \"" << projects[2].GetGUID() << '"'
+              << std::endl;
     return 1;
     return 1;
     }
     }
   }
   }
@@ -119,9 +119,9 @@ int testVisualStudioSlnParser(int, char*[])
     }
     }
   if (!parser.GetParseHadBOM())
   if (!parser.GetParseHadBOM())
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser didn't find BOM in bom."
-                    << SLN_EXTENSION
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser didn't find BOM in bom."
+              << SLN_EXTENSION
+              << std::endl;
     return 1;
     return 1;
     }
     }
 
 
@@ -131,9 +131,9 @@ int testVisualStudioSlnParser(int, char*[])
     }
     }
   if (parser.GetParseHadBOM())
   if (parser.GetParseHadBOM())
     {
     {
-    cmsys_ios::cerr << "cmVisualStudioSlnParser found BOM in nobom."
-                    << SLN_EXTENSION
-                    << cmsys_ios::endl;
+    std::cerr << "cmVisualStudioSlnParser found BOM in nobom."
+              << SLN_EXTENSION
+              << std::endl;
     return 1;
     return 1;
     }
     }
   }
   }

+ 2 - 2
Tests/CMakeLib/testXMLParser.cxx

@@ -2,7 +2,7 @@
 
 
 #include "cmXMLParser.h"
 #include "cmXMLParser.h"
 
 
-#include <cmsys/ios/iostream>
+#include <iostream>
 
 
 int testXMLParser(int, char*[])
 int testXMLParser(int, char*[])
 {
 {
@@ -10,7 +10,7 @@ int testXMLParser(int, char*[])
   cmXMLParser parser;
   cmXMLParser parser;
   if(!parser.ParseFile(SOURCE_DIR "/testXMLParser.xml"))
   if(!parser.ParseFile(SOURCE_DIR "/testXMLParser.xml"))
     {
     {
-    cmsys_ios::cerr << "cmXMLParser failed!" << cmsys_ios::endl;
+    std::cerr << "cmXMLParser failed!" << std::endl;
     return 1;
     return 1;
     }
     }
   return 0;
   return 0;