1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

204 Commits

Author SHA1 Message Date
Pasukhin Dmitry
fb73c3b712
Coding - Initialize member variables with default values #362
Clang-tidy applying rule for cppcoreguidelines-pro-type-member-init.
Updated: TKernel and TKMath
Update constructor in some classes instead of direct initialization
Refactor Bnd_BoundSortBox and Bnd_Box constructors to initialize member variables directly
2025-02-12 14:26:00 +00:00
dpasukhi
a5a7b3185b Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
2025-01-26 00:43:57 +00:00
dpasukhi
f91655b0c5 Coding - Isolate long attached comments for clang-format #259
Automatically update code with clang-format disabling for avoiding formatting.
You can check the python script in GitHub PR
2025-01-16 20:15:29 +00:00
dpasukhi
727f8fa188 Foundation Classes - Move Map's algo part to external file #213
Updated multiple classes to utilize the new NCollection_MapAlgo
  for union, intersection, and other set operations,
    improving code structure and maintainability.
Deprecated older methods in NCollection_Map in favor of the new algorithmic approaches.
2024-12-27 13:07:05 +00:00
dpasukhi
1b4bb62150 Foundation Classes - Separate map's prime declaration #211
Refactor TCollection to use NCollection_Primes and remove obsolete TCollection.cxx
New prime declaration now will be more clear to use.
2024-12-27 10:40:54 +00:00
dpasukhi
f7dea47c33 Coding - Fixing clang-tidy warnings #207
First iteration for fixing warnings for:
- TKernel
- TKMath
- TKGeomBase
2024-12-22 12:16:58 +00:00
dpasukhi
604c3b890c Documentation - Update parameter annotations for consistency #161
Reorganized style for param to the next templates:
 - "@param theParameter description ..."
 - "@param[in] theParameter description ..."
 - "@param[out] theParameter description ..."
 - "@param[in][out] theParameter description ..."
 The replacement was with keeping spacing, no removing of extra spaces.
In some files '/' was used instead of '@', that was not updated yet.
2024-11-17 20:22:51 +00:00
dpasukhi
72b244bc98 Coding - Resolving C26439 & type formatting warnings
Sprintf  with %s always convert values into char*, not safety from int.
Move operators and constructors can be marked as noexcept
2024-09-14 20:26:41 +00:00
luzpaz
245febe036
0033778: Documentation - Fix various typos found in codebase 2024-07-26 08:51:12 +01:00
luzpaz
76df27830b
0033762: Documentation - Fix various typos found in codebase 2024-07-14 15:19:44 +01:00
dpasukhi
5b0f5b52b9 0033554: Foundation Classes - Missed hash specialization for enumerations
Fixed problem with missed hash specialization
2023-12-15 19:53:06 +00:00
Xu Zhongxing
60792f26f0 0033552: Foundation Classes - NCollection_BaseMap move ctor clears wrong pointer
Replaced correct class member to clear
2023-12-15 19:51:57 +00:00
dpasukhi
ffd7a3aa4f 0033544: Foundation Classes - Fixing compiler problems [HotFix]
Fixed problem with Clang-16
Fixed problem with SWIG-4
Fixed genproj procedure
2023-12-06 13:00:13 +00:00
dpasukhi
1103eb60af 0033370: Foundation Classes - Moving into STL and Boost functionality
NCollection containers update:
  - NCollection_Array1 - updated functionality
  - NCollection_Array2 - NCollection_Array1 as a wrapper for 2array
  - NCollection_Vector -> NCollection_DynamicArray was renamed and reworked.
TCollection:
  - Use static empty string to avoid allocations on empty string
 NCollection allocators update:
  - NCollection_Allocator - allocator that used Standard::Allocate
  - NCollection_OccAllocator - allocator-wrapper that used OCC BaseAllocator objects
  - NCollection_IncAllocator - rework to increase performance
Standard:
  - Rework functionality to use different allocation libs
  - Implement basic of new way to wrap allocations tools
  - Define 4 ways to allocation (defines in configure stage)
 Additional changes:
  - Hash function uses std::hash functionality
   - size_t as a hash value
  - New HashUtils with Murmur and FVN hash algo for x32 and x64
  - Deprecated _0.cxx and .gxx DE classes reorganized
  - Create own utility for std memory
  - Update Standard_Transient to be more platform-independent
 Math TK changes:
  - math_Vector -> match_BaseVector<>
    - Buffer decreased to cash 32 elements instead of 512
