Skip to content

Commit

Permalink
gccxml 2009-06-12 (eb4513ee)
Browse files Browse the repository at this point in the history
  • Loading branch information
GCC-XML committed Jun 12, 2009
1 parent 6a00c8c commit b7773ef
Show file tree
Hide file tree
Showing 28 changed files with 631 additions and 220 deletions.
8 changes: 5 additions & 3 deletions GCC/libdecnumber/gstdint.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* BEGIN GCC-XML MODIFICATIONS (2007/10/31 15:08:49) */
/* BEGIN GCC-XML MODIFICATIONS (2009/06/09 18:18:01) */
/* This file was manually written for gccxml's GCC. */
#ifndef GCC_GSTDINT_H
#define GCC_GSTDINT_H 1
Expand All @@ -14,9 +14,11 @@ typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#else
#elif defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#endif

#endif /* GCC_GSTDINT_H */
/* END GCC-XML MODIFICATIONS (2007/10/31 15:08:49) */
/* END GCC-XML MODIFICATIONS (2009/06/09 18:18:01) */
14 changes: 7 additions & 7 deletions GCC/libiberty/physmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ typedef struct
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} lMEMORYSTATUSEX;
/* BEGIN GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* BEGIN GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
# if !defined(_MSC_VER) && !defined(__BORLANDC__)
typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
# else
typedef BOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
# endif
/* END GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* END GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
#endif

#include "libiberty.h"
Expand Down Expand Up @@ -150,7 +150,7 @@ physmem_total (void)
}
#endif

#if HAVE__SYSTEM_CONFIGURATION
#ifdef HAVE__SYSTEM_CONFIGURATION
/* This works on AIX 4.3.3+. */
return _system_configuration.physmem;
#endif
Expand All @@ -170,13 +170,13 @@ physmem_total (void)
lms_ex.dwLength = sizeof lms_ex;
if (!pfnex (&lms_ex))
return 0.0;
/* BEGIN GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* BEGIN GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
#if !defined(_MSC_VER) || _MSC_VER >= 1300
return (double) lms_ex.ullTotalPhys;
#else
return (double)(signed __int64) lms_ex.ullTotalPhys;
#endif
/* END GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* END GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
}

/* Fall back to GlobalMemoryStatus which is always available.
Expand Down Expand Up @@ -277,13 +277,13 @@ physmem_available (void)
lms_ex.dwLength = sizeof lms_ex;
if (!pfnex (&lms_ex))
return 0.0;
/* BEGIN GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* BEGIN GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
#if !defined(_MSC_VER) || _MSC_VER >= 1300
return (double) lms_ex.ullAvailPhys;
#else
return (double)(signed __int64) lms_ex.ullAvailPhys;
#endif
/* END GCC-XML MODIFICATIONS (2007/10/31 15:08:51) */
/* END GCC-XML MODIFICATIONS (2009/06/09 18:18:45) */
}

/* Fall back to GlobalMemoryStatus which is always available.
Expand Down
2 changes: 1 addition & 1 deletion GCC_XML/GXFront/gxConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ std::string gxConfiguration::GetCompilerId()
if(gxSystemTools::RunCommand(cmd.c_str(), output, retVal) && (0 == retVal))
{
gxsys::RegularExpression reId;
reId.compile("GCCXML_SUPPORT=\"(.*)\"");
reId.compile("GCCXML_SUPPORT[ ]*=[ ]*\"(.*)\"");

std::vector<gxsys::String> lines = gxSystemTools::SplitString(output.c_str(), '\n');
std::vector<gxsys::String>::iterator it;
Expand Down
6 changes: 6 additions & 0 deletions GCC_XML/KWSys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,12 @@ ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
# line to configure the namespace in the C and C++ source files.
ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")

IF(KWSYS_USE_String)
# Activate code in "String.c". See the comment in the source.
SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES
COMPILE_FLAGS "-DKWSYS_STRING_C")
ENDIF(KWSYS_USE_String)

#-----------------------------------------------------------------------------
# Process execution on windows needs to build a forwarding executable
# that works around a Win9x bug. We encode the executable into a C
Expand Down
105 changes: 84 additions & 21 deletions GCC_XML/KWSys/ProcessUNIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ do.
#undef __BEOS__
#endif

#if defined(__VMS)
# define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK
#else
# define KWSYSPE_VMS_NONBLOCK
#endif

#if defined(KWSYS_C_HAS_PTRDIFF_T) && KWSYS_C_HAS_PTRDIFF_T
typedef ptrdiff_t kwsysProcess_ptrdiff_t;
#else
Expand Down Expand Up @@ -100,7 +106,7 @@ static inline void kwsysProcess_usleep(unsigned int msec)
* pipes' file handles to be non-blocking and just poll them directly
* without select().
*/
#if !defined(__BEOS__)
#if !defined(__BEOS__) && !defined(__VMS)
# define KWSYSPE_USE_SELECT 1
#endif

