Skip to content

Commit d20ea41

Browse files
authored
Refactorization: Removed compatibility hacks for outdated or non-conformant compilers (danmar#4186)
Merged from LCppC.
1 parent 44097b5 commit d20ea41

2 files changed

Lines changed: 3 additions & 27 deletions

File tree

cli/filelister.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,16 @@
3535
///////////////////////////////////////////////////////////////////////////////
3636

3737
#include <windows.h>
38-
#ifndef __BORLANDC__
3938
#include <shlwapi.h>
40-
#endif
4139

4240
// Here is the catch: cppcheck core is Ansi code (using char type).
4341
// When compiling Unicode targets WinAPI automatically uses *W Unicode versions
4442
// of called functions. Thus, we explicitly call *A versions of the functions.
4543

4644
static BOOL myIsDirectory(const std::string& path)
4745
{
48-
#ifdef __BORLANDC__
49-
return (GetFileAttributes(path.c_str()) & FILE_ATTRIBUTE_DIRECTORY);
50-
#else
5146
// See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
5247
return PathIsDirectoryA(path.c_str());
53-
#endif
5448
}
5549

5650
static HANDLE myFindFirstFile(const std::string& path, LPWIN32_FIND_DATAA findData)
@@ -61,15 +55,7 @@ static HANDLE myFindFirstFile(const std::string& path, LPWIN32_FIND_DATAA findDa
6155

6256
static BOOL myFileExists(const std::string& path)
6357
{
64-
#ifdef __BORLANDC__
65-
DWORD fa = GetFileAttributes(path.c_str());
66-
BOOL result = FALSE;
67-
if (fa != INVALID_FILE_ATTRIBUTES && !(fa & FILE_ATTRIBUTE_DIRECTORY))
68-
result = TRUE;
69-
#else
70-
const BOOL result = PathFileExistsA(path.c_str()) && !PathIsDirectoryA(path.c_str());
71-
#endif
72-
return result;
58+
return PathFileExistsA(path.c_str()) && !PathIsDirectoryA(path.c_str());
7359
}
7460

7561
std::string FileLister::recursiveAddFiles(std::map<std::string, std::size_t> &files, const std::string &path, const std::set<std::string> &extra, const PathMatch& ignored)

lib/mathlib.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@
3131

3232
#include <simplecpp.h>
3333

34-
#if defined(_MSC_VER) && _MSC_VER <= 1700 // VS2012 doesn't have std::isinf and std::isnan
35-
#define ISINF(x) (!_finite(x))
36-
#define ISNAN(x) (_isnan(x))
37-
#elif defined(__INTEL_COMPILER)
38-
#define ISINF(x) (isinf(x))
39-
#define ISNAN(x) (isnan(x))
40-
#else // Use C++11 functions
41-
#define ISINF(x) (std::isinf(x))
42-
#define ISNAN(x) (std::isnan(x))
43-
#endif
4434

4535
const int MathLib::bigint_bits = 64;
4636

@@ -83,9 +73,9 @@ std::string MathLib::value::str() const
8373
{
8474
std::ostringstream ostr;
8575
if (mType == MathLib::value::Type::FLOAT) {
86-
if (ISNAN(mDoubleValue))
76+
if (std::isnan(mDoubleValue))
8777
return "nan.0";
88-
if (ISINF(mDoubleValue))
78+
if (std::isinf(mDoubleValue))
8979
return (mDoubleValue > 0) ? "inf.0" : "-inf.0";
9080

9181
ostr.precision(9);

0 commit comments

Comments
 (0)