From 435da0ff4f20a9bc55a1bf42cb00711b6e2115fa Mon Sep 17 00:00:00 2001 From: GCC-XML Date: Thu, 15 Dec 2011 15:44:52 -0500 Subject: [PATCH] gccxml 2011-12-15 (db8294b1) --- GCC/gcc/config.gcc | 5 + GCC_XML/KWSys/CommandLineArguments.cxx | 2 +- GCC_XML/KWSys/SystemInformation.cxx | 45 ++--- GCC_XML/KWSys/SystemTools.cxx | 263 +++++++++++++------------ GCC_XML/KWSys/SystemTools.hxx.in | 4 +- GCC_XML/KWSys/kwsysDateStamp.cmake | 4 +- 6 files changed, 163 insertions(+), 160 deletions(-) diff --git a/GCC/gcc/config.gcc b/GCC/gcc/config.gcc index 7cebb52..ee725c9 100644 --- a/GCC/gcc/config.gcc +++ b/GCC/gcc/config.gcc @@ -484,12 +484,17 @@ case ${target} in # support are matched above and just set $cpu_type. tm_file="${cpu_type}/gnu.h" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o" + extra_options="${extra_options} linux.opt" # GNU tools are the only tools. gas=yes gnu_ld=yes + case ${enable_threads} in + "" | yes | posix) thread_file='posix' ;; + esac # These details are the same as for Linux. # But here we need a little extra magic. tmake_file="t-slibgcc-elf-ver t-linux t-gnu" + tm_defines="${tm_defines} UCLIBC_DEFAULT=0" case ${target} in alpha*) tm_file="${cpu_type}/${cpu_type}.h alpha/elf.h alpha/linux.h alpha/linux-elf.h gnu.h ${tm_file}" diff --git a/GCC_XML/KWSys/CommandLineArguments.cxx b/GCC_XML/KWSys/CommandLineArguments.cxx index 9f43a47..ece88ae 100644 --- a/GCC_XML/KWSys/CommandLineArguments.cxx +++ b/GCC_XML/KWSys/CommandLineArguments.cxx @@ -592,7 +592,7 @@ void CommandLineArguments::GenerateHelp() // Create format for that string char format[80]; - sprintf(format, " %%-%ds ", static_cast(maxlen)); + sprintf(format, " %%-%us ", static_cast(maxlen)); maxlen += 4; // For the space before and after the option diff --git a/GCC_XML/KWSys/SystemInformation.cxx b/GCC_XML/KWSys/SystemInformation.cxx index 9bc659e..d49c0d7 100644 --- a/GCC_XML/KWSys/SystemInformation.cxx +++ b/GCC_XML/KWSys/SystemInformation.cxx @@ -72,7 +72,7 @@ # include // int isdigit(int c); # include // extern int errno; # include -#elif __hpux +#elif defined( __hpux ) # include # include #endif @@ -1454,7 +1454,7 @@ bool SystemInformationImplementation::RetrieveCPUClockSpeed() { bool retrieved = false; -#if _WIN32 +#if defined(_WIN32) // First of all we check to see if the RDTSC (0x0F, 0x31) instruction is // supported. If not, we fallback to trying to read this value from the // registry: @@ -2389,7 +2389,7 @@ int SystemInformationImplementation::QueryMemory() this->AvailablePhysicalMemory = 0; #ifdef __CYGWIN__ return 0; -#elif _WIN32 +#elif defined(_WIN32) #if _MSC_VER < 1300 MEMORYSTATUS ms; unsigned long tv, tp, av, ap; @@ -2415,7 +2415,7 @@ int SystemInformationImplementation::QueryMemory() this->AvailableVirtualMemory = av>>10>>10; this->AvailablePhysicalMemory = ap>>10>>10; return 1; -#elif __linux +#elif defined(__linux) unsigned long tv=0; unsigned long tp=0; unsigned long av=0; @@ -2532,7 +2532,7 @@ int SystemInformationImplementation::QueryMemory() } fclose( fd ); return 1; -#elif __hpux +#elif defined(__hpux) unsigned long tv=0; unsigned long tp=0; unsigned long av=0; @@ -2639,7 +2639,7 @@ LongLong SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayF /** Compute the delay overhead */ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS) { -#if _WIN32 +#if defined(_WIN32) LARGE_INTEGER Frequency, StartCounter, EndCounter; __int64 x; @@ -2664,10 +2664,19 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS) /** Return the number of logical CPU per physical CPUs Works only for windows */ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) { +#ifdef __APPLE__ + size_t len = 4; + int cores_per_package = 0; + int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, NULL, 0); + if (err != 0) + { + return 1; // That name was not found, default to 1 + } + return static_cast(cores_per_package); +#else unsigned int Regebx = 0; - #if USE_ASM_INSTRUCTIONS - if (!this->IsHyperThreadingSupported()) + if (!this->IsHyperThreadingSupported()) { return static_cast(1); // HT not supported } @@ -2678,22 +2687,8 @@ unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) mov Regebx, ebx } #endif - -#ifdef __APPLE__ - size_t len = 4; - int cores_per_package = 0; - int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, NULL, 0); - if (err != 0) - { - return 1; // That name was not found, default to 1 - } - else - { - return static_cast(cores_per_package); - } -#endif - return static_cast ((Regebx & NUM_LOGICAL_BITS) >> 16); +#endif } @@ -2769,7 +2764,7 @@ unsigned char SystemInformationImplementation::GetAPICId() /** Count the number of CPUs. Works only on windows. */ int SystemInformationImplementation::CPUCount() { -#if _WIN32 +#if defined(_WIN32) unsigned char StatusFlag = 0; SYSTEM_INFO info; @@ -3359,7 +3354,7 @@ bool SystemInformationImplementation::QueryQNXProcessor() /** Query the operating system information */ bool SystemInformationImplementation::QueryOSInformation() { -#if _WIN32 +#if defined(_WIN32) this->OSName = "Windows"; diff --git a/GCC_XML/KWSys/SystemTools.cxx b/GCC_XML/KWSys/SystemTools.cxx index 695949a..4d83293 100644 --- a/GCC_XML/KWSys/SystemTools.cxx +++ b/GCC_XML/KWSys/SystemTools.cxx @@ -128,7 +128,7 @@ class SystemToolsHack #include #include #define _unlink unlink -#endif +#endif /* The maximum length of a file name. */ #if defined(PATH_MAX) @@ -168,9 +168,9 @@ static inline char *realpath(const char *path, char *resolved_path) snprintf(resolved_path, maxlen, "%s", path); BPath normalized(resolved_path, NULL, true); const char *resolved = normalized.Path(); - if (resolved != NULL) // NULL == No such file. + if (resolved != NULL) // NULL == No such file. { - if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) + if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen) { return resolved_path; } @@ -179,7 +179,7 @@ static inline char *realpath(const char *path, char *resolved_path) } #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) inline int Mkdir(const char* dir) { return _mkdir(dir); @@ -300,7 +300,7 @@ double SystemTools::GetTime(void) #endif } -class SystemToolsTranslationMap : +class SystemToolsTranslationMap : public kwsys_stl::map { }; @@ -326,7 +326,7 @@ void SystemTools::GetPath(kwsys_stl::vector& path, const char kwsys_stl::string pathEnv = cpathEnv; // A hack to make the below algorithm work. - if(pathEnv[pathEnv.length()-1] != ':') + if(!pathEnv.empty() && pathEnv[pathEnv.length()-1] != pathSep[0]) { pathEnv += pathSep; } @@ -371,6 +371,10 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) } } +#ifdef __INTEL_COMPILER +#pragma warning disable 444 +#endif + class kwsysDeletingCharVector : public kwsys_stl::vector { public: @@ -388,7 +392,7 @@ kwsysDeletingCharVector::~kwsysDeletingCharVector() #endif } bool SystemTools::PutEnv(const char* value) -{ +{ static kwsysDeletingCharVector localEnvironment; char* envVar = new char[strlen(value)+1]; strcpy(envVar, value); @@ -399,14 +403,13 @@ bool SystemTools::PutEnv(const char* value) return ret == 0; } - const char* SystemTools::GetExecutableExtension() { #if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS) return ".exe"; #else return ""; -#endif +#endif } @@ -474,7 +477,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, { const char *src = source.c_str(); char *searchPos = const_cast(strstr(src,replace)); - + // get out quick if string is not found if (!searchPos) { @@ -491,7 +494,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, char *orig = strdup(src); char *currentPos = orig; searchPos = searchPos - src + orig; - + // initialize the result source.erase(source.begin(),source.end()); do @@ -543,7 +546,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode, #endif // Read a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will return the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -572,7 +575,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -594,11 +597,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, { primaryKey = HKEY_USERS; } - + HKEY hKey; - if(RegOpenKeyEx(primaryKey, - second.c_str(), - 0, + if(RegOpenKeyEx(primaryKey, + second.c_str(), + 0, SystemToolsMakeRegistryMode(KEY_READ, view), &hKey) != ERROR_SUCCESS) { @@ -609,11 +612,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, DWORD dwType, dwSize; dwSize = 1023; char data[1024]; - if(RegQueryValueEx(hKey, - (LPTSTR)valuename.c_str(), - NULL, - &dwType, - (BYTE *)data, + if(RegQueryValueEx(hKey, + (LPTSTR)valuename.c_str(), + NULL, + &dwType, + (BYTE *)data, &dwSize) == ERROR_SUCCESS) { if (dwType == REG_SZ) @@ -648,7 +651,7 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &, // Write a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will set the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -661,7 +664,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, kwsys_stl::string primary = key; kwsys_stl::string second; kwsys_stl::string valuename; - + size_t start = primary.find("\\"); if (start == kwsys_stl::string::npos) { @@ -676,7 +679,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -698,13 +701,13 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, { primaryKey = HKEY_USERS; } - + HKEY hKey; DWORD dwDummy; char lpClass[] = ""; - if(RegCreateKeyEx(primaryKey, - second.c_str(), - 0, + if(RegCreateKeyEx(primaryKey, + second.c_str(), + 0, lpClass, REG_OPTION_NON_VOLATILE, SystemToolsMakeRegistryMode(KEY_WRITE, view), @@ -715,11 +718,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, return false; } - if(RegSetValueEx(hKey, - (LPTSTR)valuename.c_str(), - 0, - REG_SZ, - (CONST BYTE *)value, + if(RegSetValueEx(hKey, + (LPTSTR)valuename.c_str(), + 0, + REG_SZ, + (CONST BYTE *)value, (DWORD)(strlen(value) + 1)) == ERROR_SUCCESS) { return true; @@ -734,7 +737,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64) #endif // Delete a registry value. -// Example : +// Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath // => will delete the data of the "default" value of the key // HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root @@ -746,7 +749,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) kwsys_stl::string primary = key; kwsys_stl::string second; kwsys_stl::string valuename; - + size_t start = primary.find("\\"); if (start == kwsys_stl::string::npos) { @@ -761,7 +764,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) second = primary.substr(start+1, valuenamepos-start-1); primary = primary.substr(0, start); - + HKEY primaryKey = HKEY_CURRENT_USER; if (primary == "HKEY_CURRENT_USER") { @@ -783,11 +786,11 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) { primaryKey = HKEY_USERS; } - + HKEY hKey; - if(RegOpenKeyEx(primaryKey, - second.c_str(), - 0, + if(RegOpenKeyEx(primaryKey, + second.c_str(), + 0, SystemToolsMakeRegistryMode(KEY_WRITE, view), &hKey) != ERROR_SUCCESS) { @@ -795,7 +798,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) } else { - if(RegDeleteValue(hKey, + if(RegDeleteValue(hKey, (LPTSTR)valuename.c_str()) == ERROR_SUCCESS) { RegCloseKey(hKey); @@ -816,17 +819,17 @@ bool SystemTools::SameFile(const char* file1, const char* file2) #ifdef _WIN32 HANDLE hFile1, hFile2; - hFile1 = CreateFile( file1, - GENERIC_READ, + hFile1 = CreateFile( file1, + GENERIC_READ, FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); - hFile2 = CreateFile( file2, - GENERIC_READ, - FILE_SHARE_READ, + hFile2 = CreateFile( file2, + GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, @@ -860,10 +863,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2) { // see if the files are the same file // check the device inode and size - if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 && + if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 && memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 && - fileStat2.st_size == fileStat1.st_size - ) + fileStat2.st_size == fileStat1.st_size + ) { return true; } @@ -1060,11 +1063,11 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s) #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) // MS has an assert that will fail if s[i] < 0; setting // LC_CTYPE using setlocale() does *not* help. Painful. - if ((int)s[i] >= 0 && isalpha(s[i]) && + if ((int)s[i] >= 0 && isalpha(s[i]) && (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) #else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) -#endif +#endif { n[i] = static_cast(toupper(s[i])); } @@ -1081,11 +1084,11 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s) #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) // MS has an assert that will fail if s[i] < 0; setting // LC_CTYPE using setlocale() does *not* help. Painful. - if ((int)s[i] >= 0 && isalpha(s[i]) && + if ((int)s[i] >= 0 && isalpha(s[i]) && (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1])))) #else if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) -#endif +#endif { n[i] = static_cast(tolower(s[i])); } @@ -1163,7 +1166,7 @@ char* SystemTools::AppendStrings( return newstr; } -// Return a lower case string +// Return a lower case string kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s) { kwsys_stl::string n; @@ -1175,7 +1178,7 @@ kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s) return n; } -// Return a lower case string +// Return a lower case string kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s) { kwsys_stl::string n; @@ -1305,7 +1308,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2) { return NULL; } - + size_t len1 = strlen(str1), len2 = strlen(str2); if (len1 >= len2) { @@ -1333,8 +1336,8 @@ char* SystemTools::DuplicateString(const char* str) return NULL; } -// Return a cropped string -kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, +// Return a cropped string +kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, size_t max_len) { if (!s.size() || max_len == 0 || max_len >= s.size()) @@ -1378,7 +1381,7 @@ kwsys_stl::vector SystemTools::SplitString(const char* p, char se if(isPath && path[0] == '/') { path.erase(path.begin()); - paths.push_back("/"); + paths.push_back("/"); } kwsys_stl::string::size_type pos1 = 0; kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1); @@ -1387,9 +1390,9 @@ kwsys_stl::vector SystemTools::SplitString(const char* p, char se paths.push_back(path.substr(pos1, pos2-pos1)); pos1 = pos2+1; pos2 = path.find(sep, pos1+1); - } + } paths.push_back(path.substr(pos1, pos2-pos1)); - + return paths; } @@ -1403,11 +1406,11 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) // Quick-hack attempt at estimating the length of the string. // Should never under-estimate. - + // Start with the length of the format string itself. size_t length = strlen(format); - + // Increase the length for every argument in the format. const char* cur = format; @@ -1439,7 +1442,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) { // Assume the argument contributes no more than 64 characters. length += 64; - + // Eat the argument. static_cast(va_arg(ap, double)); } break; @@ -1447,24 +1450,24 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) { // Assume the argument contributes no more than 64 characters. length += 64; - + // Eat the argument. static_cast(va_arg(ap, int)); } break; } } - + // Move past the characters just tested. ++cur; } } - + return static_cast(length); } kwsys_stl::string SystemTools::EscapeChars( - const char *str, - const char *chars_to_escape, + const char *str, + const char *chars_to_escape, char escape_char) { kwsys_stl::string n; @@ -1521,7 +1524,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path) } #endif -// convert windows slashes to unix slashes +// convert windows slashes to unix slashes void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) { const char* pathCString = path.c_str(); @@ -1588,7 +1591,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) } } #endif - // remove trailing slash if the path is more than + // remove trailing slash if the path is more than // a single / pathCString = path.c_str(); if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/') @@ -1606,7 +1609,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) { kwsys_stl::string ret = path; - + // remove // except at the beginning might be a cygwin drive kwsys_stl::string::size_type pos=1; while((pos = ret.find("//", pos)) != kwsys_stl::string::npos) @@ -1644,7 +1647,7 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path) // remove double slashes not at the start kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path) -{ +{ kwsys_stl::string ret; // make it big enough for all of path and double quotes ret.reserve(strlen(path)+3); @@ -1730,13 +1733,13 @@ bool SystemTools::FilesDiffer(const char* source, const char* destination) { struct stat statSource; - if (stat(source, &statSource) != 0) + if (stat(source, &statSource) != 0) { return true; } struct stat statDestination; - if (stat(destination, &statDestination) != 0) + if (stat(destination, &statDestination) != 0) { return true; } @@ -1782,7 +1785,7 @@ bool SystemTools::FilesDiffer(const char* source, { return true; } - + // If this block differs the file differs. if(memcmp(static_cast(source_buf), static_cast(dest_buf), @@ -1841,7 +1844,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) // Open files #if defined(_WIN32) || defined(__CYGWIN__) - kwsys_ios::ifstream fin(source, + kwsys_ios::ifstream fin(source, kwsys_ios::ios::binary | kwsys_ios::ios::in); #else kwsys_ios::ifstream fin(source); @@ -1850,7 +1853,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) { return false; } - + // try and remove the destination file so that read only destination files // can be written to. // If the remove fails continue so that files in read only directories @@ -1858,17 +1861,17 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) SystemTools::RemoveFile(destination); #if defined(_WIN32) || defined(__CYGWIN__) - kwsys_ios::ofstream fout(destination, + kwsys_ios::ofstream fout(destination, kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc); #else - kwsys_ios::ofstream fout(destination, + kwsys_ios::ofstream fout(destination, kwsys_ios::ios::out | kwsys_ios::ios::trunc); #endif if(!fout) { return false; } - + // This copy loop is very sensitive on certain platforms with // slightly broken stream libraries (like HPUX). Normally, it is // incorrect to not check the error condition on the fin.read() @@ -1882,12 +1885,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination) fout.write(buffer, fin.gcount()); } } - + // Make sure the operating system has finished writing the file // before closing it. This will ensure the file is finished before // the check below. fout.flush(); - + fin.close(); fout.close(); @@ -1971,7 +1974,7 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, unsigned long SystemTools::FileLength(const char* filename) { struct stat fs; - if (stat(filename, &fs) != 0) + if (stat(filename, &fs) != 0) { return 0; } @@ -2217,7 +2220,7 @@ ::FindName(const char* name, { // Add the system search path to our path first kwsys_stl::vector path; - if (!no_system_path) + if (!no_system_path) { SystemTools::GetPath(path, "CMAKE_FILE_PATH"); SystemTools::GetPath(path); @@ -2332,7 +2335,7 @@ kwsys_stl::string SystemTools::FindProgram( // first try with extensions if the os supports them if(extensions.size()) { - for(kwsys_stl::vector::iterator i = + for(kwsys_stl::vector::iterator i = extensions.begin(); i != extensions.end(); ++i) { tryPath = name; @@ -2360,7 +2363,7 @@ kwsys_stl::string SystemTools::FindProgram( } // now add the additional paths { - for(kwsys_stl::vector::const_iterator i = + for(kwsys_stl::vector::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2389,7 +2392,7 @@ kwsys_stl::string SystemTools::FindProgram( // first try with extensions if(extensions.size()) { - for(kwsys_stl::vector::iterator ext + for(kwsys_stl::vector::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { tryPath = *p; @@ -2954,7 +2957,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot } // split up both paths into arrays of strings using / as a separator - kwsys_stl::vector localSplit = SystemTools::SplitString(local, '/', true); + kwsys_stl::vector localSplit = SystemTools::SplitString(local, '/', true); kwsys_stl::vector remoteSplit = SystemTools::SplitString(remote, '/', true); kwsys_stl::vector commonPath; // store shared parts of path in this array kwsys_stl::vector finalPath; // store the final relative path here @@ -3011,7 +3014,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot } } kwsys_stl::string relativePath; // result string - // now turn the array of directories into a unix path by puttint / + // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one for(kwsys_stl::vector::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) @@ -3388,7 +3391,7 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename { kwsys_stl::string fn = filename; SystemTools::ConvertToUnixSlashes(fn); - + kwsys_stl::string::size_type slash_pos = fn.rfind("/"); if(slash_pos != kwsys_stl::string::npos) { @@ -3507,7 +3510,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename) } bool SystemTools::FileHasSignature(const char *filename, - const char *signature, + const char *signature, long offset) { if (!filename || !signature) @@ -3539,9 +3542,9 @@ bool SystemTools::FileHasSignature(const char *filename, return res; } -SystemTools::FileTypeEnum +SystemTools::FileTypeEnum SystemTools::DetectFileType(const char *filename, - unsigned long length, + unsigned long length, double percent_bin) { if (!filename || percent_bin < 0) @@ -3569,13 +3572,13 @@ SystemTools::DetectFileType(const char *filename, // Loop over contents and count size_t text_count = 0; - + const unsigned char *ptr = buffer; const unsigned char *buffer_end = buffer + read_length; while (ptr != buffer_end) { - if ((*ptr >= 0x20 && *ptr <= 0x7F) || + if ((*ptr >= 0x20 && *ptr <= 0x7F) || *ptr == '\n' || *ptr == '\r' || *ptr == '\t') @@ -3587,7 +3590,7 @@ SystemTools::DetectFileType(const char *filename, delete [] buffer; - double current_percent_bin = + double current_percent_bin = (static_cast(read_length - text_count) / static_cast(read_length)); @@ -3599,8 +3602,8 @@ SystemTools::DetectFileType(const char *filename, return SystemTools::FileTypeText; } -bool SystemTools::LocateFileInDir(const char *filename, - const char *dir, +bool SystemTools::LocateFileInDir(const char *filename, + const char *dir, kwsys_stl::string& filename_found, int try_filename_dirs) { @@ -3613,7 +3616,7 @@ bool SystemTools::LocateFileInDir(const char *filename, kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename); - // Check if 'dir' is really a directory + // Check if 'dir' is really a directory // If win32 and matches something like C:, accept it as a dir kwsys_stl::string real_dir; @@ -3637,7 +3640,7 @@ bool SystemTools::LocateFileInDir(const char *filename, if (filename_base.size() && dir) { size_t dir_len = strlen(dir); - int need_slash = + int need_slash = (dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\'); kwsys_stl::string temp = dir; @@ -3668,7 +3671,7 @@ bool SystemTools::LocateFileInDir(const char *filename, filename_dir = SystemTools::GetFilenamePath(filename_dir); filename_dir_base = SystemTools::GetFilenameName(filename_dir); #if defined( _WIN32 ) - if (!filename_dir_base.size() || + if (!filename_dir_base.size() || filename_dir_base[filename_dir_base.size() - 1] == ':') #else if (!filename_dir_base.size()) @@ -3692,7 +3695,7 @@ bool SystemTools::LocateFileInDir(const char *filename, } while (!res && filename_dir_base.size()); } } - + return res; } @@ -3738,12 +3741,12 @@ bool SystemTools::FileIsFullPath(const char* in_name) bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) { -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(WIN32) && !defined(__CYGWIN__) const int size = int(strlen(path)) +1; // size of return char *buffer = new char[size]; // create a buffer char *tempPath = new char[size]; // create a buffer int ret; - + // if the path passed in has quotes around it, first remove the quotes if (path[0] == '"' && path[strlen(path)-1] == '"') { @@ -3754,7 +3757,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) { strcpy(tempPath,path); } - + buffer[0] = 0; ret = GetShortPathName(tempPath, buffer, size); @@ -3777,7 +3780,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath) #endif } -void SystemTools::SplitProgramFromArgs(const char* path, +void SystemTools::SplitProgramFromArgs(const char* path, kwsys_stl::string& program, kwsys_stl::string& args) { // see if this is a full path to a program @@ -3789,7 +3792,7 @@ void SystemTools::SplitProgramFromArgs(const char* path, return; } // Try to find the program in the path, note the program - // may have spaces in its name so we have to look for it + // may have spaces in its name so we have to look for it kwsys_stl::vector e; kwsys_stl::string findProg = SystemTools::FindProgram(path, e); if(findProg.size()) @@ -3820,7 +3823,7 @@ void SystemTools::SplitProgramFromArgs(const char* path, args = dir.substr(spacePos, dir.size()-spacePos); return; } - // Now try and find the the program in the path + // Now try and find the the program in the path findProg = SystemTools::FindProgram(tryProg.c_str(), e); if(findProg.size()) { @@ -4195,23 +4198,23 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO *)&osvi)) + if (!GetVersionEx((OSVERSIONINFO *)&osvi)) { return 0; } } - + switch (osvi.dwPlatformId) { // Test for the Windows NT product family. case VER_PLATFORM_WIN32_NT: - + // Test for the specific product family. if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) { -#if (_MSC_VER >= 1300) +#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { res += "Microsoft Windows Vista"; @@ -4251,7 +4254,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() { // Test for the workstation type. -#if (_MSC_VER >= 1300) +#if (_MSC_VER >= 1300) if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.dwMajorVersion == 4) @@ -4270,7 +4273,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } } - + // Test for the server type. else if (osvi.wProductType == VER_NT_SERVER) @@ -4294,7 +4297,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() res += " Standard Edition"; } } - + else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) @@ -4311,7 +4314,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } - else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 + else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 { if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { @@ -4328,7 +4331,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Test for specific product on Windows NT 4.0 SP5 and earlier - else + else { HKEY hKey; #define BUFSIZE 80 @@ -4378,7 +4381,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Display service pack (if any) and build number. - if (osvi.dwMajorVersion == 4 && + if (osvi.dwMajorVersion == 4 && lstrcmpi(osvi.szCSDVersion, "Service Pack 6") == 0) { HKEY hKey; @@ -4407,7 +4410,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() res += buffer; res += ")"; } - + RegCloseKey(hKey); } else // Windows NT 3.51 and earlier or Windows 2000 and later @@ -4447,11 +4450,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { res += "Microsoft Windows Millennium Edition"; - } + } break; case VER_PLATFORM_WIN32s: - + res += "Microsoft Win32s"; break; } @@ -4461,7 +4464,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } // ---------------------------------------------------------------------- -bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, +bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, kwsys_stl::string& protocol, kwsys_stl::string& dataglom ) { @@ -4479,12 +4482,12 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, } // ---------------------------------------------------------------------- -bool SystemTools::ParseURL( const kwsys_stl::string& URL, +bool SystemTools::ParseURL( const kwsys_stl::string& URL, kwsys_stl::string& protocol, - kwsys_stl::string& username, - kwsys_stl::string& password, - kwsys_stl::string& hostname, - kwsys_stl::string& dataport, + kwsys_stl::string& username, + kwsys_stl::string& password, + kwsys_stl::string& hostname, + kwsys_stl::string& dataport, kwsys_stl::string& database ) { kwsys::RegularExpression urlRe( VTK_URL_REGEX ); @@ -4507,7 +4510,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL, hostname = urlRe.match( 6 ); dataport = urlRe.match( 8 ); database = urlRe.match( 9 ); - + return true; } diff --git a/GCC_XML/KWSys/SystemTools.hxx.in b/GCC_XML/KWSys/SystemTools.hxx.in index fd2ed19..04f1978 100644 --- a/GCC_XML/KWSys/SystemTools.hxx.in +++ b/GCC_XML/KWSys/SystemTools.hxx.in @@ -612,7 +612,7 @@ public: * Up to 'length' bytes are read from the file, if more than 'percent_bin' % * of the bytes are non-textual elements, the file is considered binary, * otherwise textual. Textual elements are bytes in the ASCII [0x20, 0x7E] - * range, but also \n, \r, \t. + * range, but also \\n, \\r, \\t. * The algorithm is simplistic, and should probably check for usual file * extensions, 'magic' signature, unicode, etc. */ @@ -812,7 +812,7 @@ public: * Convert windows-style arguments given as a command-line string * into more traditional argc/argv arguments. * Note that argv[0] will be assigned the executable name using - * the ::GetModuleFileName function. + * the GetModuleFileName() function. */ static void ConvertWindowsCommandLineToUnixArguments( const char *cmd_line, int *argc, char ***argv); diff --git a/GCC_XML/KWSys/kwsysDateStamp.cmake b/GCC_XML/KWSys/kwsysDateStamp.cmake index 79825b2..a60594a 100644 --- a/GCC_XML/KWSys/kwsysDateStamp.cmake +++ b/GCC_XML/KWSys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 10) +SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 07) +SET(KWSYS_DATE_STAMP_DAY 15)