Expand Down Expand Up @@ -156,7 +162,8 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
kwsysProcessTime* timeoutTime);
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
double* userTimeout,
kwsysProcessTimeNative* timeoutLength);
kwsysProcessTimeNative* timeoutLength,
int zeroIsExpired);
static kwsysProcessTime kwsysProcessTimeGetCurrent(void);
static double kwsysProcessTimeToDouble(kwsysProcessTime t);
static kwsysProcessTime kwsysProcessTimeFromDouble(double d);
Expand All @@ -169,6 +176,7 @@ static void kwsysProcessRestoreDefaultSignalHandlers(void);
static pid_t kwsysProcessFork(kwsysProcess* cp,
kwsysProcessCreateInformation* si);
static void kwsysProcessKill(pid_t process_id);
static int kwsysProcessSetVMSFeature(const char* name, int value);
static int kwsysProcessesAdd(kwsysProcess* cp);
static void kwsysProcessesRemove(kwsysProcess* cp);
#if KWSYSPE_USE_SIGINFO
Expand Down Expand Up @@ -719,6 +727,13 @@ void kwsysProcess_Execute(kwsysProcess* cp)
return;
}

/* Make sure pipes behave like streams on VMS. */
if(!kwsysProcessSetVMSFeature("DECC$STREAM_PIPE", 1))
{
kwsysProcessCleanup(cp, 1);
return;
}

/* Save the real working directory of this process and change to
the working directory for the child processes. This is needed
to make pipe file paths evaluate correctly. */
Expand Down Expand Up @@ -758,7 +773,7 @@ void kwsysProcess_Execute(kwsysProcess* cp)
{
/* Create the pipe. */
int p[2];
if(pipe(p) < 0)
if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
{
kwsysProcessCleanup(cp, 1);
return;
Expand Down Expand Up @@ -1097,7 +1112,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
}
if(kwsysProcessGetTimeoutLeft(&wd->TimeoutTime,
wd->User?wd->UserTimeout:0,
&timeoutLength))
&timeoutLength, 0))
{
/* Timeout has already expired. */
wd->Expired = 1;
Expand Down Expand Up @@ -1184,11 +1199,24 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
else if (n == 0) /* EOF */
{
/* We are done reading from this pipe. */
kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
--cp->PipesLeft;
#if defined(__VMS)
if(!cp->CommandsLeft)
#endif
{
kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
--cp->PipesLeft;
}
}
else if (n < 0) /* error */
{
#if defined(__VMS)
if(!cp->CommandsLeft)
{
kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
--cp->PipesLeft;
}
else
#endif
if((errno != EINTR) && (errno != EAGAIN))
{
strncpy(cp->ErrorMessage,strerror(errno),
Expand All @@ -1210,14 +1238,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
}

if(kwsysProcessGetTimeoutLeft(&wd->TimeoutTime, wd->User?wd->UserTimeout:0,
&timeoutLength))
{
/* Timeout has already expired. */
wd->Expired = 1;
return 1;
}

if((timeoutLength.tv_sec == 0) && (timeoutLength.tv_usec == 0))
&timeoutLength, 1))
{
/* Timeout has already expired. */
wd->Expired = 1;
Expand Down Expand Up @@ -1571,6 +1592,11 @@ static int kwsysProcessSetNonBlocking(int fd)
return flags >= 0;
}

/*--------------------------------------------------------------------------*/
#if defined(__VMS)
int decc$set_child_standard_streams(int fd1, int fd2, int fd3);
#endif

/*--------------------------------------------------------------------------*/
static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si, int* readEnd)
Expand Down Expand Up @@ -1622,7 +1648,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
{
/* Create the pipe. */
int p[2];
if(pipe(p) < 0)
if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
{
return 0;
}
Expand Down Expand Up @@ -1680,14 +1706,25 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
}

