Skip to content

Commit 314527f

Browse files
authored
Coding - Update Clang-format with more macroses (#677)
- Updates `.clang-format` to include `OCC_CATCH_SIGNALS`, `DEFINE_STANDARD_RTTIEXT`, and `Draw_Drawable3D_FACTORY` as statement macros - Adds a GitHub action step to automatically remove empty lines after `Standard_DEPRECATED` macro declarations - Reformats numerous files by removing blank lines after deprecated method declarations and improving macro formatting
1 parent d1b00bf commit 314527f

93 files changed

Lines changed: 169 additions & 282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ UseTab: Never
3636
# OCCT specific settings
3737
StatementMacros:
3838
- Standard_FALLTHROUGH
39+
- OCC_CATCH_SIGNALS
40+
- DEFINE_STANDARD_RTTIEXT
41+
- Draw_Drawable3D_FACTORY
3942
- Standard_DEPRECATED
4043
TypenameMacros:
4144
- Handle

.github/actions/clang-format-check/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ runs:
5656
clang-format -i -style=file $_
5757
}
5858
59+
- name: Remove empty lines after Standard_DEPRECATED
60+
if: steps.changed-files.outputs.has_files == 'true'
61+
shell: pwsh
62+
run: |
63+
$files = Get-Content "changed_files.txt" | Where-Object { Test-Path $_ }
64+
$files | ForEach-Object {
65+
$content = Get-Content $_ -Raw
66+
$pattern = '(Standard_DEPRECATED\("[a-z0-9\.,;\s\(\)_-]+"(?:[\s\n]+"[a-z0-9\.,;\s\(\)_-]+")?\)\n)\n+'
67+
$newContent = $content -replace $pattern, '$1'
68+
if ($content -ne $newContent) {
69+
Set-Content -Path $_ -Value $newContent -NoNewline
70+
}
71+
}
72+
5973
- name: Check git status
6074
id: git-check
6175
if: steps.changed-files.outputs.has_files == 'true'

src/ApplicationFramework/TKCAF/TNaming/TNaming_Identifier.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Standard_Boolean IsImported(const Handle(TNaming_NamedShape)& NS)
264264
it.Next();
265265
if (!it.More())
266266
return 0;
267-
// plus d un shape.
267+
// plus d un shape.
268268
#ifdef OCCT_DEBUG
269269
std::cout << "WARNING IMPORTED" << std::endl;
270270
#endif

src/ApplicationFramework/TKCAF/TNaming/TNaming_Name.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ static Standard_Boolean FilterByNeighbourgs(const TDF_Label& L,
14981498
TC = TopAbs_VERTEX;
14991499
// clang-format off
15001500
if (ShapeType == TopAbs_VERTEX) TC = TopAbs_VERTEX; // szy 31.03.10 - to process case when Candidate is of type Vertex
1501-
// clang-format on
1501+
// clang-format on
15021502

15031503
#ifdef OCCT_DEBUG_FNB
15041504
i = 1;

src/ApplicationFramework/TKCDF/PCDM/PCDM_StorageDriver.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument,
4949
{
5050
try
5151
{
52-
OCC_CATCH_SIGNALS Make(aDocument, thePersistentDocuments);
52+
OCC_CATCH_SIGNALS
53+
Make(aDocument, thePersistentDocuments);
5354
}
5455
catch (Standard_Failure const& anException)
5556
{

src/DataExchange/TKDESTEP/GeomToStep/GeomToStep_MakeBSplineCurveWithKnots.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
//=============================================================================
3838
GeomToStep_MakeBSplineCurveWithKnots::GeomToStep_MakeBSplineCurveWithKnots(
3939
const Handle(Geom_BSplineCurve)& BS,
40-
const StepData_Factors& theLocalFactors)
41-
{
40+
const StepData_Factors& theLocalFactors){
4241
#define Array1OfPnt_gen TColgp_Array1OfPnt
4342
#include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx"
4443
#undef Array1OfPnt_gen

src/DataExchange/TKDESTEP/GeomToStep/GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@
3838
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
3939
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(
4040
const Handle(Geom_BSplineCurve)& BS,
41-
const StepData_Factors& theLocalFactors)
42-
{
41+
const StepData_Factors& theLocalFactors){
4342
#define Array1OfPnt_gen TColgp_Array1OfPnt
4443
#include "GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx"
4544
#undef Array1OfPnt_gen
46-
}
45+
}
4746

4847
//=============================================================================
4948
// Creation d' une bspline_curve_with_knots_and_rational_bspline_curve de

src/DataExchange/TKDESTEP/GeomToStep/GeomToStep_MakeLine.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
//=============================================================================
3434
// Creation d' une line de prostep a partir d' une Lin de gp
3535
//=============================================================================
36-
GeomToStep_MakeLine::GeomToStep_MakeLine(const gp_Lin& L, const StepData_Factors& theLocalFactors)
37-
{
36+
GeomToStep_MakeLine::GeomToStep_MakeLine(const gp_Lin& L, const StepData_Factors& theLocalFactors){
3837
#define Vec_gen gp_Vec
3938
#include "GeomToStep_MakeLine_gen.pxx"
4039
#undef Vec_gen
@@ -44,8 +43,8 @@ GeomToStep_MakeLine::GeomToStep_MakeLine(const gp_Lin& L, const StepData_Factors
4443
// Creation d' une line de prostep a partir d' une Lin2d de gp
4544
//=============================================================================
4645

47-
GeomToStep_MakeLine::GeomToStep_MakeLine(const gp_Lin2d& L, const StepData_Factors& theLocalFactors)
48-
{
46+
GeomToStep_MakeLine::GeomToStep_MakeLine(const gp_Lin2d& L,
47+
const StepData_Factors& theLocalFactors){
4948
#define Vec_gen gp_Vec2d
5049
#include "GeomToStep_MakeLine_gen.pxx"
5150
#undef Vec_gen

src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWPresentationLayerUsage.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void RWStepVisual_RWPresentationLayerUsage::ReadStep(
3434
if (!data->CheckNbParams(num, 2, ach, "presentation_layer_usage"))
3535
return;
3636

37-
// --- own fields
37+
// --- own fields
3838
#include <StepVisual_PresentationLayerAssignment.hxx>
3939
#include <StepVisual_PresentationRepresentation.hxx>
4040
Handle(StepVisual_PresentationLayerAssignment) pla;

src/DataExchange/TKXCAF/XCAFDoc/XCAFDoc_VisMaterial.hxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,13 @@ public:
132132
Standard_EXPORT void SetFaceCulling(Graphic3d_TypeOfBackfacingModel theFaceCulling);
133133

134134
Standard_DEPRECATED("Deprecated method, FaceCulling() should be used instead")
135-
136135
Standard_Boolean IsDoubleSided() const
137136
{
138137
return myFaceCulling == Graphic3d_TypeOfBackfacingModel_DoubleSided;
139138
}
140139

141140
Standard_DEPRECATED("Deprecated method, SetFaceCulling() should be used "
142141
"instead")
143-
144142
void SetDoubleSided(Standard_Boolean theIsDoubleSided)
145143
{
146144
SetFaceCulling(theIsDoubleSided ? Graphic3d_TypeOfBackfacingModel_DoubleSided

0 commit comments

Comments
 (0)