2023-12-04 13:37:09 +00:00
Eugeny Maltchikov
9218d04b9a 0033138: [Foundation Classes] - NCollection_IncAllocator- Decrease the default block size
Set default memory block size for IncAllocator to 12KB to make sure the Low Fragmentation Heap is used for memory allocations on Windows platform.
2022-10-31 18:18:21 +03:00
ddzama
1a1739b200 0032957: Add Standard_Noexcept definition
into Standard_Macro.hxx and
employ Standard_Noexcept.
2022-08-18 11:55:14 +03:00
aml
b9280b8b27 0032969: Coding - get rid of unused headers [IMeshData to PLib]
Removed unused exception classes OSD_Exception_FLT_DIVIDE_BY_ZERO, OSD_Exception_INT_DIVIDE_BY_ZERO, OSD_Exception_FLT_DENORMAL_OPERAND, OSD_Exception_FLT_INEXACT_RESULT, OSD_Exception_FLT_INVALID_OPERATION, OSD_Exception_FLT_OVERFLOW, OSD_Exception_FLT_STACK_CHECK, OSD_Exception_FLT_UNDERFLOW.
2022-05-17 20:09:12 +03:00
ddzama
7b3f255f23 0032917: Coding Rules - eliminate MSVS warning C26440 on VS2019/C++20 (If your function may not throw, declare it noexcept)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warning C26440: "If your function may not throw, declare it noexcept"

"If code is not supposed to cause any exceptions,
it should be marked as such by using the 'noexcept' specifier.
This would help to simplify error handling on the client code side,
as well as enable compiler to do additional optimizations."
2022-04-29 18:09:00 +03:00
ddzama
8af9bbd59a 0032906: Coding Rules - get rid of std::iterator inheritance (deprecated since C++17) 2022-04-22 00:27:47 +03:00
ddzama
878ea8cd2b 0032910: Coding Rules - fix uninitialized class fields in constructor initialization block reported by VS2019/C++20
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warnings about uninitialized class fields in constructor initialization block.
2022-04-08 18:52:41 +03:00
kgv
f291ad2528 0032733: Coding Rules - fix misprints in Doxygen tags 2021-12-17 17:41:36 +03:00
kgv
65acdce54c 0032352: Coding Rules - clean up code from compatibility hacks with pre-C++11 compilers
Removed usage of std::auto_ptr.
opencascade::std workarounds for VS2008 have been dropped, when possible.
OCCT_NO_RVALUE_REFERENCE workaround for VS2008 has been removed.
2021-12-03 17:56:37 +03:00
rkv
57c5e9e895 0026171: Coding rules - eliminate -Wshorten-64-to-32 CLang warnings 2021-11-21 12:42:08 +03:00
ski
5bd54bef32 0024975: Improve of preprocessor directives in header files to be equal to the file name
Preprocessor directives were changed or created by function "check_headers" from script adm/upgrade.tcl (CR24816)
2021-10-27 21:00:02 +03:00
mkrylova
3016a39071 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings
- fixed CLang UndefinedBehaviorSanitizer warnings
2021-09-03 20:19:54 +03:00
nds
4e993e4d0d 0027919: Visualization - support multiple transformation persistence groups within single presentation
Added transform persistence property to Graphic3d_Group and Select3D_SensitiveEntity.
SelectMgr_ViewerSelector, Graphic3d_Layer and OpenGl_Structure have been updated
to process per-group transform persistence within picking, ZFit and rendering.

Added zoomable state to Prs3d_ArrowAspect supported by PrsDim_Dimension.

Added gp_GTrsf::SetMat4(), opposite to gp_GTrsf::GetMat4().
2021-07-23 18:31:51 +03:00
zaphod
ff1f0c9ae2 0032402: Coding Rules - eliminate msvc warning C4668 (symbol is not defined as a preprocessor macro, replacing with '0' for directive)
Make preprocessor expressions consistent with respect to guard expressions.

Fixed usage of macros __QNX__, IRIX, OCCT_DEBUG, DO_INVERSE, DRAW, CHFI3D_DEB by value.
Removed obsolete hack for Sun Workshop 5.0 compiler.
2021-06-03 18:06:46 +03:00
luz paz
316ea29318 0031939: Coding - correction of spelling errors in comments [part 10]
Fix various typos via codespell.
2021-04-22 14:50:47 +03:00
kgv
a2af24d1a9 0032289: Visualization - add NCollection_Mat3 for 3x3 matrix similar to NCollection_Mat4
Introduced NCollection_Mat3 class similar to NCollection_Mat4.
Added NCollection_Mat4::operator() alias to NCollection_Mat4::Value().
Added NCollection_Mat4::Negated(), ::Subtracted(), ::Added(), ::Divided() operations.
Added a note to NCollection_Mat4::GetData() that matrix values are stored in column-major order.
Removed duplicated operator== operators from NCollection_Mat4/NCollection_Vec4/NCollection_Vec3/NCollection_Vec2 classes.