/* Fork off a child process. */
#if defined(__VMS)
/* VMS needs vfork and execvp to be in the same function because
they use setjmp/longjmp to run the child startup code in the
parent! TODO: OptionDetach. */
cp->ForkPIDs[prIndex] = vfork();
#else
cp->ForkPIDs[prIndex] = kwsysProcessFork(cp, si);
#endif
if(cp->ForkPIDs[prIndex] < 0)
{
return 0;
}

if(cp->ForkPIDs[prIndex] == 0)
{
#if defined(__VMS)
/* Specify standard pipes for child process. */
decc$set_child_standard_streams(si->StdIn, si->StdOut, si->StdErr);
#else
/* Close the read end of the error reporting pipe. */
close(si->ErrorPipe[0]);

Expand Down Expand Up @@ -1717,14 +1754,21 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,

/* Restore all default signal handlers. */
kwsysProcessRestoreDefaultSignalHandlers();
#endif

/* Execute the real process. If successful, this does not return. */
execvp(cp->Commands[prIndex][0], cp->Commands[prIndex]);
/* TODO: What does VMS do if the child fails to start? */

/* Failure. Report error to parent and terminate. */
kwsysProcessChildErrorExit(si->ErrorPipe[1]);
}

#if defined(__VMS)
/* Restore the standard pipes of this process. */
decc$set_child_standard_streams(0, 1, 2);
#endif

/* A child has been created. */
++cp->CommandsLeft;

Expand Down Expand Up @@ -1905,7 +1949,8 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
Returns 1 if the time has already arrived, and 0 otherwise. */
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
double* userTimeout,
kwsysProcessTimeNative* timeoutLength)
kwsysProcessTimeNative* timeoutLength,
int zeroIsExpired)
{
if(timeoutTime->tv_sec < 0)
{
Expand All @@ -1925,7 +1970,8 @@ static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
timeLeft.tv_usec = 0;
}

if(timeLeft.tv_sec < 0)
if(timeLeft.tv_sec < 0 ||
(timeLeft.tv_sec == 0 && timeLeft.tv_usec == 0 && zeroIsExpired))
{
/* Timeout has already expired. */
return 1;
Expand Down Expand Up @@ -2270,9 +2316,6 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
if(cp->OptionDetach)
{
/* Create an intermediate process. */
#ifdef __VMS
#define fork vfork
#endif
pid_t middle_pid = fork();
if(middle_pid < 0)
{
Expand Down Expand Up @@ -2440,6 +2483,26 @@ static void kwsysProcessKill(pid_t process_id)
}
}

/*--------------------------------------------------------------------------*/
#if defined(__VMS)
int decc$feature_get_index(char *name);
int decc$feature_set_value(int index, int mode, int value);
static int kwsysProcessSetVMSFeature(const char* name, int value)
{
int i;
errno = 0;
i = decc$feature_get_index(name);
return i >= 0 && (decc$feature_set_value(i, 1, value) >= 0 || errno == 0);
}
#else
static int kwsysProcessSetVMSFeature(const char* name, int value)
{
(void)name;
(void)value;
return 1;
}
#endif

/*--------------------------------------------------------------------------*/
/* Global set of executing processes for use by the signal handler.
This global instance will be zero-initialized by the compiler. */
Expand Down Expand Up @@ -2481,7 +2544,7 @@ static int kwsysProcessesAdd(kwsysProcess* cp)
{
/* Create the pipe. */
int p[2];
if(pipe(p) < 0)
if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
{
return 0;
}
Expand Down
12 changes: 11 additions & 1 deletion GCC_XML/KWSys/String.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifdef KWSYS_STRING_C
/*
All code in this source file is conditionally compiled to work-around
template definition auto-search on VMS. Other source files in this
directory that use the stl string cause the compiler to load this
source to try to get the definition of the string template. This
condition blocks the compiler from seeing the symbols defined here.
*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(String.h)

Expand Down Expand Up @@ -78,7 +86,7 @@ int kwsysString_strcasecmp(const char* lhs, const char* rhs)
const char* const lower = kwsysString_strcasecmp_tolower;
unsigned char const* us1 = (unsigned char const*)lhs;
unsigned char const* us2 = (unsigned char const*)rhs;
int result = 0;
int result;
while((result = lower[*us1] - lower[*us2++], result == 0) && *us1++)
{
}
Expand All @@ -105,3 +113,5 @@ int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n)
return result;
#endif
}

#endif /* KWSYS_STRING_C */
Loading

0 comments on commit b7773ef

Please sign in to comment.