Skip to content

Commit

Permalink
gccxml 2009-09-14 (7ecec51e)
Browse files Browse the repository at this point in the history
  • Loading branch information
GCC-XML authored and kwrobot committed Sep 14, 2009
1 parent 5f34ed1 commit abbf912
Show file tree
Hide file tree
Showing 16 changed files with 429 additions and 295 deletions.
32 changes: 24 additions & 8 deletions GCC/libcpp/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ struct _cpp_file
header. */
cpp_dir *dir;

/* BEGIN GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* BEGIN GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
struct cpp_dir wrapper_dir; /* hack for supporting -iwrapper */
/* END GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* END GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */

/* As filled in by stat(2) for the file. */
struct stat st;
Expand Down Expand Up @@ -380,6 +380,12 @@ _cpp_find_failed (_cpp_file *file)
return file->err_no != 0;
}

/* The gccxml include wrapper path changes with each input file
because it wraps around double-quote locations too (so that system
headers including each other by double-quotes can be wrapped).
This does not interact well with search result caching. */
#define GCCXML_DISABLE_INCLUDE_CACHE

/* Given a filename FNAME search for such a file in the include path
starting from START_DIR. If FNAME is the empty string it is
interpreted as STDIN if START_DIR is PFILE->no_search_path.
Expand All @@ -397,14 +403,17 @@ _cpp_find_failed (_cpp_file *file)
_cpp_file *
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool fake, int angle_brackets)
{
#ifndef GCCXML_DISABLE_INCLUDE_CACHE
struct file_hash_entry *entry, **hash_slot;
#endif
_cpp_file *file;
bool invalid_pch = false;

/* Ensure we get no confusion between cached files and directories. */
if (start_dir == NULL)
cpp_error (pfile, CPP_DL_ICE, "NULL directory in find_file");

#ifndef GCCXML_DISABLE_INCLUDE_CACHE
hash_slot = (struct file_hash_entry **)
htab_find_slot_with_hash (pfile->file_hash, fname,
htab_hash_string (fname),
Expand All @@ -414,6 +423,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
entry = search_cache (*hash_slot, start_dir);
if (entry)
return entry->u.file;
#endif

file = make_cpp_file (pfile, start_dir, fname);

Expand Down Expand Up @@ -449,6 +459,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
break;
}

#ifndef GCCXML_DISABLE_INCLUDE_CACHE
/* Only check the cache for the starting location (done above)
and the quote and bracket chain heads because there are no
other possible starting points for searches. */
Expand All @@ -459,8 +470,10 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
entry = search_cache (*hash_slot, file->dir);
if (entry)
break;
#endif
}

#ifndef GCCXML_DISABLE_INCLUDE_CACHE
if (entry)
{
/* Cache for START_DIR too, sharing the _cpp_file structure. */
Expand All @@ -469,18 +482,21 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f
file = entry->u.file;
}
else
#endif
{
/* This is a new file; put it in the list. */
file->next_file = pfile->all_files;
pfile->all_files = file;
}

#ifndef GCCXML_DISABLE_INCLUDE_CACHE
/* Store this new result in the hash table. */
entry = new_file_hash_entry (pfile);
entry->next = *hash_slot;
entry->start_dir = start_dir;
entry->u.file = file;
*hash_slot = entry;
#endif

return file;
}
Expand Down Expand Up @@ -821,7 +837,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
if (!dir)
return false;

/* BEGIN GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* BEGIN GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
/* pfile->buffer is NULL when processing an -include command-line flag. */
file = pfile->buffer == NULL ? pfile->main_file : pfile->buffer->file;

Expand Down Expand Up @@ -854,7 +870,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
{
file = _cpp_find_file (pfile, fname, dir, false, angle_brackets);
}
/* END GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* END GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */

/* Compensate for the increment in linemap_add. In the case of a
normal #include, we're currently at the start of the line
Expand Down Expand Up @@ -1198,14 +1214,14 @@ _cpp_get_file_stat (_cpp_file *file)
If BRACKET does not lie in the QUOTE chain, it is set to QUOTE. */
void
cpp_set_include_chains (cpp_reader *pfile, cpp_dir *quote, cpp_dir *bracket,
/* BEGIN GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* BEGIN GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
cpp_dir *wrapper,
/* END GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* END GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
int quote_ignores_source_dir)
{
pfile->quote_include = quote;
pfile->bracket_include = quote;
/* BEGIN GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* BEGIN GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
pfile->wrapper_include = wrapper;
pfile->wrapper_include_last = 0;
for (; wrapper; wrapper = wrapper->next)
Expand All @@ -1214,7 +1230,7 @@ cpp_set_include_chains (cpp_reader *pfile, cpp_dir *quote, cpp_dir *bracket,
wrapper->len = strlen (wrapper->name);
pfile->wrapper_include_last = wrapper;
}
/* END GCC-XML MODIFICATIONS (2008/02/07 15:15:10) */
/* END GCC-XML MODIFICATIONS (2009/09/01 13:48:58) */
pfile->quote_ignores_source_dir = quote_ignores_source_dir;

for (; quote; quote = quote->next)
Expand Down
6 changes: 6 additions & 0 deletions GCC_XML/GXFront/gxConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,12 @@ bool gxConfiguration::FindFlagsGCC()
{
if(reDefine.find(it->c_str()))
{
// __BLOCKS__ is an Apple extension to gcc unknown to gccxml.
if(reDefine.match(1) == "__BLOCKS__")
{
continue;
}

if (MACROS == "")
{
MACROS = "-D";
Expand Down
10 changes: 10 additions & 0 deletions GCC_XML/KWSys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,19 @@ ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)

#-----------------------------------------------------------------------------
# Configure Large File Support.
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDIO
"Checking whether header cstdio is available" DIRECT)
SET(KWSYS_LFS_AVAILABLE 0)
IF(KWSYS_LFS_REQUESTED)
# Large File Support is requested.
SET(KWSYS_LFS_REQUESTED 1)

# Check for large file support.
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_CXX_HAS_CSTDIO=${KWSYS_CXX_HAS_CSTDIO})
KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS
"Checking for Large File Support" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)

