STYLE: remove out commented code

Alex
This commit is contained in:
Alexander Neundorf 2007-06-07 13:51:17 -04:00
parent ca3a613595
commit b956fc2406
4 changed files with 39 additions and 99 deletions

View File

@ -74,10 +74,8 @@ MACRO(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
"Compilation of the ${lang} compiler identification source \"" "Compilation of the ${lang} compiler identification source \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" produced \"" "${CMAKE_${lang}_COMPILER_ID_SRC}\" produced \""
"${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n") "${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n")
# only check if we don't have it yet # only check if we don't have it yet
IF(NOT CMAKE_${lang}_COMPILER_ID) IF(NOT CMAKE_${lang}_COMPILER_ID)
# SET(CMAKE_${lang}_COMPILER_ID_EXE "${CMAKE_${lang}_COMPILER_ID_DIR}/ConvertedToBinary")
# FILE(HEX_TO_BIN "${CMAKE_${lang}_COMPILER_ID_EXE_TRY}" "${CMAKE_${lang}_COMPILER_ID_EXE}")
# Read the compiler identification string from the executable file. # Read the compiler identification string from the executable file.
FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE} FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE}
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:") CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:")

View File

@ -16,11 +16,11 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
MESSAGE(STATUS "Check size of ${TYPE}") MESSAGE(STATUS "Check size of ${TYPE}")
SET(CHECK_TYPE_SIZE_TYPE "${TYPE}") SET(CHECK_TYPE_SIZE_TYPE "${TYPE}")
SET(MACRO_CHECK_TYPE_SIZE_FLAGS SET(MACRO_CHECK_TYPE_SIZE_FLAGS
"${CMAKE_REQUIRED_FLAGS}") "${CMAKE_REQUIRED_FLAGS}")
FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H)
IF("${def}") IF("${def}")
SET(MACRO_CHECK_TYPE_SIZE_FLAGS SET(MACRO_CHECK_TYPE_SIZE_FLAGS
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
ENDIF("${def}") ENDIF("${def}")
ENDFOREACH(def) ENDFOREACH(def)
@ -33,7 +33,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n")
ENDFOREACH(def) ENDFOREACH(def)
IF(CMAKE_REQUIRED_LIBRARIES) IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_TYPE_SIZE_ADD_LIBRARIES SET(CHECK_TYPE_SIZE_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
ENDIF(CMAKE_REQUIRED_LIBRARIES) ENDIF(CMAKE_REQUIRED_LIBRARIES)
IF(CMAKE_REQUIRED_INCLUDES) IF(CMAKE_REQUIRED_INCLUDES)
@ -56,8 +56,6 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" ) COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" )
IF(HAVE_${VARIABLE}) IF(HAVE_${VARIABLE})
# FILE(HEX_TO_BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin"
# "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.even_more_bin")
FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin"
CMAKE_CHECKTYPESIZE_STRINGS LIMIT_COUNT 2 REGEX "INFO:sizeof") CMAKE_CHECKTYPESIZE_STRINGS LIMIT_COUNT 2 REGEX "INFO:sizeof")
@ -75,11 +73,11 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
ENDFOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) ENDFOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS})
MESSAGE(STATUS "Check size of ${TYPE} - done") MESSAGE(STATUS "Check size of ${TYPE} - done")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n")
ELSE(HAVE_${VARIABLE}) ELSE(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - failed") MESSAGE(STATUS "Check size of ${TYPE} - failed")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n")
SET(${VARIABLE}) SET(${VARIABLE})
ENDIF(HAVE_${VARIABLE}) ENDIF(HAVE_${VARIABLE})

View File