Removed obsolete and no more used matrix state fields from OpenGl_Workspace.
Removed obsoiete structure OpenGl_Matrix (replaced by OpenGl_Mat4).
OpenGl_ShaderProgram - duplicated methods have been replaced by templates.
2021-04-09 18:12:05 +03:00
luz paz
5e6e59146f 0031939: Coding - correction of spelling errors in comments [part 9]
Fix various typos via codespell.
2021-04-02 20:01:34 +03:00
kgv
374dffea0b 0032139: Visualization - support single-precision floating point data within Poly_Triangulation
Introduced NCollection_AliasedArray collection defining a general byte array
to be aliased as array of elements of mutable type.

Poly_ArrayOfNodes specializes this interface for collecting 2d/3d points with single/double precision.
Poly_Triangulation relies on this new class for definition of 3D nodes and UV coordinates
using gp_Pnt and gp_Pnt2d by default as before.

RWGltf_CafReader now fills in triangulation using single precision by default (as stored in the file).
2021-02-20 18:58:56 +03:00
kgv
0f26ed5476 0032044: Foundation Classes - NCollection_Array2::Resize() does not allocate pointer array
NCollection_Array2::Resize() has been fixed to set myDeletable before calling Allocate().
2021-01-12 16:07:23 +03:00
tiv
0b55d29b6a 0031628: Configuration - Visual Studio 2019 compiler hangs on building 32-bit target
The workaround for a bug occurred in MS Visual Studio 2019 / Win32 / Release configuration with disabled Whole Program Optimization is implemented.
The problem was at the line "std::stable_sort(aPairList.begin(), aPairList.end(), BRepExtrema_CheckPair_Comparator);" of BRepExtrema_DistShapeShape.cxx source file,
and linked to NCollection_Vector::Differ() method.
This workaround was suggested by MSFT team.
2020-09-27 12:00:05 +03:00
sshutina
a516227511 0031354: Visualization - Dump improvement for V3d, Graphic3d, Aspect
- do not dump light in view as it's dumped in the viewer
2020-09-04 18:14:24 +03:00
kgv
99ee8f1a83 0031671: Coding Rules - eliminate warnings issued by clang 11
Fixed -Wdeprecated-copy warning by removing trivial operator=.
Fixed formatting issues in places producing -Wmisleading-indentation warning.
2020-07-23 16:08:17 +03:00
kgv
158f2931a7 0031004: Coding - eliminate warnings issued by gcc 9.1.0
Fixed -Wrestrict warning within OSD::SetSignal().

Fixed -Wdeprecated-copy warning by adding missing counterpart
in pair copy constructor / assignment operator or by removing trivial constructor.

AdvApp2Var_Node, AdvApp2Var_Patch are now declared as Handle.
AdvApp2Var_Iso is now passed by Handle.

Disabled operator= for TDF_Transaction and TDF_IDFilter.

Standard.cxx - fixed GCC version mischeck causing building failure with experimental GCC versions.

TopOpeBRepDS_EXPORT.cxx - fixed -Wmaybe-uninitialized warnings.
2020-05-15 18:08:07 +03:00
kgv
89fcfe1551 0031512: Foundation Classes - drop unused class NCollection_Comparator 2020-04-23 10:45:50 +03:00
nds
bc73b00672 0031313: Foundation Classes - Dump improvement for classes
- Provide DumpJson for geometrical, ocaf and visualization classes;
- Change depth parameter of DumpJson (constant is not obligate here)
- Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
- change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
- OCCT_DUMP_* does not require semicolon
- class header is included first in source files of TDataStd, TDocStd, TCAFDoc
2020-01-31 17:13:40 +03:00
abv
1bd04b5a02 0031060: Configuration - Support building with CLang compiler under VS 2019
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
2019-11-03 21:47:59 +03:00
msv
746cb7c328 0031020: Coding - invalid inline usage in BRepBlend_AppSurface
BRepBlend_AppSurface and some other classes have been corrected to avoid inlining member functions in .cxx code.
2019-10-22 12:12:25 +03:00
emv
92686513a2 0030994: Test cases of group sat/read_parallel_1/_2 are crashed with exception
Revert changes by #30518
2019-09-25 17:49:04 +03:00
abv
eb62cbc494 0030518: Foundation Classes - NCollection_IndexedDataMap array out of bounds
Implementation of NCollection_IndexedDataMap::Iterator is revised to avoid unintended access to the element out of array bounds
2019-09-20 19:39:30 +03:00
kgv
9eefb360a7 0030846: Foundation Classes - StorageInfo violates the C++ One Definition Rule
Local definitions have been put into anonymouse namespace within files
OSD_MAllocHook.cxx and NCollection_BaseAllocator.cxx.
2019-09-06 18:26:41 +03:00
tiv
0423218095 0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
"endl" manipulator for Message_Messenger is renamed to "Message_EndLine".

