Skip to content

Commit

Permalink
gccxml 2008-10-17 (c041a124)
Browse files Browse the repository at this point in the history
  • Loading branch information
GCC-XML authored and kwrobot committed Oct 17, 2008
1 parent c94addc commit d9aece1
Show file tree
Hide file tree
Showing 18 changed files with 1,130 additions and 63 deletions.
35 changes: 34 additions & 1 deletion GCC/gcc/cp/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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)
Expand All @@ -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. */
Expand Down
18 changes: 18 additions & 0 deletions GCC/gcc/diagnostic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
39 changes: 25 additions & 14 deletions GCC_XML/KWSys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions GCC_XML/KWSys/DynamicLoader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string.h> // for strerror()

#ifdef __BEOS__
#include <be/kernel/image.h>
#include <be/support/Errors.h>
#endif

#ifdef __HAIKU__
#include <os/kernel/image.h>
#include <os/support/Errors.h>
#endif

#define DYNAMICLOADER_DEFINED 1

namespace KWSYS_NAMESPACE
Expand Down
2 changes: 2 additions & 0 deletions GCC_XML/KWSys/DynamicLoader.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
#include <mach-o/dyld.h>
#endif
#elif defined(__HAIKU__)
#include <os/kernel/image.h>
#elif defined(__BEOS__)
#include <be/kernel/image.h>
#endif
Expand Down
15 changes: 14 additions & 1 deletion GCC_XML/KWSys/Glob.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions GCC_XML/KWSys/Glob.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -90,6 +100,8 @@ protected:
GlobInternals* Internals;
bool Recurse;
kwsys_stl::string Relative;
bool RecurseThroughSymlinks;
unsigned int FollowedSymlinkCount;

private:
Glob(const Glob&); // Not implemented.
Expand Down
23 changes: 15 additions & 8 deletions GCC_XML/KWSys/ProcessUNIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ do.
#include <dirent.h> /* DIR, dirent */
#include <ctype.h> /* 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
Expand All @@ -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 <be/kernel/OS.h>
static inline void kwsysProcess_usleep(unsigned int msec)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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. */
Expand Down
Loading

0 comments on commit d9aece1

Please sign in to comment.