mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0022972: Eliminate macro definitions that has compiler-provided analogs (WNT and so on)
1) Macro definition WNT replaced by _WIN32 and _MSC_VER for platform and compiler detection accordingly. 2) Macro definition LIN replaced by __linux__ macro. 3) Macro definition DEB replaced by OCCT_DEBUG macro.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
@@ -47,7 +47,7 @@ static Standard_Mutex theMutex;
|
||||
|
||||
static inline Standard_ThreadId GetThreadID()
|
||||
{
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
return pthread_self();
|
||||
#else
|
||||
return GetCurrentThreadId();
|
||||
|
@@ -77,10 +77,10 @@ extern "C" int getpagesize() ;
|
||||
#elif defined(__APPLE__)
|
||||
#define MMAP_BASE_ADDRESS 0x80000000
|
||||
#define MMAP_FLAGS (MAP_ANON | MAP_PRIVATE)
|
||||
#elif defined(LIN)
|
||||
#elif defined(__linux__)
|
||||
#define MMAP_BASE_ADDRESS 0x20000000
|
||||
#define MMAP_FLAGS (MAP_PRIVATE)
|
||||
#elif defined(WNT)
|
||||
#elif defined(_WIN32)
|
||||
//static HANDLE myhMap;
|
||||
#else
|
||||
#define MMAP_BASE_ADDRESS 0x60000000
|
||||
@@ -197,7 +197,7 @@ void Standard_MMgrOpt::Initialize()
|
||||
myNbPages = 1000;
|
||||
|
||||
// get system-dependent page size
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
myPageSize = getpagesize();
|
||||
if ( ! myPageSize )
|
||||
myMMap = 0;
|
||||
@@ -247,7 +247,7 @@ void Standard_MMgrOpt::Initialize()
|
||||
perror("ERR_MEMRY_FAIL");
|
||||
#endif
|
||||
|
||||
#if defined(IRIX) || defined(__sgi) || defined(SOLARIS) || defined(__sun) || defined(LIN) || defined(linux) || defined(__FreeBSD__) || defined(__ANDROID__)
|
||||
#if defined(IRIX) || defined(__sgi) || defined(SOLARIS) || defined(__sun) || defined(__linux__) || defined(linux) || defined(__FreeBSD__) || defined(__ANDROID__)
|
||||
if ((myMMap = open ("/dev/zero", O_RDWR)) < 0) {
|
||||
if ((myMMap = open ("/dev/null", O_RDWR)) < 0){
|
||||
myMMap = 0;
|
||||
@@ -505,7 +505,7 @@ Standard_Integer Standard_MMgrOpt::Purge(Standard_Boolean )
|
||||
// release memory pools containing no busy memory;
|
||||
// for that for each pool count the summary size of blocks
|
||||
// got from the free lists allocated from this pool
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
const Standard_Size PoolSize = myPageSize * myNbPages;
|
||||
#else
|
||||
const Standard_Size PoolSize =
|
||||
@@ -708,7 +708,7 @@ retry:
|
||||
|
||||
// if MMap option is ON, allocate using memory mapped files
|
||||
if (myMMap) {
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
|
||||
// align size to page size
|
||||
const Standard_Size AlignedSize = PAGE_ALIGN(Size, myPageSize);
|
||||
@@ -730,7 +730,7 @@ retry:
|
||||
// save actually allocated size into argument
|
||||
Size = AlignedSize;
|
||||
|
||||
#else /* WNT */
|
||||
#else /* _WIN32 */
|
||||
|
||||
// align size to page size, taking into account additional space needed to
|
||||
// store handle to the memory map
|
||||
@@ -797,14 +797,14 @@ retry:
|
||||
|
||||
void Standard_MMgrOpt::FreeMemory (Standard_Address aBlock,
|
||||
const Standard_Size
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
aSize
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// release memory (either free or unmap)
|
||||
if ( myMMap ) {
|
||||
#ifndef WNT
|
||||
#ifndef _WIN32
|
||||
// align size to page size, just the same as in AllocMemory()
|
||||
const Standard_Size AlignedSize = PAGE_ALIGN(aSize, myPageSize);
|
||||
munmap((char*)aBlock, AlignedSize);
|
||||
|
@@ -16,11 +16,6 @@
|
||||
#include <Standard_MMgrTBBalloc.hxx>
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
|
||||
// NOTE: replaced by more correct check
|
||||
//#if defined(WNT) || defined(LIN)
|
||||
//#define HAVE_TBB 1
|
||||
//#endif
|
||||
|
||||
// paralleling with Intel TBB
|
||||
#ifdef HAVE_TBB
|
||||
#include <tbb/scalable_allocator.h>
|
||||
|
@@ -33,11 +33,6 @@
|
||||
// Windows-specific definitions
|
||||
//======================================================
|
||||
|
||||
// check if WNT macro is not defined but compiler is MSVC
|
||||
#if defined(_MSC_VER) && !defined(WNT)
|
||||
#error "Wrong compiler options has been detected. Add /DWNT option for proper compilation!!!!!"
|
||||
#endif
|
||||
|
||||
# if defined(_WIN32) && !defined(HAVE_NO_DLL)
|
||||
|
||||
# ifndef Standard_EXPORT
|
||||
@@ -94,7 +89,7 @@
|
||||
#define NOIME NOIME
|
||||
#endif
|
||||
|
||||
# else /* WNT */
|
||||
# else /* UNIX */
|
||||
|
||||
//======================================================
|
||||
// UNIX definitions
|
||||
@@ -123,14 +118,13 @@
|
||||
#define _MEMORY_H
|
||||
#endif
|
||||
|
||||
# endif /* WNT */
|
||||
# endif /* _WIN32 */
|
||||
|
||||
//======================================================
|
||||
// Other
|
||||
//======================================================
|
||||
|
||||
# ifndef __Standard_API
|
||||
//# ifdef WNT
|
||||
# if !defined(_WIN32) || defined(__Standard_DLL) || defined(__FSD_DLL) || defined(__MMgt_DLL) || defined(__OSD_DLL) || defined(__Plugin_DLL) || defined(__Quantity_DLL) || defined(__Resource_DLL) || defined(__SortTools_DLL) || defined(__StdFail_DLL) || defined(__Storage_DLL) || defined(__TColStd_DLL) || defined(__TCollection_DLL) || defined(__TShort_DLL) || defined(__Units_DLL) || defined(__UnitsAPI_DLL) || defined(__Dico_DLL)
|
||||
# define __Standard_API Standard_EXPORT
|
||||
# define __Standard_APIEXTERN Standard_EXPORTEXTERN
|
||||
@@ -138,9 +132,6 @@
|
||||
# define __Standard_API Standard_IMPORT
|
||||
# define __Standard_APIEXTERN Standard_IMPORT
|
||||
# endif // __Standard_DLL
|
||||
//# else
|
||||
//# define __Standard_API
|
||||
//# endif // WNT
|
||||
# endif // __Standard_API
|
||||
|
||||
#endif
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
// Platform-dependent definition of the thread identifier type
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
typedef DWORD Standard_ThreadId;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
typedef struct {
|
||||
|
@@ -17,10 +17,6 @@
|
||||
#ifndef _Standard_values_HeaderFile
|
||||
# define _Standard_values_HeaderFile
|
||||
|
||||
#if defined(_MSC_VER) && !defined(WNT)
|
||||
#error "Wrong compiler options has been detected. Add /DWNT option for proper compilation!!!!!"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <limits>
|
||||
#else
|
||||
|
Reference in New Issue
Block a user