Fixing bug 1935006 - Compile problems on cygwin
This commit is contained in:
parent
fd9ca7c300
commit
a938b4ed39
|
@ -62,11 +62,7 @@ void WarningIncludeHeader()
|
||||||
const char *includefile = includetok->next->str;
|
const char *includefile = includetok->next->str;
|
||||||
while (hfile < Files.size())
|
while (hfile < Files.size())
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
if ( SameFileName( Files[hfile].c_str(), includefile ) )
|
||||||
if (strcasecmp(Files[hfile].c_str(), includefile) == 0)
|
|
||||||
#else
|
|
||||||
if (stricmp(Files[hfile].c_str(), includefile) == 0)
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
hfile++;
|
hfile++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __BORLANDC__
|
||||||
#include <string.h>
|
|
||||||
#else
|
|
||||||
#include <mem.h> // <- memset
|
#include <mem.h> // <- memset
|
||||||
|
#else
|
||||||
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -41,6 +41,19 @@ std::string FileLine(const TOKEN *tok)
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool SameFileName( const char fname1[], const char fname2[] )
|
||||||
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
return bool( strcmp(fname1, fname2) == 0 );
|
||||||
|
#endif
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
return bool( stricmp(fname1, fname2) == 0 );
|
||||||
|
#else
|
||||||
|
return bool( strcasecmp(fname1, fname2) == 0 );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
std::list<std::string> ErrorList;
|
std::list<std::string> ErrorList;
|
||||||
|
|
||||||
void ReportErr(const std::string &errmsg)
|
void ReportErr(const std::string &errmsg)
|
||||||
|
|
|
@ -12,6 +12,9 @@ struct TOKEN;
|
||||||
|
|
||||||
std::string FileLine(const TOKEN *tok);
|
std::string FileLine(const TOKEN *tok);
|
||||||
|
|
||||||
|
// Are two filenames the same? Case insensitive on windows
|
||||||
|
bool SameFileName( const char fname1[], const char fname2[] );
|
||||||
|
|
||||||
extern bool OnlyReportUniqueErrors;
|
extern bool OnlyReportUniqueErrors;
|
||||||
|
|
||||||
void ReportErr(const std::string &errmsg);
|
void ReportErr(const std::string &errmsg);
|
||||||
|
|
11
main.cpp
11
main.cpp
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#include <dir.h>
|
#include <dir.h>
|
||||||
#endif
|
#else
|
||||||
#ifdef __GNUC__
|
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ static void CppCheck(const char FileName[], unsigned int FileId);
|
||||||
|
|
||||||
static void AddFiles( std::vector<std::string> &filenames, const char path[], const char pattern[] )
|
static void AddFiles( std::vector<std::string> &filenames, const char path[], const char pattern[] )
|
||||||
{
|
{
|
||||||
#ifndef __GNUC__
|
#ifdef __BORLANDC__
|
||||||
struct ffblk f;
|
struct ffblk f;
|
||||||
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
|
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
|
||||||
{
|
{
|
||||||
|
@ -58,7 +57,7 @@ static void RecursiveAddFiles( std::vector<std::string> &filenames, const char p
|
||||||
AddFiles( filenames, path, "*.cc" );
|
AddFiles( filenames, path, "*.cc" );
|
||||||
AddFiles( filenames, path, "*.c" );
|
AddFiles( filenames, path, "*.c" );
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifdef __BORLANDC__
|
||||||
struct ffblk f ;
|
struct ffblk f ;
|
||||||
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
|
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
|
||||||
{
|
{
|
||||||
|
@ -73,7 +72,11 @@ static void RecursiveAddFiles( std::vector<std::string> &filenames, const char p
|
||||||
findclose(&f);
|
findclose(&f);
|
||||||
#else
|
#else
|
||||||
glob_t glob_results;
|
glob_t glob_results;
|
||||||
|
#ifdef CYGWIN
|
||||||
glob("*", GLOB_ONLYDIR, 0, &glob_results);
|
glob("*", GLOB_ONLYDIR, 0, &glob_results);
|
||||||
|
#else
|
||||||
|
glob("*", 0, 0, &glob_results);
|
||||||
|
#endif
|
||||||
for ( unsigned int i = 0; i < glob_results.gl_pathc; i++ )
|
for ( unsigned int i = 0; i < glob_results.gl_pathc; i++ )
|
||||||
{
|
{
|
||||||
const char *dirname = glob_results.gl_pathv[i];
|
const char *dirname = glob_results.gl_pathv[i];
|
||||||
|
|
|
@ -262,11 +262,7 @@ void Tokenize(const char FileName[])
|
||||||
// Has this file been tokenized already?
|
// Has this file been tokenized already?
|
||||||
for (unsigned int i = 0; i < Files.size(); i++)
|
for (unsigned int i = 0; i < Files.size(); i++)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
if ( SameFileName( Files[i].c_str(), FileName ) )
|
||||||
if( strcasecmp(Files[i].c_str(), FileName) == 0 )
|
|
||||||
#else
|
|
||||||
if ( stricmp(Files[i].c_str(), FileName) == 0 )
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue