From d9aece1130be2f7574e78a188930cf7715d5e18d Mon Sep 17 00:00:00 2001 From: GCC-XML Date: Fri, 17 Oct 2008 12:52:03 -0400 Subject: [PATCH] gccxml 2008-10-17 (c041a124) --- GCC/gcc/cp/xml.c | 35 +- GCC/gcc/diagnostic.c | 18 + GCC_XML/KWSys/CMakeLists.txt | 39 +- GCC_XML/KWSys/DynamicLoader.cxx | 14 +- GCC_XML/KWSys/DynamicLoader.hxx.in | 2 + GCC_XML/KWSys/Glob.cxx | 15 +- GCC_XML/KWSys/Glob.hxx.in | 12 + GCC_XML/KWSys/ProcessUNIX.c | 23 +- GCC_XML/KWSys/SharedForward.h.in | 210 ++++++- GCC_XML/KWSys/SystemInformation.cxx | 35 +- GCC_XML/KWSys/SystemTools.cxx | 42 +- GCC_XML/KWSys/kwsysDateStamp.cmake | 4 +- GCC_XML/KWSys/testDynamicLoader.cxx | 8 +- GCC_XML/KWSys/testProcess.c | 4 +- GCC_XML/KWSys/testSharedForward.c.in | 38 ++ GCC_XML/Support/GCC/3.4/bits/gthr-default.h | 664 ++++++++++++++++++++ GCC_XML/Support/GCC/find_flags | 13 +- GCC_XML/VcInstall/vcInstall.cxx | 17 +- 18 files changed, 1130 insertions(+), 63 deletions(-) create mode 100644 GCC_XML/KWSys/testSharedForward.c.in create mode 100644 GCC_XML/Support/GCC/3.4/bits/gthr-default.h diff --git a/GCC/gcc/cp/xml.c b/GCC/gcc/cp/xml.c index 7275b16..9c88de7 100644 --- a/GCC/gcc/cp/xml.c +++ b/GCC/gcc/cp/xml.c @@ -65,7 +65,7 @@ along with this program; if not, write to the #include "toplev.h" /* ident_hash */ -#define GCC_XML_C_VERSION "$Revision: 1.123 $" +#define GCC_XML_C_VERSION "$Revision: 1.124 $" /*--------------------------------------------------------------------------*/ /* Data structures for the actual XML dump. */ @@ -3232,6 +3232,9 @@ xml_dump_tree_node (xml_dump_info_p xdi, tree n, xml_dump_node_p dn) # undef xml_add_node #endif +/* Hook to suppress diagnostic messages during synthesize test. */ +extern int diagnostic_xml_synthesize_test; + /* Add tree node N to those encountered. Return its index. */ int xml_add_node (xml_dump_info_p xdi, tree n, int complete) @@ -3250,6 +3253,36 @@ xml_add_node (xml_dump_info_p xdi, tree n, int complete) return 0; } + /* Skip invalid compiler-generated functions. These can occur for + code such as + + struct A { A(); const int a; }; + + when the GCC parser produces the declaration but reports an error + if the definition is actually needed. */ + if (TREE_CODE (n) == FUNCTION_DECL && + DECL_ARTIFICIAL (n) && !DECL_INITIAL (n) && + (!DECL_REALLY_EXTERN (n) || DECL_INLINE (n))) + { + /* We try to synthesize this function but suppress error messages. */ + diagnostic_xml_synthesize_test = 1; + + /* Taken from cp_finish_file. */ + push_to_top_level (); + input_location = DECL_SOURCE_LOCATION (n); + synthesize_method (n); + pop_from_top_level (); + + /* If an error occurred (and was suppressed) then this function is + invalid and should not be included. */ + if(diagnostic_xml_synthesize_test > 1) + { + diagnostic_xml_synthesize_test = 0; + return 0; + } + diagnostic_xml_synthesize_test = 0; + } + /* Some nodes don't need to be dumped and just refer to other nodes. These nodes should can have index zero because they should never be referenced. */ diff --git a/GCC/gcc/diagnostic.c b/GCC/gcc/diagnostic.c index 30d91c4..ccedb6a 100644 --- a/GCC/gcc/diagnostic.c +++ b/GCC/gcc/diagnostic.c @@ -165,6 +165,21 @@ diagnostic_build_prefix (diagnostic_info *diagnostic) : build_message_string ("%s:%d: %s", s.file, s.line, text)); } +/* BEGIN GCC-XML MODIFICATIONS 2008-10-01 */ +/* xml.c uses this to suppress error messages when testing whether + synthesizing an artificially-generated function succeeds. */ +int diagnostic_xml_synthesize_test = 0; +static bool diagnostic_in_xml_synthesize_test() +{ + if(diagnostic_xml_synthesize_test) + { + ++diagnostic_xml_synthesize_test; + return true; + } + return false; +} +/* END GCC-XML MODIFICATIONS 2008-10-01 */ + /* Count a diagnostic. Return true if the message should be printed. */ static bool diagnostic_count_diagnostic (diagnostic_context *context, @@ -224,6 +239,9 @@ diagnostic_count_diagnostic (diagnostic_context *context, /* And fall through. */ case DK_ERROR: +/* BEGIN GCC-XML MODIFICATIONS 2008-10-01 */ + if(diagnostic_in_xml_synthesize_test()) { return false; } +/* END GCC-XML MODIFICATIONS 2008-10-01 */ ++diagnostic_kind_count (context, DK_ERROR); break; } diff --git a/GCC_XML/KWSys/CMakeLists.txt b/GCC_XML/KWSys/CMakeLists.txt index 8d5a46d..2c64055 100644 --- a/GCC_XML/KWSys/CMakeLists.txt +++ b/GCC_XML/KWSys/CMakeLists.txt @@ -154,7 +154,24 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_USE_SystemInformation 1) SET(KWSYS_USE_CPU 1) ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) - + +# Enforce component dependencies. +IF(KWSYS_USE_SystemTools) + SET(KWSYS_USE_Directory 1) +ENDIF(KWSYS_USE_SystemTools) +IF(KWSYS_USE_Glob) + SET(KWSYS_USE_Directory 1) + SET(KWSYS_USE_SystemTools 1) + SET(KWSYS_USE_RegularExpression 1) +ENDIF(KWSYS_USE_Glob) +IF(KWSYS_USE_Process) + SET(KWSYS_USE_System 1) +ENDIF(KWSYS_USE_Process) +IF(KWSYS_USE_SystemInformation) + SET(KWSYS_USE_FundamentalType 1) + SET(KWSYS_USE_Process 1) +ENDIF(KWSYS_USE_SystemInformation) + # Setup the large file support default. IF(KWSYS_LFS_DISABLE) SET(KWSYS_LFS_REQUESTED 0) @@ -635,19 +652,6 @@ SET(KWSYS_HXX_FILES Configure String auto_ptr ) -# Enforce component dependencies. -IF(KWSYS_USE_SystemTools) - SET(KWSYS_USE_Directory 1) -ENDIF(KWSYS_USE_SystemTools) -IF(KWSYS_USE_Glob) - SET(KWSYS_USE_Directory 1) - SET(KWSYS_USE_SystemTools 1) - SET(KWSYS_USE_RegularExpression 1) -ENDIF(KWSYS_USE_Glob) -IF(KWSYS_USE_Process) - SET(KWSYS_USE_System 1) -ENDIF(KWSYS_USE_Process) - # Add selected C++ classes. SET(cppclasses Directory DynamicLoader Glob RegularExpression SystemTools @@ -992,6 +996,13 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ADD_TEST(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n}) ENDFOREACH(n) + # Test SharedForward + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/testSharedForward.c.in + ${PROJECT_BINARY_DIR}/testSharedForward.c @ONLY IMMEDIATE) + ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestSharedForward + ${PROJECT_BINARY_DIR}/testSharedForward.c) + ADD_TEST(kwsys.testSharedForward ${EXEC_DIR}/${KWSYS_NAMESPACE}TestSharedForward 1) + # Configure some test properties. IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE) # We expect test to fail diff --git a/GCC_XML/KWSys/DynamicLoader.cxx b/GCC_XML/KWSys/DynamicLoader.cxx index ff6da4f..672dee5 100644 --- a/GCC_XML/KWSys/DynamicLoader.cxx +++ b/GCC_XML/KWSys/DynamicLoader.cxx @@ -335,11 +335,21 @@ const char* DynamicLoader::LastError() #endif //_WIN32 // --------------------------------------------------------------- -// 4. Implementation for BeOS -#ifdef __BEOS__ +// 4. Implementation for BeOS / Haiku +#if defined __BEOS__ || defined(__HAIKU__) + #include // for strerror() + +#ifdef __BEOS__ #include #include +#endif + +#ifdef __HAIKU__ +#include +#include +#endif + #define DYNAMICLOADER_DEFINED 1 namespace KWSYS_NAMESPACE diff --git a/GCC_XML/KWSys/DynamicLoader.hxx.in b/GCC_XML/KWSys/DynamicLoader.hxx.in index 5910c52..a30ee6b 100644 --- a/GCC_XML/KWSys/DynamicLoader.hxx.in +++ b/GCC_XML/KWSys/DynamicLoader.hxx.in @@ -25,6 +25,8 @@ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 #include #endif +#elif defined(__HAIKU__) + #include #elif defined(__BEOS__) #include #endif diff --git a/GCC_XML/KWSys/Glob.cxx b/GCC_XML/KWSys/Glob.cxx index 0518132..b6705fd 100644 --- a/GCC_XML/KWSys/Glob.cxx +++ b/GCC_XML/KWSys/Glob.cxx @@ -63,6 +63,11 @@ Glob::Glob() this->Internals = new GlobInternals; this->Recurse = false; this->Relative = ""; + + this->RecurseThroughSymlinks = true; + // RecurseThroughSymlinks is true by default for backwards compatibility, + // not because it's a good idea... + this->FollowedSymlinkCount = 0; } //---------------------------------------------------------------------------- @@ -262,7 +267,15 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, } if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) ) { - this->RecurseDirectory(start+1, realname, dir_only); + bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str()); + if (!isSymLink || this->RecurseThroughSymlinks) + { + if (isSymLink) + { + ++this->FollowedSymlinkCount; + } + this->RecurseDirectory(start+1, realname, dir_only); + } } } } diff --git a/GCC_XML/KWSys/Glob.hxx.in b/GCC_XML/KWSys/Glob.hxx.in index 9ede865..690dad9 100644 --- a/GCC_XML/KWSys/Glob.hxx.in +++ b/GCC_XML/KWSys/Glob.hxx.in @@ -57,6 +57,16 @@ public: void SetRecurse(bool i) { this->Recurse = i; } bool GetRecurse() { return this->Recurse; } + //! Set recurse through symlinks to true if recursion should traverse the + // linked-to directories + void RecurseThroughSymlinksOn() { this->SetRecurseThroughSymlinks(true); } + void RecurseThroughSymlinksOff() { this->SetRecurseThroughSymlinks(false); } + void SetRecurseThroughSymlinks(bool i) { this->RecurseThroughSymlinks = i; } + bool GetRecurseThroughSymlinks() { return this->RecurseThroughSymlinks; } + + //! Get the number of symlinks followed through recursion + unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; } + //! Set relative to true to only show relative path to files. void SetRelative(const char* dir); const char* GetRelative(); @@ -90,6 +100,8 @@ protected: GlobInternals* Internals; bool Recurse; kwsys_stl::string Relative; + bool RecurseThroughSymlinks; + unsigned int FollowedSymlinkCount; private: Glob(const Glob&); // Not implemented. diff --git a/GCC_XML/KWSys/ProcessUNIX.c b/GCC_XML/KWSys/ProcessUNIX.c index 757dc91..b7526f1 100644 --- a/GCC_XML/KWSys/ProcessUNIX.c +++ b/GCC_XML/KWSys/ProcessUNIX.c @@ -63,6 +63,10 @@ do. #include /* DIR, dirent */ #include /* isspace */ +#ifdef __HAIKU__ +#undef __BEOS__ +#endif + #if defined(KWSYS_C_HAS_PTRDIFF_T) && KWSYS_C_HAS_PTRDIFF_T typedef ptrdiff_t kwsysProcess_ptrdiff_t; #else @@ -75,7 +79,7 @@ typedef ssize_t kwsysProcess_ssize_t; typedef int kwsysProcess_ssize_t; #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void kwsysProcess_usleep(unsigned int msec) @@ -770,14 +774,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } -#if !KWSYSPE_USE_SELECT + /* Set to non-blocking in case select lies, or for the polling + implementation. */ if(!kwsysProcessSetNonBlocking(p[0])) { kwsysProcessCleanup(cp, 1); kwsysProcessCleanupDescriptor(&si.StdErr); return; } -#endif } /* Replace the stderr pipe with a file if requested. In this case @@ -830,14 +834,12 @@ void kwsysProcess_Execute(kwsysProcess* cp) failed = 1; } -#if !KWSYSPE_USE_SELECT - /* Set the output pipe of the last process to be non-blocking so - we can poll it. */ - if(i == cp->NumberOfCommands-1 && !kwsysProcessSetNonBlocking(readEnd)) + /* Set the output pipe of the last process to be non-blocking in + case select lies, or for the polling implementation. */ + if(i == (cp->NumberOfCommands-1) && !kwsysProcessSetNonBlocking(readEnd)) { failed = 1; } -#endif if(failed) { @@ -1057,6 +1059,11 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, return 1; } } + else if(n < 0 && errno == EAGAIN) + { + /* No data are really ready. The select call lied. See the + "man select" page on Linux for cases when this occurs. */ + } else { /* We are done reading from this pipe. */ diff --git a/GCC_XML/KWSys/SharedForward.h.in b/GCC_XML/KWSys/SharedForward.h.in index e2fa38c..5b0b2ee 100644 --- a/GCC_XML/KWSys/SharedForward.h.in +++ b/GCC_XML/KWSys/SharedForward.h.in @@ -157,8 +157,10 @@ # include # include # include +# define KWSYS_SHARED_FORWARD_ESCAPE_ARGV /* re-escape argv for execvp */ #else # include +# include #endif /*--------------------------------------------------------------------------*/ @@ -268,6 +270,146 @@ static const char kwsys_shared_forward_path_slash[2] = {KWSYS_SHARED_FORWARD_PAT # define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" #endif +#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV +/*--------------------------------------------------------------------------*/ +typedef struct kwsys_sf_arg_info_s +{ + const char* arg; + int size; + int quote; +} kwsys_sf_arg_info; + +/*--------------------------------------------------------------------------*/ +static kwsys_sf_arg_info kwsys_sf_get_arg_info(const char* in) +{ + /* Initialize information. */ + kwsys_sf_arg_info info; + + /* String iterator. */ + const char* c; + + /* Keep track of how many backslashes have been encountered in a row. */ + int windows_backslashes = 0; + + /* Start with the length of the original argument, plus one for + either a terminating null or a separating space. */ + info.arg = in; + info.size = (int)strlen(in) + 1; + info.quote = 0; + + /* Scan the string for characters that require escaping or quoting. */ + for(c=in; *c; ++c) + { + /* Check whether this character needs quotes. */ + if(strchr(" \t?'#&<>|^", *c)) + { + info.quote = 1; + } + + /* On Windows only backslashes and double-quotes need escaping. */ + if(*c == '\\') + { + /* Found a backslash. It may need to be escaped later. */ + ++windows_backslashes; + } + else if(*c == '"') + { + /* Found a double-quote. We need to escape it and all + immediately preceding backslashes. */ + info.size += windows_backslashes + 1; + windows_backslashes = 0; + } + else + { + /* Found another character. This eliminates the possibility + that any immediately preceding backslashes will be + escaped. */ + windows_backslashes = 0; + } + } + + /* Check whether the argument needs surrounding quotes. */ + if(info.quote) + { + /* Surrounding quotes are needed. Allocate space for them. */ + info.size += 2; + + /* We must escape all ending backslashes when quoting on windows. */ + info.size += windows_backslashes; + } + + return info; +} + +/*--------------------------------------------------------------------------*/ +static char* kwsys_sf_get_arg(kwsys_sf_arg_info info, char* out) +{ + /* String iterator. */ + const char* c; + + /* Keep track of how many backslashes have been encountered in a row. */ + int windows_backslashes = 0; + + /* Whether the argument must be quoted. */ + if(info.quote) + { + /* Add the opening quote for this argument. */ + *out++ = '"'; + } + + /* Scan the string for characters that require escaping or quoting. */ + for(c=info.arg; *c; ++c) + { + /* On Windows only backslashes and double-quotes need escaping. */ + if(*c == '\\') + { + /* Found a backslash. It may need to be escaped later. */ + ++windows_backslashes; + } + else if(*c == '"') + { + /* Found a double-quote. Escape all immediately preceding + backslashes. */ + while(windows_backslashes > 0) + { + --windows_backslashes; + *out++ = '\\'; + } + + /* Add the backslash to escape the double-quote. */ + *out++ = '\\'; + } + else + { + /* We encountered a normal character. This eliminates any + escaping needed for preceding backslashes. */ + windows_backslashes = 0; + } + + /* Store this character. */ + *out++ = *c; + } + + if(info.quote) + { + /* Add enough backslashes to escape any trailing ones. */ + while(windows_backslashes > 0) + { + --windows_backslashes; + *out++ = '\\'; + } + + /* Add the closing quote for this argument. */ + *out++ = '"'; + } + + /* Store a terminating null without incrementing. */ + *out = 0; + + return out; +} +#endif + /*--------------------------------------------------------------------------*/ /* Function to convert a logical or relative path to a physical full path. */ static int kwsys_shared_forward_realpath(const char* in_path, char* out_path) @@ -283,6 +425,37 @@ static int kwsys_shared_forward_realpath(const char* in_path, char* out_path) #endif } +/*--------------------------------------------------------------------------*/ +static int kwsys_shared_forward_samepath(const char* file1, const char* file2) +{ +#if defined(_WIN32) + int result = 0; + HANDLE h1 = CreateFile(file1, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + HANDLE h2 = CreateFile(file2, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if(h1 != INVALID_HANDLE_VALUE && h2 != INVALID_HANDLE_VALUE) + { + BY_HANDLE_FILE_INFORMATION fi1; + BY_HANDLE_FILE_INFORMATION fi2; + GetFileInformationByHandle(h1, &fi1); + GetFileInformationByHandle(h2, &fi2); + result = (fi1.dwVolumeSerialNumber == fi2.dwVolumeSerialNumber && + fi1.nFileIndexHigh == fi2.nFileIndexHigh && + fi1.nFileIndexLow == fi2.nFileIndexLow); + } + CloseHandle(h1); + CloseHandle(h2); + return result; +#else + struct stat fs1, fs2; + return (stat(file1, &fs1) == 0 && stat(file2, &fs2) == 0 && + memcmp(&fs2.st_dev, &fs1.st_dev, sizeof(fs1.st_dev)) == 0 && + memcmp(&fs2.st_ino, &fs1.st_ino, sizeof(fs1.st_ino)) == 0 && + fs2.st_size == fs1.st_size); +#endif +} + /*--------------------------------------------------------------------------*/ /* Function to report a system error message. */ static void kwsys_shared_forward_strerror(char* message) @@ -309,10 +482,39 @@ static void kwsys_shared_forward_strerror(char* message) /*--------------------------------------------------------------------------*/ /* Functions to execute a child process. */ -static void kwsys_shared_forward_execvp(const char* cmd, char* const argv[]) +static void kwsys_shared_forward_execvp(const char* cmd, char* const* argv) { +#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV + /* Count the number of arguments. */ + int argc = 0; + { + char* const* argvc; + for(argvc = argv; *argvc; ++argvc,++argc) {} + } + + /* Create the escaped arguments. */ + { + char** nargv = (char**)malloc((argc+1) * sizeof(char*)); + int i; + for(i=0; i < argc; ++i) + { + kwsys_sf_arg_info info = kwsys_sf_get_arg_info(argv[i]); + nargv[i] = (char*)malloc(info.size); + kwsys_sf_get_arg(info, nargv[i]); + } + nargv[argc] = 0; + + /* Replace the command line to be used. */ + argv = nargv; + } +#endif + + /* Invoke the child process. */ #if defined(_MSC_VER) _execvp(cmd, argv); +#elif defined(__MINGW32__) + /* Avoid incompatible pointer warning with a cast. */ + execvp(cmd, (char const* const*)argv); #else execvp(cmd, argv); #endif @@ -329,7 +531,7 @@ static void kwsys_shared_forward_dirname(const char* begin, char* result) { if(*end == '/' || *end == '\\') { - last_slash_index = end-begin; + last_slash_index = (int)(end-begin); } } @@ -428,7 +630,7 @@ static int kwsys_shared_forward_self_path(const char* argv0, char* result) if(first < last) { /* Determine the length without trailing slash. */ - int length = last-first; + int length = (int)(last-first); if(*(last-1) == '/' || *(last-1) == '\\') { --length; @@ -535,7 +737,7 @@ static int kwsys_shared_forward_get_settings(const char* self_path, /* Check whether we are running in the build tree or an install tree. */ if(kwsys_shared_forward_realpath(build_path, build_path_real) && - strcmp(self_path_real, build_path_real) == 0) + kwsys_shared_forward_samepath(self_path_real, build_path_real)) { /* Running in build tree. Use the build path and exe. */ search_path = search_path_build; diff --git a/GCC_XML/KWSys/SystemInformation.cxx b/GCC_XML/KWSys/SystemInformation.cxx index daf7ba3..08a7d17 100644 --- a/GCC_XML/KWSys/SystemInformation.cxx +++ b/GCC_XML/KWSys/SystemInformation.cxx @@ -13,6 +13,10 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ +#ifdef _WIN32 +# include // WSADATA, include before sys/types.h +#endif + #include "kwsysPrivate.h" #include KWSYS_HEADER(FundamentalType.h) #include KWSYS_HEADER(stl/string) @@ -2147,7 +2151,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() FILE *fd = fopen("/proc/cpuinfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_stl::endl; + kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl; return 0; } @@ -2279,7 +2283,7 @@ int SystemInformationImplementation::QueryMemory() int errorFlag = uname(&unameInfo); if( errorFlag!=0 ) { - kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_stl::endl; + kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl; return 0; } @@ -2303,7 +2307,7 @@ int SystemInformationImplementation::QueryMemory() FILE *fd = fopen("/proc/meminfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_stl::endl; + kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl; return 0; } @@ -2810,7 +2814,7 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< { // Should not get here. kwsys_ios::cerr << "Unexpected ending state after running " << args[0] - << kwsys_stl::endl; + << kwsys_ios::endl; } break; } kwsysProcess_Delete(gp); @@ -2980,15 +2984,22 @@ bool SystemInformationImplementation::QueryOSInformation() { if (osvi.wProductType == VER_NT_WORKSTATION) { -// VER_SUITE_PERSONAL may not be defined -#ifdef VER_SUITE_PERSONAL - if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + if (osvi.dwMajorVersion == 6) { - this->OSRelease += " Personal"; + this->OSRelease = "Vista"; } - else +// VER_SUITE_PERSONAL may not be defined +#ifdef VER_SUITE_PERSONAL + else { - this->OSRelease += " Professional"; + if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + { + this->OSRelease += " Personal"; + } + else + { + this->OSRelease += " Professional"; + } } #endif } @@ -3015,7 +3026,7 @@ bool SystemInformationImplementation::QueryOSInformation() } } - sprintf (operatingSystem, "%s(Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem, "%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } else @@ -3095,7 +3106,7 @@ bool SystemInformationImplementation::QueryOSInformation() else { // Windows 2000 and everything else. - sprintf (operatingSystem,"%s(Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem,"%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } break; diff --git a/GCC_XML/KWSys/SystemTools.cxx b/GCC_XML/KWSys/SystemTools.cxx index 237862e..e443d26 100644 --- a/GCC_XML/KWSys/SystemTools.cxx +++ b/GCC_XML/KWSys/SystemTools.cxx @@ -131,7 +131,12 @@ class SystemToolsHack #define _chdir chdir #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__HAIKU__) +#include +#include +#endif + +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) #include #include @@ -3382,7 +3387,7 @@ kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& fil /** * Return file extension of a full filename (dot included). - * Warning: this is the shortest extension (for example: .tar.gz) + * Warning: this is the shortest extension (for example: .gz of .tar.gz) */ kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename) { @@ -4165,6 +4170,22 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() // Test for the specific product family. + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) + { +#if (_MSC_VER >= 1300) + if (osvi.wProductType == VER_NT_WORKSTATION) + { + res += "Microsoft Windows Vista"; + } + else + { + res += "Microsoft Windows Server 2008 family"; + } +#else + res += "Microsoft Windows Vista or Windows Server 2008"; +#endif + } + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { res += "Microsoft Windows Server 2003 family"; @@ -4198,13 +4219,16 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() { res += " Workstation 4.0"; } - else if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - { - res += " Home Edition"; - } - else + else if (osvi.dwMajorVersion == 5) { - res += " Professional"; + if (osvi.wSuiteMask & VER_SUITE_PERSONAL) + { + res += " Home Edition"; + } + else + { + res += " Professional"; + } } } @@ -4248,7 +4272,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } } - else // Windows NT 4.0 + else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0 { if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) { diff --git a/GCC_XML/KWSys/kwsysDateStamp.cmake b/GCC_XML/KWSys/kwsysDateStamp.cmake index 6513cfd..985ffd9 100644 --- a/GCC_XML/KWSys/kwsysDateStamp.cmake +++ b/GCC_XML/KWSys/kwsysDateStamp.cmake @@ -4,7 +4,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2008) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 07) +SET(KWSYS_DATE_STAMP_MONTH 10) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 10) +SET(KWSYS_DATE_STAMP_DAY 17) diff --git a/GCC_XML/KWSys/testDynamicLoader.cxx b/GCC_XML/KWSys/testDynamicLoader.cxx index cfdbfd4..09a2e74 100644 --- a/GCC_XML/KWSys/testDynamicLoader.cxx +++ b/GCC_XML/KWSys/testDynamicLoader.cxx @@ -17,10 +17,14 @@ #include KWSYS_HEADER(ios/iostream) #include KWSYS_HEADER(stl/string) -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) #include /* disable_debugger() API. */ #endif +#if defined(__HAIKU__) +#include /* disable_debugger() API. */ +#endif + // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 @@ -94,7 +98,7 @@ int testDynamicLoader(int argc, char *argv[]) { #if defined(_WIN32) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) disable_debugger(1); #endif int res = 0; diff --git a/GCC_XML/KWSys/testProcess.c b/GCC_XML/KWSys/testProcess.c index e93cc0d..cde03e3 100644 --- a/GCC_XML/KWSys/testProcess.c +++ b/GCC_XML/KWSys/testProcess.c @@ -34,7 +34,7 @@ # pragma warn -8060 /* possibly incorrect assignment */ #endif -#if defined(__BEOS__) && !defined(__ZETA__) +#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ # include static inline void testProcess_usleep(unsigned int msec) @@ -87,7 +87,7 @@ int test4(int argc, const char* argv[]) #if defined(_WIN32) /* Avoid error diagnostic popups since we are crashing on purpose. */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#elif defined(__BEOS__) +#elif defined(__BEOS__) || defined(__HAIKU__) /* Avoid error diagnostic popups since we are crashing on purpose. */ disable_debugger(1); #endif diff --git a/GCC_XML/KWSys/testSharedForward.c.in b/GCC_XML/KWSys/testSharedForward.c.in new file mode 100644 index 0000000..e7e4320 --- /dev/null +++ b/GCC_XML/KWSys/testSharedForward.c.in @@ -0,0 +1,38 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: testSharedForward.c.in + + Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#if defined(CMAKE_INTDIR) +# define CONFIG_DIR_PRE CMAKE_INTDIR "/" +# define CONFIG_DIR_POST "/" CMAKE_INTDIR +#else +# define CONFIG_DIR_PRE "" +# define CONFIG_DIR_POST "" +#endif +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD "@EXEC_DIR@" +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD "." CONFIG_DIR_POST +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL 0 +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD \ + CONFIG_DIR_PRE "@KWSYS_NAMESPACE@TestProcess" +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL \ + "@KWSYS_NAMESPACE@TestProcess" +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND "--command" +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT "--print" +#define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD "--ldd" +#if defined(CMAKE_INTDIR) +# define @KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR +#endif +#include <@KWSYS_NAMESPACE@/SharedForward.h> +int main(int argc, char** argv) +{ + return @KWSYS_NAMESPACE@_shared_forward_to_real(argc, argv); +} diff --git a/GCC_XML/Support/GCC/3.4/bits/gthr-default.h b/GCC_XML/Support/GCC/3.4/bits/gthr-default.h new file mode 100644 index 0000000..d543a90 --- /dev/null +++ b/GCC_XML/Support/GCC/3.4/bits/gthr-default.h @@ -0,0 +1,664 @@ +/* Threads compatibility routines for libgcc2 and libobjc. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef _GLIBCXX_GCC_GTHR_POSIX_H +#define _GLIBCXX_GCC_GTHR_POSIX_H + +/* POSIX threads specific definitions. + Easy, since the interface is just one-to-one mapping. */ + +#define __GTHREADS 1 + +/* Some implementations of require this to be defined. */ +#if !defined(_REENTRANT) && defined(__osf__) +#define _REENTRANT 1 +#endif + +#include +#include + +typedef pthread_key_t __gthread_key_t; +typedef pthread_once_t __gthread_once_t; +typedef pthread_mutex_t __gthread_mutex_t; +typedef pthread_mutex_t __gthread_recursive_mutex_t; + +#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER +#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) +#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER +#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) +#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +#else +#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function +#endif + +#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK && defined __GNUC_RH_RELEASE__ \ + && ((__GNUC__ == 3 && __GNUC_MINOR__ == 4 && (__GNUC_PATCHLEVEL__ > 4 || (__GNUC_PATCHLEVEL__ == 4 && __GNUC_RH_RELEASE__ > 2))) \ + || (__GNUC__ == 4 && __GNUC_MINOR__ == 0 && (__GNUC_PATCHLEVEL__ > 2 || (__GNUC_PATCHLEVEL__ == 2 && __GNUC_RH_RELEASE__ > 6)))) \ + && ! defined __attribute__ +# define __gthrw(name) \ + extern __typeof(name) __gthrw_ ## name + + +__gthrw(pthread_once); +__gthrw(pthread_key_create); +__gthrw(pthread_key_delete); +__gthrw(pthread_getspecific); +__gthrw(pthread_setspecific); +__gthrw(pthread_create); + +__gthrw(pthread_mutex_lock); +__gthrw(pthread_mutex_trylock); +__gthrw(pthread_mutex_unlock); +__gthrw(pthread_mutexattr_init); +__gthrw(pthread_mutexattr_settype); +__gthrw(pthread_mutexattr_destroy); + +__gthrw(pthread_mutex_init); + +# if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) +/* Objective-C. */ +__gthrw(pthread_cond_broadcast); +__gthrw(pthread_cond_destroy); +__gthrw(pthread_cond_init); +__gthrw(pthread_cond_signal); +__gthrw(pthread_cond_wait); +__gthrw(pthread_exit); +__gthrw(pthread_mutex_destroy); +__gthrw(pthread_self); +/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but + we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */ +# ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +__gthrw(sched_get_priority_max); +__gthrw(sched_get_priority_min); +# endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +__gthrw(sched_yield); +__gthrw(pthread_attr_destroy); +__gthrw(pthread_attr_init); +__gthrw(pthread_attr_setdetachstate); +# ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +__gthrw(pthread_getschedparam); +__gthrw(pthread_setschedparam); +# endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +# endif /* _LIBOBJC || _LIBOBJC_WEAK */ +#else +# if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK +#pragma weak pthread_once +#pragma weak pthread_key_create +#pragma weak pthread_key_delete +#pragma weak pthread_getspecific +#pragma weak pthread_setspecific +#pragma weak pthread_create + +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_trylock +#pragma weak pthread_mutex_unlock +#pragma weak pthread_mutexattr_init +#pragma weak pthread_mutexattr_settype +#pragma weak pthread_mutexattr_destroy + +#pragma weak pthread_mutex_init + +#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) +/* Objective-C. */ +#pragma weak pthread_cond_broadcast +#pragma weak pthread_cond_destroy +#pragma weak pthread_cond_init +#pragma weak pthread_cond_signal +#pragma weak pthread_cond_wait +#pragma weak pthread_exit +#pragma weak pthread_mutex_destroy +#pragma weak pthread_self +/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but + we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */ +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#pragma weak sched_get_priority_max +#pragma weak sched_get_priority_min +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#pragma weak sched_yield +#pragma weak pthread_attr_destroy +#pragma weak pthread_attr_init +#pragma weak pthread_attr_setdetachstate +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#pragma weak pthread_getschedparam +#pragma weak pthread_setschedparam +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _LIBOBJC || _LIBOBJC_WEAK */ +#endif /* __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK */ + +#define __gthrw_pthread_once pthread_once +#define __gthrw_pthread_key_create pthread_key_create +#define __gthrw_pthread_key_delete pthread_key_delete +#define __gthrw_pthread_getspecific pthread_getspecific +#define __gthrw_pthread_setspecific pthread_setspecific +#define __gthrw_pthread_create pthread_create + +#define __gthrw_pthread_mutex_lock pthread_mutex_lock +#define __gthrw_pthread_mutex_trylock pthread_mutex_trylock +#define __gthrw_pthread_mutex_unlock pthread_mutex_unlock +#define __gthrw_pthread_mutexattr_init pthread_mutexattr_init +#define __gthrw_pthread_mutexattr_settype pthread_mutexattr_settype +#define __gthrw_pthread_mutexattr_destroy pthread_mutexattr_destroy + +#define __gthrw_pthread_mutex_init pthread_mutex_init + +#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) +/* Objective-C. */ +#define __gthrw_pthread_cond_broadcast pthread_cond_broadcast +#define __gthrw_pthread_cond_destroy pthread_cond_destroy +#define __gthrw_pthread_cond_init pthread_cond_init +#define __gthrw_pthread_cond_signal pthread_cond_signal +#define __gthrw_pthread_cond_wait pthread_cond_wait +#define __gthrw_pthread_exit pthread_exit +#define __gthrw_pthread_mutex_destroy pthread_mutex_destroy +#define __gthrw_pthread_self pthread_self +/* These really should be protected by _POSIX_PRIORITY_SCHEDULING, but + we use them inside a _POSIX_THREAD_PRIORITY_SCHEDULING block. */ +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#define __gthrw_sched_get_priority_max sched_get_priority_max +#define __gthrw_sched_get_priority_min sched_get_priority_min +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#define __gthrw_sched_yield sched_yield +#define __gthrw_pthread_attr_destroy pthread_attr_destroy +#define __gthrw_pthread_attr_init pthread_attr_init +#define __gthrw_pthread_attr_setdetachstate pthread_attr_setdetachstate +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +#define __gthrw_pthread_getschedparam pthread_getschedparam +#define __gthrw_pthread_setschedparam pthread_setschedparam +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _LIBOBJC || _LIBOBJC_WEAK */ +#endif + + +#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK + +static inline int +__gthread_active_p (void) +{ + static void *const __gthread_active_ptr = (void *) &__gthrw_pthread_create; + return __gthread_active_ptr != 0; +} + +#else /* not __GXX_WEAK__ */ + +static inline int +__gthread_active_p (void) +{ + return 1; +} + +#endif /* __GXX_WEAK__ */ + +#ifdef _LIBOBJC + +/* This is the config.h file in libobjc/ */ +#include + +#ifdef HAVE_SCHED_H +# include +#endif + +/* Key structure for maintaining thread specific storage */ +static pthread_key_t _objc_thread_storage; +static pthread_attr_t _objc_thread_attribs; + +/* Thread local storage for a single thread */ +static void *thread_local_storage = NULL; + +/* Backend initialization functions */ + +/* Initialize the threads subsystem. */ +static inline int +__gthread_objc_init_thread_system (void) +{ + if (__gthread_active_p ()) + { + /* Initialize the thread storage key */ + if (__gthrw_pthread_key_create (&_objc_thread_storage, NULL) == 0) + { + /* The normal default detach state for threads is + * PTHREAD_CREATE_JOINABLE which causes threads to not die + * when you think they should. */ + if (__gthrw_pthread_attr_init (&_objc_thread_attribs) == 0 + && __gthrw_pthread_attr_setdetachstate (&_objc_thread_attribs, + PTHREAD_CREATE_DETACHED) == 0) + return 0; + } + } + + return -1; +} + +/* Close the threads subsystem. */ +static inline int +__gthread_objc_close_thread_system (void) +{ + if (__gthread_active_p () + && __gthrw_pthread_key_delete (_objc_thread_storage) == 0 + && __gthrw_pthread_attr_destroy (&_objc_thread_attribs) == 0) + return 0; + + return -1; +} + +/* Backend thread functions */ + +/* Create a new thread of execution. */ +static inline objc_thread_t +__gthread_objc_thread_detach (void (*func)(void *), void *arg) +{ + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if (!__gthread_active_p ()) + return NULL; + + if (!(__gthrw_pthread_create (&new_thread_handle, NULL, (void *) func, arg))) + thread_id = (objc_thread_t) new_thread_handle; + else + thread_id = NULL; + + return thread_id; +} + +/* Set the current thread's priority. */ +static inline int +__gthread_objc_thread_set_priority (int priority) +{ + if (!__gthread_active_p ()) + return -1; + else + { +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + pthread_t thread_id = __gthrw_pthread_self (); + int policy; + struct sched_param params; + int priority_min, priority_max; + + if (__gthrw_pthread_getschedparam (thread_id, &policy, ¶ms) == 0) + { + if ((priority_max = __gthrw_sched_get_priority_max (policy)) == -1) + return -1; + + if ((priority_min = __gthrw_sched_get_priority_min (policy)) == -1) + return -1; + + if (priority > priority_max) + priority = priority_max; + else if (priority < priority_min) + priority = priority_min; + params.sched_priority = priority; + + /* + * The solaris 7 and several other man pages incorrectly state that + * this should be a pointer to policy but pthread.h is universally + * at odds with this. + */ + if (__gthrw_pthread_setschedparam (thread_id, policy, ¶ms) == 0) + return 0; + } +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ + return -1; + } +} + +/* Return the current thread's priority. */ +static inline int +__gthread_objc_thread_get_priority (void) +{ +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + if (__gthread_active_p ()) + { + int policy; + struct sched_param params; + + if (__gthrw_pthread_getschedparam (__gthrw_pthread_self (), &policy, ¶ms) == 0) + return params.sched_priority; + else + return -1; + } + else +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ + return OBJC_THREAD_INTERACTIVE_PRIORITY; +} + +/* Yield our process time to another thread. */ +static inline void +__gthread_objc_thread_yield (void) +{ + if (__gthread_active_p ()) + __gthrw_sched_yield (); +} + +/* Terminate the current thread. */ +static inline int +__gthread_objc_thread_exit (void) +{ + if (__gthread_active_p ()) + /* exit the thread */ + __gthrw_pthread_exit (&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; +} + +/* Returns an integer value which uniquely describes a thread. */ +static inline objc_thread_t +__gthread_objc_thread_id (void) +{ + if (__gthread_active_p ()) + return (objc_thread_t) __gthrw_pthread_self (); + else + return (objc_thread_t) 1; +} + +/* Sets the thread's local storage pointer. */ +static inline int +__gthread_objc_thread_set_data (void *value) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_setspecific (_objc_thread_storage, value); + else + { + thread_local_storage = value; + return 0; + } +} + +/* Returns the thread's local storage pointer. */ +static inline void * +__gthread_objc_thread_get_data (void) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_getspecific (_objc_thread_storage); + else + return thread_local_storage; +} + +/* Backend mutex functions */ + +/* Allocate a mutex. */ +static inline int +__gthread_objc_mutex_allocate (objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + { + mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); + + if (__gthrw_pthread_mutex_init ((pthread_mutex_t *) mutex->backend, NULL)) + { + objc_free (mutex->backend); + mutex->backend = NULL; + return -1; + } + } + + return 0; +} + +/* Deallocate a mutex. */ +static inline int +__gthread_objc_mutex_deallocate (objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + { + int count; + + /* + * Posix Threads specifically require that the thread be unlocked + * for __gthrw_pthread_mutex_destroy to work. + */ + + do + { + count = __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend); + if (count < 0) + return -1; + } + while (count); + + if (__gthrw_pthread_mutex_destroy ((pthread_mutex_t *) mutex->backend)) + return -1; + + objc_free (mutex->backend); + mutex->backend = NULL; + } + return 0; +} + +/* Grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_lock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_pthread_mutex_lock ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Try to grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_trylock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_pthread_mutex_trylock ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Unlock the mutex */ +static inline int +__gthread_objc_mutex_unlock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Backend condition mutex functions */ + +/* Allocate a condition. */ +static inline int +__gthread_objc_condition_allocate (objc_condition_t condition) +{ + if (__gthread_active_p ()) + { + condition->backend = objc_malloc (sizeof (pthread_cond_t)); + + if (__gthrw_pthread_cond_init ((pthread_cond_t *) condition->backend, NULL)) + { + objc_free (condition->backend); + condition->backend = NULL; + return -1; + } + } + + return 0; +} + +/* Deallocate a condition. */ +static inline int +__gthread_objc_condition_deallocate (objc_condition_t condition) +{ + if (__gthread_active_p ()) + { + if (__gthrw_pthread_cond_destroy ((pthread_cond_t *) condition->backend)) + return -1; + + objc_free (condition->backend); + condition->backend = NULL; + } + return 0; +} + +/* Wait on the condition */ +static inline int +__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_cond_wait ((pthread_cond_t *) condition->backend, + (pthread_mutex_t *) mutex->backend); + else + return 0; +} + +/* Wake up all threads waiting on this condition. */ +static inline int +__gthread_objc_condition_broadcast (objc_condition_t condition) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_cond_broadcast ((pthread_cond_t *) condition->backend); + else + return 0; +} + +/* Wake up one thread waiting on this condition. */ +static inline int +__gthread_objc_condition_signal (objc_condition_t condition) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_cond_signal ((pthread_cond_t *) condition->backend); + else + return 0; +} + +#else /* _LIBOBJC */ + +static inline int +__gthread_once (__gthread_once_t *once, void (*func) (void)) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_once (once, func); + else + return -1; +} + +static inline int +__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) +{ + return __gthrw_pthread_key_create (key, dtor); +} + +static inline int +__gthread_key_delete (__gthread_key_t key) +{ + return __gthrw_pthread_key_delete (key); +} + +static inline void * +__gthread_getspecific (__gthread_key_t key) +{ + return __gthrw_pthread_getspecific (key); +} + +static inline int +__gthread_setspecific (__gthread_key_t key, const void *ptr) +{ + return __gthrw_pthread_setspecific (key, ptr); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_mutex_lock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_mutex_trylock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_pthread_mutex_unlock (mutex); + else + return 0; +} + +#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +static inline int +__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex) +{ + if (__gthread_active_p ()) + { + pthread_mutexattr_t attr; + int r; + + r = __gthrw_pthread_mutexattr_init (&attr); + if (!r) + r = __gthrw_pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); + if (!r) + r = __gthrw_pthread_mutex_init (mutex, &attr); + if (!r) + r = __gthrw_pthread_mutexattr_destroy (&attr); + return r; + } +} +#endif + +static inline int +__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex) +{ + return __gthread_mutex_lock (mutex); +} + +static inline int +__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex) +{ + return __gthread_mutex_trylock (mutex); +} + +static inline int +__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex) +{ + return __gthread_mutex_unlock (mutex); +} + +#endif /* _LIBOBJC */ + +#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ diff --git a/GCC_XML/Support/GCC/find_flags b/GCC_XML/Support/GCC/find_flags index a9676d8..4df93d5 100755 --- a/GCC_XML/Support/GCC/find_flags +++ b/GCC_XML/Support/GCC/find_flags @@ -41,9 +41,16 @@ BEGIN { first=1 } INCLUDES=` echo "" | ${CXX} -v -x c++ -E ${CXXFLAGS} - 2>&1 | awk '/^[^ \/].*$/ { if (f) { printf("\n"); exit } } - /^[ ]*\/[^ ]*$/ { if (f) { printf("-I%s ",$0) } } - /\#include <\.\.\..*$/ {f=1} ' - | - sed 's/^-I /-isystem/;s/ -I / -isystem/g' + /^[ ]*(\/[^ ]*)( \(.*\))?$/ { + if (f) { + if (match($1,"/Frameworks")) { + printf("-F%s ",$1) + } else { + printf("-isystem%s ",$1) + } + } + } + /\#include <\.\.\..*$/ {f=1} ' - ` # The support headers are located where this script is. diff --git a/GCC_XML/VcInstall/vcInstall.cxx b/GCC_XML/VcInstall/vcInstall.cxx index e3b59cd..0060865 100644 --- a/GCC_XML/VcInstall/vcInstall.cxx +++ b/GCC_XML/VcInstall/vcInstall.cxx @@ -69,8 +69,14 @@ int main(int argc, char* argv[]) "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1;InstallDir"; const char* vc8Registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir"; - const char* vc8sp1Registry = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\InstalledProducts\\KB926601;"; + const char* vc8sp1Registry[] = + { + // English SP1 + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\InstalledProducts\\KB926601;", + // German SP1 + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\InstalledProducts\\KB926606;", + 0 + }; const char* vc8exRegistry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\8.0;InstallDir"; const char* vc8exSP1Registry = @@ -277,7 +283,12 @@ int main(int argc, char* argv[]) std::string destPathP = gccxmlRoot+"/Vc8/PlatformSDK"; std::string msvc8sp1; - if(gxSystemTools::ReadRegistryValue(vc8sp1Registry, msvc8sp1)) + bool vc8sp1 = false; + for(const char** reg = vc8sp1Registry; !vc8sp1 && *reg; ++reg) + { + vc8sp1 = vc8sp1 || gxSystemTools::ReadRegistryValue(*reg, msvc8sp1); + } + if(vc8sp1) { patchIname = "vc8sp1Include.patch"; patchPname = "vc8sp1PlatformSDK.patch";