The following entities from std namespace are now used
with std:: explicitly specified (from Standard_Stream.hxx):
std::istream,std::ostream,std::ofstream,std::ifstream,std::fstream,
std::filebuf,std::streambuf,std::streampos,std::ios,std::cout,std::cerr,
std::cin,std::endl,std::ends,std::flush,std::setw,std::setprecision,
std::hex,std::dec.
2019-08-16 12:16:38 +03:00
nbv
858435884d 0029523: Problem with BRepOffsetAPI_MakeEvolved
The capabilities of the class BRepOffsetAPI_MakeEvolved have been extended with involving alternate algorithm of resolving the loops in the piped shape. The new option theIsVolume is added for that in the constructor.

New class BRepFill_AdvancedEvolved has been created in order to provide new OCCT-algorithm combining BRepFill_PipeShell and BOPAlgo_MakerVolume.

A change in BOPAlgo_PaveFiller.cxx has been made in order to solve a specific problem of Boolean operation.

The interface of DRAW-command "evolved" has been updated to add the new option. DRAW-command "evolvedsolid" has been deleted. Now it is replaced with DRAW-command "evolved" with the option "-solid".

Testgrid "evolved" has been created.
2019-05-07 14:20:58 +03:00
tiv
2b2be3fb82 0030550: Coding - Integer overflow in Standard_CString HashCodes
0030551: Foundation Classes - Integer overflow in NCollection_CellFilter HashCode

Signed integers are not used in hash code functions now to prevent undefined behavior on left shift operations with signed integers.
A possibility of negative values of hash codes is eliminated.
INT_MAX → IntegerLast() in hash code functions.
All found hash code functions behaves uniformly now: they return a value in the range [1, theUpperBound]. Relevant comments are added to such functions.
2019-04-16 20:38:23 +03:00
tiv
f9b30c0db3 0030623: Draw Harness - support hex color codes within ViewerTest::ParseColor()
ViewerTest::ParseColor() function is improved to be able to parse the following set of input arguments:
  - "Red Green Blue [Alpha]", where Red, Green, Blue, Alpha must be integers within the range [0, 255] or reals within the range [0.0, 1.0]. Note that "0 0 1" triple is parsed as "0.0 0.0 1.0" and will be interpreted as a blue color.
  - "ColorName [Alpha]", where ColorName is one of WHITE, BLACK, RED, GREEN, BLUE, etc. (look at Quantity_NameOfColor enumeration for all possible variants). Alpha may be integer or real, as described at the previous list item.
  - #HHH, [#]HHH[H], [#]HHHHHH[HH], where H is a hexadecimal digit (0 .. 9, a .. f, or A .. F). There are a short hexadecimal RGB, RGBA formats, and a usual RGB[A], respectively.
2019-04-12 18:48:18 +03:00
kgv
aff73fd598 0030582: Coding - avoid defining references to properties of NULL objects
Approx_SweepApproximation::Perform() now creates empty arrays.
GeomAdaptor_SurfaceOfRevolution::UTrim() - fixed No_Exception misuse.
StdPrs_ShadedShape - fixed defining an invalid reference to Poly_Triangulation::UVNodes().

BSplCLib::MovePoint() and BSplCLib::MovePointAndTangent() now take optional
weights parameter as pointer consistent to other methods like BSplCLib::BuildEval().
2019-03-22 17:21:01 +03:00
kgv
d65f9183fd 0030569: Foundation Classes - NCollection_Shared lacks inclusion of NCollection_DefineAlloc.hxx
Add missing includes.
2019-03-18 19:43:55 +03:00
kgv
af2fa459f1 0030547: Foundation Classes - NCollection_DoubleMap lacks Seek() method
Added Seek1() and Seek2() methods to NCollection_DoubleMap class.
2019-03-13 11:00:21 +03:00