IF(KWSYS_LFS_WORKS)
SET(KWSYS_LFS_AVAILABLE 1)
Expand Down Expand Up @@ -442,6 +447,11 @@ ELSE(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM
"Checking whether stl string has istream operator>>" DIRECT)
ENDIF(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_BINARY
"Checking whether ios has binary openmode" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)

KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
Expand Down
12 changes: 12 additions & 0 deletions GCC_XML/KWSys/Configure.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
/* Whether old C++ <strstrea.h> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@

/* Whether C++ streams support the ios::binary openmode. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@

/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@

Expand Down Expand Up @@ -63,6 +66,13 @@
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios
#endif

/* Define the ios::binary openmode macro. */
#if @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define @KWSYS_NAMESPACE@_ios_binary @KWSYS_NAMESPACE@_ios::ios::binary
#else
# define @KWSYS_NAMESPACE@_ios_binary 0
#endif

/* Whether the cstddef header is available. */
#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@

Expand Down Expand Up @@ -133,6 +143,7 @@
# define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
# define kwsys @KWSYS_NAMESPACE@
# define kwsys_ios_binary @KWSYS_NAMESPACE@_ios_binary
# endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
Expand All @@ -141,6 +152,7 @@
# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# define KWSYS_IOS_HAVE_BINARY @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
Expand Down
10 changes: 7 additions & 3 deletions GCC_XML/KWSys/Glob.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles()

//----------------------------------------------------------------------------
kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
bool require_whole_string)
bool require_whole_string,
bool preserve_case)
{
// Incrementally build the regular expression from the pattern.
kwsys_stl::string regex = require_whole_string? "^" : "";
Expand Down Expand Up @@ -195,10 +196,13 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
{
// On case-insensitive systems file names are converted to lower
// case before matching.
ch = tolower(ch);
if(!preserve_case)
{
ch = tolower(ch);
}
}
#endif

(void)preserve_case;
// Store the character.
regex.append(1, static_cast<char>(ch));
}
Expand Down
3 changes: 2 additions & 1 deletion GCC_XML/KWSys/Glob.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public:
whole strings, but may be disabled to support concatenating
expressions more easily (regex1|regex2|etc). */
static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
bool require_whole_string = true);
bool require_whole_string = true,
bool preserve_case = false);

protected:
//! Process directory
Expand Down
16 changes: 9 additions & 7 deletions GCC_XML/KWSys/MD5.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# include "MD5.h.in"
#endif

#include <stddef.h> /* size_t */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy, strlen */

Expand Down Expand Up @@ -238,7 +239,8 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
xbuf[i] = (md5_word_t)(xp[0] + (xp[1] << 8) +
(xp[2] << 16) + (xp[3] << 24));
}
#endif
}
Expand Down Expand Up @@ -369,25 +371,25 @@ static void md5_init(md5_state_t *pms)
}

/* Append a string to the message. */
static void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
static void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
{
const md5_byte_t *p = data;
int left = nbytes;
int offset = (pms->count[0] >> 3) & 63;
size_t left = nbytes;
size_t offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);

if (nbytes <= 0)
return;

/* Update the message length. */
pms->count[1] += nbytes >> 29;
pms->count[1] += (md5_word_t)(nbytes >> 29);
pms->count[0] += nbits;
if (pms->count[0] < nbits)
pms->count[1]++;

/* Process an initial partial block. */
if (offset) {
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);

memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
Expand Down Expand Up @@ -474,7 +476,7 @@ void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length)
{
length = (int)strlen((char const*)data);
}
md5_append(&md5->md5_state, (md5_byte_t const*)data, length);
md5_append(&md5->md5_state, (md5_byte_t const*)data, (size_t)length);
}

/*--------------------------------------------------------------------------*/
Expand Down
Loading

0 comments on commit abbf912

Please sign in to comment.