@ -76,10 +76,6 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
{ {
return this->HandleStringsCommand(args); return this->HandleStringsCommand(args);
} }
/* else if ( subCommand == "HEX_TO_BIN" )
{
return this->HandleHex2BinCommand(args);
}*/
else if ( subCommand == "GLOB" ) else if ( subCommand == "GLOB" )
{ {
return this->HandleGlobCommand(args, false); return this->HandleGlobCommand(args, false);
@ -236,7 +232,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
std::string line; std::string line;
bool has_newline = false; bool has_newline = false;
while (sizeLimit != 0 && while (sizeLimit != 0 &&
cmSystemTools::GetLineFromStream(file, line, &has_newline, cmSystemTools::GetLineFromStream(file, line, &has_newline,
sizeLimit) ) sizeLimit) )
{ {
if (sizeLimit > 0) if (sizeLimit > 0)
@ -261,53 +257,6 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
return true; return true;
} }
//----------------------------------------------------------------------------
/*bool cmFileCommand::HandleHex2BinCommand(std::vector<std::string> const& args)
{
if(args.size() != 3)
{
this->SetError("HEX_TO_BIN requires an input and an output file name");
return false;
}
// Get the file to read.
std::string inFileName = args[1];
if(!cmsys::SystemTools::FileIsFullPath(inFileName.c_str()))
{
inFileName = this->Makefile->GetCurrentDirectory();
inFileName += "/" + args[1];
}
// Get the file to write.
std::string outFileName = args[2];
if(!cmsys::SystemTools::FileIsFullPath(outFileName.c_str()))
{
outFileName = this->Makefile->GetCurrentDirectory();
outFileName += "/" + args[2];
}
if ( !this->Makefile->CanIWriteThisFile(outFileName.c_str()) )
{
std::string e
= "attempted to write a file: " + outFileName +
" into a source directory.";
this->SetError(e.c_str());
cmSystemTools::SetFatalErrorOccured();
return false;
}
std::string dir = cmSystemTools::GetFilenamePath(outFileName);
cmSystemTools::MakeDirectory(dir.c_str());
bool success = cmHexFileConverter::TryConvert(inFileName.c_str(),
outFileName.c_str());
if (!success)
{
success = cmSystemTools::CopyFileAlways(inFileName.c_str(),
outFileName.c_str());
}
return success;
} */
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{ {
@ -485,7 +434,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
fileName = binaryFileName; fileName = binaryFileName;
} }
} }
// Open the specified file. // Open the specified file.
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary);
@ -1089,7 +1038,7 @@ bool cmFileInstaller::InstallDirectory(const char* source,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer,
mode_t& permissions_file, mode_t& permissions_file,
mode_t& permissions_dir, mode_t& permissions_dir,
int itype, int itype,
@ -1190,7 +1139,7 @@ void cmFileCommand
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer,
std::string& destination) std::string& destination)
{ {
if ( destination.size() < 2 ) if ( destination.size() < 2 )
@ -1199,7 +1148,7 @@ bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer,
"No DESTINATION provided or ."); "No DESTINATION provided or .");
return false; return false;
} }
const char* destdir = cmSystemTools::GetEnv("DESTDIR"); const char* destdir = cmSystemTools::GetEnv("DESTDIR");
if ( destdir && *destdir ) if ( destdir && *destdir )
{ {
@ -1299,9 +1248,9 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
std::map<cmStdString, const char*> properties; std::map<cmStdString, const char*> properties;
bool optional = false; bool optional = false;
bool result = this->ParseInstallArgs(args, installer, components, bool result = this->ParseInstallArgs(args, installer, components,
configurations, properties, configurations, properties,
itype, rename, destination, files, itype, rename, destination, files,
optional); optional);
if (result == true) if (result == true)
{ {
@ -1640,7 +1589,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector<std::string> const& args,
this->GetTargetTypeFromString(stype, itype); this->GetTargetTypeFromString(stype, itype);
this->HandleInstallPermissions(installer, this->HandleInstallPermissions(installer,
permissions_file, permissions_file,
permissions_dir, permissions_dir,
itype, itype,
@ -1759,10 +1708,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
cmSystemTools::RemoveFile(soname.c_str()); cmSystemTools::RemoveFile(soname.c_str());
cmSystemTools::RemoveFile(libname.c_str()); cmSystemTools::RemoveFile(libname.c_str());
if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(), if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(),
libname.c_str()) ) libname.c_str()) )
{ {
std::string errstring = "error when creating symlink from: " std::string errstring = "error when creating symlink from: "
+ libname + " to " + soname_nopath; + libname + " to " + soname_nopath;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
@ -1770,10 +1719,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
installer.ManifestAppend(libname); installer.ManifestAppend(libname);
if ( toFile != soname ) if ( toFile != soname )
{ {
if ( !cmSystemTools::CreateSymlink(fromName.c_str(), if ( !cmSystemTools::CreateSymlink(fromName.c_str(),
soname.c_str()) ) soname.c_str()) )
{ {
std::string errstring = "error when creating symlink from: " std::string errstring = "error when creating symlink from: "
+ soname + " to " + fromName; + soname + " to " + fromName;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
@ -1805,10 +1754,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
cmSystemTools::RemoveFile(exename.c_str()); cmSystemTools::RemoveFile(exename.c_str());
if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(),
exename.c_str()) ) exename.c_str()) )
{ {
std::string errstring = "error when creating symlink from: " std::string errstring = "error when creating symlink from: "
+ exename + " to " + exename_nopath; + exename + " to " + exename_nopath;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
@ -1901,22 +1850,22 @@ bool cmFileCommand::HandleRelativePathCommand(
if(!cmSystemTools::FileIsFullPath(directoryName.c_str())) if(!cmSystemTools::FileIsFullPath(directoryName.c_str()))
{ {
std::string errstring = std::string errstring =
"RelativePath must be passed a full path to the directory: " "RelativePath must be passed a full path to the directory: "
+ directoryName; + directoryName;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
} }
if(!cmSystemTools::FileIsFullPath(fileName.c_str())) if(!cmSystemTools::FileIsFullPath(fileName.c_str()))
{ {
std::string errstring = std::string errstring =
"RelativePath must be passed a full path to the file: " "RelativePath must be passed a full path to the file: "
+ fileName; + fileName;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
} }
std::string res = cmSystemTools::RelativePath(directoryName.c_str(), std::string res = cmSystemTools::RelativePath(directoryName.c_str(),
fileName.c_str()); fileName.c_str());
this->Makefile->AddDefinition(outVar.c_str(), this->Makefile->AddDefinition(outVar.c_str(),
res.c_str()); res.c_str());
@ -1949,7 +1898,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string>
const& args, const& args,
bool nativePath) bool nativePath)
{ {
std::vector<std::string>::const_iterator i = args.begin(); std::vector<std::string>::const_iterator i = args.begin();
@ -1965,7 +1914,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string>
#else #else
char pathSep = ':'; char pathSep = ':';
#endif #endif
std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(),
pathSep); pathSep);
i++; i++;
const char* var = i->c_str(); const char* var = i->c_str();
@ -1986,7 +1935,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string>
*j = cmSystemTools::ConvertToOutputPath(j->c_str()); *j = cmSystemTools::ConvertToOutputPath(j->c_str());
// remove double quotes in the path // remove double quotes in the path
cmsys::String& s = *j; cmsys::String& s = *j;
if(s.size() > 1 && s[0] == '\"' && s[s.size()-1] == '\"') if(s.size() > 1 && s[0] == '\"' && s[s.size()-1] == '\"')
{ {
s = s.substr(1,s.size()-2); s = s.substr(1,s.size()-2);

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
@ -31,7 +31,7 @@ public:
/** /**
* This is a virtual constructor for the command. * This is a virtual constructor for the command.
*/ */
virtual cmCommand* Clone() virtual cmCommand* Clone()
{ {
return new cmFileCommand; return new cmFileCommand;
} }
@ -55,11 +55,11 @@ public:
/** /**
* Succinct documentation. * Succinct documentation.
*/ */
virtual const char* GetTerseDocumentation() virtual const char* GetTerseDocumentation()
{ {
return "File manipulation command."; return "File manipulation command.";
} }
/** /**
* More documentation. * More documentation.
*/ */
@ -74,7 +74,6 @@ public:
" [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n" " [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n"
" [NEWLINE_CONSUME] [REGEX regex]\n" " [NEWLINE_CONSUME] [REGEX regex]\n"
" [NO_HEX_CONVERSION])\n" " [NO_HEX_CONVERSION])\n"
" FILE(HEX_TO_BIN inputfile outputfile)\n"
" FILE(GLOB variable [RELATIVE path] [globbing expressions]...)\n" " FILE(GLOB variable [RELATIVE path] [globbing expressions]...)\n"
" FILE(GLOB_RECURSE variable [RELATIVE path] \n" " FILE(GLOB_RECURSE variable [RELATIVE path] \n"
" [globbing expressions]...)\n" " [globbing expressions]...)\n"
@ -100,9 +99,6 @@ public:
"return (CR) characters are ignored. It works also for Intel Hex and " "return (CR) characters are ignored. It works also for Intel Hex and "
"Motorola S-record files, which are automatically converted to binary " "Motorola S-record files, which are automatically converted to binary "
"format when reading them. Disable this using NO_HEX_CONVERSION.\n " "format when reading them. Disable this using NO_HEX_CONVERSION.\n "
/* "HEX_TO_BIN will convert an Intel hex file or Motorola S-record file "
"to a binary file. If the input file is no such file it will simply "
"be copied. \n"*/
"LIMIT_COUNT sets the maximum number of strings to return. " "LIMIT_COUNT sets the maximum number of strings to return. "
"LIMIT_INPUT sets the maximum number of bytes to read from " "LIMIT_INPUT sets the maximum number of bytes to read from "
"the input file. " "the input file. "
@ -145,7 +141,7 @@ public:
" a cmake style path into the native path style \\ for windows and / " " a cmake style path into the native path style \\ for windows and / "
"for UNIX."; "for UNIX.";
} }
cmTypeMacro(cmFileCommand, cmCommand); cmTypeMacro(cmFileCommand, cmCommand);
protected: protected:
@ -153,15 +149,14 @@ protected:
bool HandleWriteCommand(std::vector<std::string> const& args, bool append); bool HandleWriteCommand(std::vector<std::string> const& args, bool append);
bool HandleReadCommand(std::vector<std::string> const& args); bool HandleReadCommand(std::vector<std::string> const& args);
bool HandleStringsCommand(std::vector<std::string> const& args); bool HandleStringsCommand(std::vector<std::string> const& args);
// bool HandleHex2BinCommand(std::vector<std::string> const& args);
bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse); bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse);
bool HandleMakeDirectoryCommand(std::vector<std::string> const& args); bool HandleMakeDirectoryCommand(std::vector<std::string> const& args);
bool HandleRelativePathCommand(std::vector<std::string> const& args); bool HandleRelativePathCommand(std::vector<std::string> const& args);
bool HandleCMakePathCommand(std::vector<std::string> const& args, bool HandleCMakePathCommand(std::vector<std::string> const& args,
bool nativePath); bool nativePath);
void ComputeVersionedName(std::string& name, const char* version); void ComputeVersionedName(std::string& name, const char* version);
// FILE(INSTALL ...) related functions // FILE(INSTALL ...) related functions
bool HandleInstallCommand(std::vector<std::string> const& args); bool HandleInstallCommand(std::vector<std::string> const& args);
bool ParseInstallArgs(std::vector<std::string> const& args, bool ParseInstallArgs(std::vector<std::string> const& args,
@ -186,9 +181,9 @@ protected:
const bool optional const bool optional
); );
void GetTargetTypeFromString(const std::string& stype, int& itype) const; void GetTargetTypeFromString(const std::string& stype, int& itype) const;
bool HandleInstallDestination(cmFileInstaller& installer, bool HandleInstallDestination(cmFileInstaller& installer,
std::string& destination); std::string& destination);
void HandleInstallPermissions(cmFileInstaller& installer, void HandleInstallPermissions(cmFileInstaller& installer,
mode_t& permissions_file, mode_t& permissions_file,
mode_t& permissions_dir, mode_t& permissions_dir,
int itype, int itype,