Commit 74daf33b authored by Brad King's avatar Brad King
Browse files

Drop unused Borland and OpenWatcom preprocessor conditions

The versions of these compilers previously supported do not
support C++11 that we now require.
parent 2b749749
......@@ -576,20 +576,6 @@ if(KWSYS_USE_SystemInformation)
endif()
endif()
endif()
if(BORLAND)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM
"Checking whether Borland CXX compiler supports assembler instructions" DIRECT)
if(KWSYS_CXX_HAS_BORLAND_ASM)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM=1)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM_CPUID
"Checking whether Borland CXX compiler supports CPUID assembler instruction" DIRECT)
if(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM_CPUID=1)
endif()
endif()
endif()
if(KWSYS_BUILD_SHARED)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
......
......@@ -13,9 +13,6 @@
/* Disable some warnings inside kwsys source files. */
#if defined(KWSYS_NAMESPACE)
# if defined(__BORLANDC__)
# pragma warn - 8027 /* function not inlined. */
# endif
# if defined(__INTEL_COMPILER)
# pragma warning(disable : 1572) /* floating-point equality test */
# endif
......@@ -68,11 +65,6 @@
# pragma warning(disable : 4710) /* function not inlined */
# pragma warning(disable : 4786) /* identifier truncated in debug info */
# endif
# if defined(__BORLANDC__) && !defined(__cplusplus)
/* Code has no effect; raised by winnt.h in C (not C++) when ignoring an
unused parameter using "(param)" syntax (i.e. no cast to void). */
# pragma warn - 8019
# endif
#endif
/* MSVC 6.0 in release mode will warn about code it produces with its
......
......@@ -92,26 +92,12 @@ void Directory::Clear()
# include <sys/stat.h>
# include <sys/types.h>
// Wide function names can vary depending on compiler:
# ifdef __BORLANDC__
# define _wfindfirst_func __wfindfirst
# define _wfindnext_func __wfindnext
# else
# define _wfindfirst_func _wfindfirst
# define _wfindnext_func _wfindnext
# endif
namespace KWSYS_NAMESPACE {
bool Directory::Load(const std::string& name, std::string* errorMessage)
{
this->Clear();
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
// Older Visual C++ and Embarcadero compilers.
long srchHandle;
# else // Newer Visual C++
intptr_t srchHandle;
# endif
char* buf;
size_t n = name.size();
if (name.back() == '/' || name.back() == '\\') {
......@@ -130,8 +116,8 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
srchHandle = _wfindfirst_func(
(wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
srchHandle =
_wfindfirst((wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
......@@ -141,7 +127,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
// Loop through names
do {
this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
} while (_wfindnext_func(srchHandle, &data) != -1);
} while (_wfindnext(srchHandle, &data) != -1);
this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
......@@ -149,12 +135,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
std::string* errorMessage)
{
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
// Older Visual C++ and Embarcadero compilers.
long srchHandle;
# else // Newer Visual C++
intptr_t srchHandle;
# endif
char* buf;
size_t n = name.size();
if (name.back() == '/') {
......@@ -167,8 +148,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
struct _wfinddata_t data; // data of current file
// Now put them into the file array
srchHandle =
_wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
......@@ -179,7 +159,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
unsigned long count = 0;
do {
count++;
} while (_wfindnext_func(srchHandle, &data) != -1);
} while (_wfindnext(srchHandle, &data) != -1);
_findclose(srchHandle);
return count;
}
......
......@@ -246,17 +246,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
// should have a tool to help get the symbol with the desired
// calling convention. Currently we assume cdecl.
//
// Borland:
// __cdecl = "_func" (default)
// __fastcall = "@_func"
// __stdcall = "func"
//
// Watcom:
// __cdecl = "_func"
// __fastcall = "@_func@X"
// __stdcall = "_func@X"
// __watcall = "func_" (default)
//
// MSVC:
// __cdecl = "func" (default)
// __fastcall = "@_func@X"
......@@ -265,20 +254,9 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
// Note that the "@X" part of the name above is the total size (in
// bytes) of the arguments on the stack.
void* result;
# if defined(__BORLANDC__) || defined(__WATCOMC__)
// Need to prepend symbols with '_'
std::string ssym = '_' + sym;
const char* rsym = ssym.c_str();
# else
const char* rsym = sym.c_str();
# endif
result = (void*)GetProcAddress(lib, rsym);
// Hack to cast pointer-to-data to pointer-to-function.
# ifdef __WATCOMC__
return *(DynamicLoader::SymbolPointer*)(&result);
# else
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
# endif
}
# define DYNLOAD_ERROR_BUFFER_SIZE 1024
......
......@@ -31,9 +31,6 @@ a UNIX-style select system call.
#include <io.h> /* _unlink */
#include <stdio.h> /* sprintf */
#include <string.h> /* strlen, strdup */
#ifdef __WATCOMC__
# define _unlink unlink
#endif
#ifndef _MAX_FNAME
# define _MAX_FNAME 4096
......@@ -48,11 +45,6 @@ a UNIX-style select system call.
# pragma warning(disable : 4706)
#endif
#if defined(__BORLANDC__)
# pragma warn - 8004 /* assigned a value that is never used */
# pragma warn - 8060 /* Assignment inside if() condition. */
#endif
/* There are pipes for the process pipeline's stdout and stderr. */
#define KWSYSPE_PIPE_COUNT 2
#define KWSYSPE_PIPE_STDOUT 0
......
......@@ -26,12 +26,6 @@
#include <string>
/* Disable useless Borland warnings. KWSys tries not to force things
on its includers, but there is no choice here. */
#if defined(__BORLANDC__)
# pragma warn - 8027 /* function not inlined. */
#endif
namespace @KWSYS_NAMESPACE@ {
// Forward declaration
......
......@@ -66,12 +66,6 @@
# endif
# endif
# if defined(__BORLANDC__) && !defined(__cplusplus)
/* Code has no effect; raised by winnt.h in C (not C++) when ignoring an
unused parameter using "(param)" syntax (i.e. no cast to void). */
# pragma warn - 8019
# endif
/* Full path to the directory in which this executable is built. Do
not include a trailing slash. */
# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD)
......
......@@ -52,14 +52,6 @@ public:
}
}; // End Class: String
#if defined(__WATCOMC__)
inline bool operator<(String const& l, String const& r)
{
return (static_cast<std::string const&>(l) <
static_cast<std::string const&>(r));
}
#endif
} // namespace @KWSYS_NAMESPACE@
#endif
......@@ -184,8 +184,7 @@ typedef struct rlimit ResourceLimitType;
# define USE_CPUID_INTRINSICS 0
#endif
#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS || \
defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS
# define USE_CPUID 1
#else
# define USE_CPUID 0
......@@ -245,21 +244,6 @@ static bool call_cpuid(int select, int result[4])
}
memcpy(result, tmp, sizeof(tmp));
# elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
unsigned int a, b, c, d;
__asm {
mov EAX, select;
cpuid
mov a, EAX;
mov b, EBX;
mov c, ECX;
mov d, EDX;
}
result[0] = a;
result[1] = b;
result[2] = c;
result[3] = d;
# endif
// The cpuid instruction succeeded.
......@@ -4406,12 +4390,12 @@ void SystemInformationImplementation::CPUCountWindows()
DWORD Length = 0;
DWORD rc = pGetLogicalProcessorInformation(nullptr, &Length);
assert(FALSE == rc);
(void)rc; // Silence unused variable warning in Borland C++ 5.81
(void)rc; // Silence unused variable warning
assert(GetLastError() == ERROR_INSUFFICIENT_BUFFER);
ProcInfo.resize(Length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION));
rc = pGetLogicalProcessorInformation(&ProcInfo[0], &Length);
assert(rc != FALSE);
(void)rc; // Silence unused variable warning in Borland C++ 5.81
(void)rc; // Silence unused variable warning
}
typedef std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION>::iterator
......
......@@ -6,9 +6,7 @@
# define _XOPEN_SOURCE_EXTENDED
#endif
#if defined(_WIN32) && \
(defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || \
defined(__MINGW32__))
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
# define KWSYS_WINDOWS_DIRS
#else
# if defined(__SUNPRO_CC)
......@@ -65,7 +63,7 @@
#endif
#ifdef _MSC_VER
# define umask _umask // Note this is still umask on Borland
# define umask _umask
#endif
// support for realpath call
......@@ -154,9 +152,7 @@ public:
}
#endif
#if defined(_WIN32) && \
(defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || \
defined(__MINGW32__))
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
# include <direct.h>
# include <io.h>
# define _unlink unlink
......@@ -170,13 +166,6 @@ public:
#else
# define KWSYS_SYSTEMTOOLS_MAXPATH 16384
#endif
#if defined(__WATCOMC__)
# include <direct.h>
# define _mkdir mkdir
# define _rmdir rmdir
# define _getcwd getcwd
# define _chdir chdir
#endif
#if defined(__BEOS__) && !defined(__ZETA__)
# include <be/kernel/OS.h>
......@@ -259,11 +248,7 @@ inline const char* Getcwd(char* buf, unsigned int len)
}
inline int Chdir(const std::string& dir)
{
# if defined(__BORLANDC__)
return chdir(dir.c_str());
# else
return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
# endif
}
inline void Realpath(const std::string& path, std::string& resolved_path,
std::string* errorMessage = 0)
......@@ -937,15 +922,9 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode)
}
topdir = dir;
if (Mkdir(topdir, mode) != 0) {
// There is a bug in the Borland Run time library which makes MKDIR
// return EACCES when it should return EEXISTS
// if it is some other error besides directory exists
// then return false
if ((errno != EEXIST)
#ifdef __BORLANDC__
&& (errno != EACCES)
#endif
) {
if (errno != EEXIST) {
return false;
}
}
......@@ -1448,11 +1427,7 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf)
// long paths, but _wstat64 rejects paths with '?' in them, thinking
// they are wildcards.
std::wstring const& wpath = Encoding::ToWide(path);
# if defined(__BORLANDC__)
return _wstati64(wpath.c_str(), buf);
# else
return _wstat64(wpath.c_str(), buf);
# endif
#else
return stat(path.c_str(), buf);
#endif
......
......@@ -67,7 +67,7 @@ static SystemToolsManager SystemToolsManagerInstance;
// combined using the | operator.
typedef int TestFilePermissions;
#if defined(_WIN32) && !defined(__CYGWIN__)
// On Windows (VC and Borland), no system header defines these constants...
// On Windows (VC), no system header defines these constants...
static const TestFilePermissions TEST_FILE_OK = 0;
static const TestFilePermissions TEST_FILE_READ = 4;
static const TestFilePermissions TEST_FILE_WRITE = 2;
......@@ -317,11 +317,7 @@ public:
* Cross platform wrapper for stat struct
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
# if defined(__BORLANDC__)
typedef struct stati64 Stat_t;
# else
typedef struct _stat64 Stat_t;
# endif
#else
typedef struct stat Stat_t;
#endif
......@@ -555,7 +551,7 @@ public:
static FILE* Fopen(const std::string& file, const char* mode);
/**
* Visual C++ does not define mode_t (note that Borland does, however).
* Visual C++ does not define mode_t.
*/
#if defined(_MSC_VER)
typedef unsigned short mode_t;
......
......@@ -161,33 +161,6 @@ int main()
}
#endif
#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
int main()
{
int a = 1;
__asm {
xor EBX, EBX;
mov a, EBX;
}
return a;
}
#endif
#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM_CPUID
int main()
{
int a = 0;
__asm {
xor EAX, EAX;
cpuid;
mov a, EAX;
}
return a;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_WSTRING
# include <string>
void f(std::wstring*)
......
......@@ -8,9 +8,6 @@
#include KWSYS_HEADER(FStream.hxx)
#include <cstring>
#ifdef __BORLANDC__
# include <mem.h> /* memcmp */
#endif
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
......
......@@ -24,10 +24,6 @@
# include <unistd.h>
#endif
#if defined(__BORLANDC__)
# pragma warn - 8060 /* possibly incorrect assignment */
#endif
/* Platform-specific sleep functions. */
#if defined(__BEOS__) && !defined(__ZETA__)
......
......@@ -25,13 +25,13 @@
#include <iostream>
#include <sstream>
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h> /* _umask (MSVC) / umask (Borland) */
# include <io.h> /* _umask (MSVC) */
# ifdef _MSC_VER
# define umask _umask // Note this is still umask on Borland
# define umask _umask
# endif
#endif
#include <sys/stat.h> /* umask (POSIX), _S_I* constants (Windows) */
// Visual C++ does not define mode_t (note that Borland does, however).
// Visual C++ does not define mode_t.
#if defined(_MSC_VER)
typedef unsigned short mode_t;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment