lanurmi: Fixed #1269 (Changes required for compiling with Sun's compiler)
This commit is contained in:
parent
ac077d3160
commit
b9f09679c7
|
@ -87,7 +87,11 @@ std::string FileLister::simplifyPath(const char *originalPath)
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This wrapper exists because Sun's CC does not allow a static_cast
|
||||||
|
// from extern "C" int(*)(int) to int(*)(int).
|
||||||
|
static int tolowerWrapper(int c) {
|
||||||
|
return std::tolower(c);
|
||||||
|
}
|
||||||
|
|
||||||
bool FileLister::acceptFile(const std::string &filename)
|
bool FileLister::acceptFile(const std::string &filename)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +100,7 @@ bool FileLister::acceptFile(const std::string &filename)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string extension = filename.substr(dotLocation);
|
std::string extension = filename.substr(dotLocation);
|
||||||
std::transform(extension.begin(), extension.end(), extension.begin(), static_cast < int(*)(int) > (std::tolower));
|
std::transform(extension.begin(), extension.end(), extension.begin(), tolowerWrapper);
|
||||||
|
|
||||||
if (extension == ".cpp" ||
|
if (extension == ".cpp" ||
|
||||||
extension == ".cxx" ||
|
extension == ".cxx" ||
|
||||||
|
@ -306,7 +310,7 @@ void FileLister::recursiveAddFiles(std::vector<std::string> &filenames, const st
|
||||||
|
|
||||||
bool FileLister::sameFileName(const char fname1[], const char fname2[])
|
bool FileLister::sameFileName(const char fname1[], const char fname2[])
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined(__linux__) || defined(__sun)
|
||||||
return bool(strcmp(fname1, fname2) == 0);
|
return bool(strcmp(fname1, fname2) == 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
|
@ -26,19 +26,6 @@
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
// Check that the compiler are supported
|
|
||||||
// This program should be compiled with either GCC/BORLAND/MSC to work..
|
|
||||||
#ifndef __GNUC__
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
#error "Cppcheck must be compiled by either GCC/BORLAND/MSC to work fully.\n"
|
|
||||||
#error "Please report that you couldn't compile cppcheck through the web page:\n"
|
|
||||||
#error " https://sourceforge.net/projects/cppcheck/"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class FileLister
|
class FileLister
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1207,6 +1207,14 @@ int Preprocessor::getHeaderFileName(std::string &str)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This wrapper exists because Sun's CC does not allow a static_cast
|
||||||
|
// from extern "C" int(*)(int) to int(*)(int).
|
||||||
|
static int tolowerWrapper(int c) {
|
||||||
|
return std::tolower(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Preprocessor::handleIncludes(std::string &code, const std::string &filename, const std::list<std::string> &includePaths)
|
void Preprocessor::handleIncludes(std::string &code, const std::string &filename, const std::list<std::string> &includePaths)
|
||||||
{
|
{
|
||||||
std::list<std::string> paths;
|
std::list<std::string> paths;
|
||||||
|
@ -1247,7 +1255,7 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filename
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string tempFile = filename;
|
std::string tempFile = filename;
|
||||||
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), static_cast < int(*)(int) > (std::tolower));
|
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), tolowerWrapper);
|
||||||
if (handledFiles.find(tempFile) != handledFiles.end())
|
if (handledFiles.find(tempFile) != handledFiles.end())
|
||||||
{
|
{
|
||||||
// We have processed this file already once, skip
|
// We have processed this file already once, skip
|
||||||
|
|
Loading…
Reference in New Issue