Refactorization: Removed compatibility hacks for outdated or non-conformant compilers (#4186)

Merged from LCppC.
This commit is contained in:
PKEuS 2022-06-08 15:16:01 +02:00 committed by GitHub
parent 44097b59ff
commit d20ea41325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 27 deletions

View File

@ -35,9 +35,7 @@
///////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#ifndef __BORLANDC__
#include <shlwapi.h>
#endif
// Here is the catch: cppcheck core is Ansi code (using char type).
// When compiling Unicode targets WinAPI automatically uses *W Unicode versions
@ -45,12 +43,8 @@
static BOOL myIsDirectory(const std::string& path)
{
#ifdef __BORLANDC__
return (GetFileAttributes(path.c_str()) & FILE_ATTRIBUTE_DIRECTORY);
#else
// See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
return PathIsDirectoryA(path.c_str());
#endif
}
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
static BOOL myFileExists(const std::string& path)
{
#ifdef __BORLANDC__
DWORD fa = GetFileAttributes(path.c_str());
BOOL result = FALSE;
if (fa != INVALID_FILE_ATTRIBUTES && !(fa & FILE_ATTRIBUTE_DIRECTORY))
result = TRUE;
#else
const BOOL result = PathFileExistsA(path.c_str()) && !PathIsDirectoryA(path.c_str());
#endif
return result;
return PathFileExistsA(path.c_str()) && !PathIsDirectoryA(path.c_str());
}
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)

View File

@ -31,16 +31,6 @@
#include <simplecpp.h>
#if defined(_MSC_VER) && _MSC_VER <= 1700 // VS2012 doesn't have std::isinf and std::isnan
#define ISINF(x) (!_finite(x))
#define ISNAN(x) (_isnan(x))
#elif defined(__INTEL_COMPILER)
#define ISINF(x) (isinf(x))
#define ISNAN(x) (isnan(x))
#else // Use C++11 functions
#define ISINF(x) (std::isinf(x))
#define ISNAN(x) (std::isnan(x))
#endif
const int MathLib::bigint_bits = 64;
@ -83,9 +73,9 @@ std::string MathLib::value::str() const
{
std::ostringstream ostr;
if (mType == MathLib::value::Type::FLOAT) {
if (ISNAN(mDoubleValue))
if (std::isnan(mDoubleValue))
return "nan.0";
if (ISINF(mDoubleValue))
if (std::isinf(mDoubleValue))
return (mDoubleValue > 0) ? "inf.0" : "-inf.0";
ostr.precision(9);