mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-08 18:40:55 +03:00
Build tools are updated to support building with Visual Studion 2019 toolset ClangCL (LLVM clang-cl): - In CMake builds, use of unsupported option "-std=c++0x" is avoided - Tool genconf recognizes availability of ClangCL toolset and proposes it in the list - Tool genproj recognizes new compiler specification VCVER=vclang and generates VS 2019 projects for it Note that vclang configuration puts binaries to folder "vc14" as it is compatible with vc14 CRT. Code is updated to build with Clang for Windows without errors and warnings: - In BVH classes, pure virtual destructors are replaced by empty ones, to avoid bogus compiler warning - In .lex files, pragmas are added to disable warnings in parser code - In OSD, signature of function _osd_wnt_set_error() is corrected to avoid warning on incorrect use of va_args (undefined behavior) - In OSD_Host, OSD_Parallel_TBB, warnings on usage of deprecated function are disabled - In Quantity_ColorRGBA and ViewerTest_CmdParser, incorrect use of predefined macro __FUNCTION__ assuming it was a string literal is avoided - In Standard_Macro.hxx, code is reordered to handle Clang for Windows appropriately - In AdvApp2Var_SysBase.hxx, inclusion of obsolete (MSVC-specific) header file is replaced by Standard_TypeDef.hxx - In Standard_ErrorHandler.hxx, empty statements added to avoid warning on unused class fields - In IVtkDraw and ViewerTest, interface is corrected to use actual type avoiding unnecessary type casts Off-topic: corrections of some errors (uninitialized class fields) reported by VS Code Analysis in TKernel
57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
// Created on: 2014-08-19
|
|
// Created by: Alexander Zaikin
|
|
// Copyright (c) 1996-1999 Matra Datavision
|
|
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
// Version of parallel executor used when TBB is available
|
|
#ifdef HAVE_TBB
|
|
|
|
#include <OSD_Parallel.hxx>
|
|
#include <OSD_ThreadPool.hxx>
|
|
#include <Standard_ProgramError.hxx>
|
|
|
|
Standard_DISABLE_DEPRECATION_WARNINGS
|
|
#include <tbb/parallel_for.h>
|
|
#include <tbb/parallel_for_each.h>
|
|
#include <tbb/blocked_range.h>
|
|
#include <tbb/task_scheduler_init.h>
|
|
Standard_ENABLE_DEPRECATION_WARNINGS
|
|
|
|
//=======================================================================
|
|
//function : forEachExternal
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
|
|
UniversalIterator& theEnd,
|
|
const FunctorInterface& theFunctor,
|
|
Standard_Integer theNbItems)
|
|
{
|
|
try
|
|
{
|
|
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
|
|
const Standard_Integer aNbThreads = theNbItems > 0 ?
|
|
aThreadPool->NbDefaultThreadsToLaunch() : -1;
|
|
|
|
tbb::task_scheduler_init aScheduler (aNbThreads);
|
|
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
|
|
}
|
|
catch (tbb::captured_exception& anException)
|
|
{
|
|
throw Standard_ProgramError (anException.what());
|
|
}
|
|
}
|
|
|
|
#endif /* HAVE_TBB */
|