Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/configure-occt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-deprecated-declarations -Wno-error=cast-function-type-mismatch" \
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_CXX_FLAGS here includes -Wno-unknown-warning-option, which is Clang-specific. Since this action supports inputs.compiler: gcc, invoking it with GCC would fail on an unknown option (and -Werror may make this worse). Consider making the warning-flag list conditional on the selected compiler (or moving compiler-specific flags into CMake logic that checks CMAKE_CXX_COMPILER_ID).

Suggested change
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-deprecated-declarations -Wno-error=cast-function-type-mismatch" \
-D CMAKE_CXX_FLAGS="${{ inputs.compiler == 'clang' && '-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-deprecated-declarations -Wno-error=cast-function-type-mismatch' || '-Werror -Wzero-as-null-pointer-constant -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow -Wno-deprecated-declarations -Wno-error=cast-function-type-mismatch' }}" \

Copilot uses AI. Check for mistakes.
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
Comment on lines 152 to 156
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says -Werror is enabled via a shared CMake flag module and removed from the macOS CI workflow, but this action still injects -Werror directly through CMAKE_CXX_FLAGS (and does so differently for macOS vs Linux). If the intent is to centralize this in CMake, consider removing these injected flags from the action and relying on the shared CMake flag module instead (or update the PR description to match the implementation).

Copilot uses AI. Check for mistakes.
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D BUILD_INCLUDE_SYMLINK=ON \
Expand All @@ -167,7 +168,6 @@ runs:
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-error=cast-function-type-mismatch" \
${{ inputs.additional-cmake-flags }} ..
echo "Configuration completed successfully for macOS"
shell: bash
Expand All @@ -183,6 +183,7 @@ runs:
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow" \
Comment on lines 183 to +186
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as macOS: the Linux CMAKE_CXX_FLAGS includes -Wno-unknown-warning-option and Clang/GCC-specific -Wno-error=... suppressions in one string. If this action is ever run with GCC, the Clang-only flag will fail; if run with Clang, the GCC-only -Wno-error=array-bounds/etc. relies on -Wno-unknown-warning-option to silence unknown-warning diagnostics. Consider splitting the flag sets by compiler to avoid relying on cross-compiler suppression flags.

Suggested change
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow" \
CMAKE_CXX_FLAGS="-Werror -Wzero-as-null-pointer-constant"
if [ "${{ inputs.compiler }}" = "clang" ]; then
CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Wno-unknown-warning-option"
else
CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Wno-error=array-bounds -Wno-error=maybe-uninitialized -Wno-error=stringop-overflow"
fi
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D CMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \

Copilot uses AI. Check for mistakes.
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationFramework/TKTObj/TObj/TObj_Persistence.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private:
name::Persistence_ name::myPersistence_; \
occ::handle<TObj_Object> name::Persistence_::New(const TDF_Label& aLabel) const \
{ \
return new name((const TObj_Persistence*)0, aLabel); \
return new name(static_cast<const TObj_Persistence*>(nullptr), aLabel); \
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion src/DataExchange/TKDEIGES/IGESData/IGESData_IGESWriter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void IGESData_IGESWriter::DirPart(const occ::handle<IGESData_IGESEntity>& anent)
if (anent->HasShortLabel())
{
occ::handle<TCollection_HAsciiString> slab = anent->ShortLabel();
for (i = 0; i < slab->Length(); i++)
for (i = 0; i < slab->Length() && i < 8; i++)
label[i] = slab->Value(i + 1);
}
if (anent->HasSubScriptNumber())
Expand Down
2 changes: 1 addition & 1 deletion src/DataExchange/TKDESTEP/StepData/StepData_EnumTool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ StepData_EnumTool::StepData_EnumTool(const char* const e0,

void StepData_EnumTool::AddDefinition(const char* const term)
{
char text[80];
char text[80] = {0};
if (!term)
return;
if (term[0] == '\0')
Expand Down
3 changes: 2 additions & 1 deletion src/DataExchange/TKDEVRML/VrmlData/VrmlData_Node.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include <Standard_CStringHasher.hxx>
#include <VrmlData_ErrorStatus.hxx>

#define VRMLDATA_LCOMPARE(aa, bb) ((strncmp(aa, bb, sizeof(bb) - 1)) ? 0L : (aa += sizeof(bb) - 1))
#define VRMLDATA_LCOMPARE(aa, bb) \
((strncmp(aa, bb, sizeof(bb) - 1)) ? nullptr : (aa += sizeof(bb) - 1))

struct VrmlData_InBuffer;
class VrmlData_Scene;
Expand Down
3 changes: 2 additions & 1 deletion src/FoundationClasses/TKMath/MathRoot/MathRoot_Trig.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ inline TrigResult Trigonometric(double theA,
return aResult;
}

aNZer = aPoly.NbRoots;
// NbRoots is bounded by the fixed storage capacity; clamp defensively.
aNZer = std::min<size_t>(aPoly.NbRoots, aZer.size());
for (size_t i = 0; i < aNZer; ++i)
{
aZer[i] = aPoly.Roots[i];
Expand Down
4 changes: 3 additions & 1 deletion src/FoundationClasses/TKMath/Poly/Poly_MergeNodesTool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ void Poly_MergeNodesTool::PushLastElement(int theNbNodes)
if (myToMergeElems)
{
NCollection_Vec4<int> aSorted = myNodeInds;
std::sort(aSorted.ChangeData(), aSorted.ChangeData() + theNbNodes);
// theNbNodes is bounded by the Vec4 capacity; clamp defensively.
const int aNbToSort = std::min(theNbNodes, 4);
std::sort(aSorted.ChangeData(), aSorted.ChangeData() + aNbToSort);
if (!myElemMap.Add(aSorted))
{
++myNbMergedElems;
Expand Down
6 changes: 3 additions & 3 deletions src/FoundationClasses/TKernel/FlexLexer/FlexLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern "C++"
return yylex();
}

int yylex(std::istream* new_in, std::ostream* new_out = 0)
int yylex(std::istream* new_in, std::ostream* new_out = nullptr)
{
switch_streams(new_in, new_out);
return yylex();
Expand Down Expand Up @@ -122,7 +122,7 @@ extern "C++"
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
yyFlexLexer(std::istream& arg_yyin, std::ostream& arg_yyout);
yyFlexLexer(std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0);
yyFlexLexer(std::istream* arg_yyin = nullptr, std::ostream* arg_yyout = nullptr);

private:
void ctor_common();
Expand All @@ -142,7 +142,7 @@ extern "C++"

virtual int yylex();
virtual void switch_streams(std::istream& new_in, std::ostream& new_out);
virtual void switch_streams(std::istream* new_in = 0, std::ostream* new_out = 0);
virtual void switch_streams(std::istream* new_in = nullptr, std::ostream* new_out = nullptr);
virtual int yywrap();

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void Message_PrinterOStream::SetConsoleTextColor(Standard_OStream* theOStream
return;
}

const char* aCode;
const char* aCode = "";
switch (theTextColor)
{
case Message_ConsoleColor_Default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,17 @@ public:
{
if (theOther.isInline())
{
// When the source is inline, mySize is bounded by MAX_ARRAY_SIZE.
const size_t aNb = std::min(mySize, static_cast<size_t>(MAX_ARRAY_SIZE));
if constexpr (IS_TRIVIAL)
{
std::memcpy(inlinePtr(), theOther.inlinePtr(), mySize * sizeof(theItem));
std::memcpy(inlinePtr(), theOther.inlinePtr(), aNb * sizeof(theItem));
}
else
{
for (size_t i = 0; i < mySize; ++i)
for (size_t i = 0; i < aNb; ++i)
new (inlinePtr() + i) theItem(std::move(theOther.inlinePtr()[i]));
for (size_t i = 0; i < mySize; ++i)
for (size_t i = 0; i < aNb; ++i)
theOther.inlinePtr()[i].~theItem();
}
}
Expand All @@ -212,7 +214,9 @@ public:
{
Deallocate();
myPtr = inlinePtr();
std::memcpy(inlinePtr(), theOther.inlinePtr(), mySize * sizeof(theItem));
// When the source is inline, mySize is bounded by MAX_ARRAY_SIZE.
const size_t aNb = std::min(mySize, static_cast<size_t>(MAX_ARRAY_SIZE));
std::memcpy(inlinePtr(), theOther.inlinePtr(), aNb * sizeof(theItem));
}
else if (!isInline())
{
Expand Down Expand Up @@ -240,9 +244,11 @@ public:
Standard::Free(myPtr);
myPtr = inlinePtr();
mySize = theOther.mySize;
for (size_t i = 0; i < mySize; ++i)
// When the source is inline, mySize is bounded by MAX_ARRAY_SIZE.
const size_t aNb = std::min(mySize, static_cast<size_t>(MAX_ARRAY_SIZE));
for (size_t i = 0; i < aNb; ++i)
new (inlinePtr() + i) theItem(std::move(theOther.inlinePtr()[i]));
for (size_t i = 0; i < mySize; ++i)
for (size_t i = 0; i < aNb; ++i)
theOther.inlinePtr()[i].~theItem();
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ApproxInt_MultiLine::ApproxInt_MultiLine(const Handle_TheLine& line,
const bool P2DOnFirst,
const int IndMin,
const int IndMax)
: PtrOnmySvSurfaces(0),
: PtrOnmySvSurfaces(nullptr),
myLine(line),
indicemin(std::min(IndMin, IndMax)),
indicemax(std::max(IndMin, IndMax)),
Expand Down
4 changes: 2 additions & 2 deletions src/ModelingAlgorithms/TKMesh/BRepMesh/delabella.pxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ struct IDelaBella
// it is treated as 2*sizeof coordinate type
virtual int Triangulate(int points,
const float* x,
const float* y = 0,
const float* y = nullptr,
int advance_bytes = 0) = 0;
virtual int Triangulate(int points,
const double* x,
const double* y = 0,
const double* y = nullptr,
int advance_bytes = 0) = 0;

// num of points passed to last call to Triangulate()
Expand Down
4 changes: 2 additions & 2 deletions src/Visualization/TKOpenGl/OpenGl/OpenGl_Context.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public:
bool Init(EAGLContext* theGContext, const bool theIsCoreProfile = false)
{
return Init((Aspect_Drawable)0,
(Aspect_Display)0,
(Aspect_Display) nullptr,
(Aspect_RenderingContext)theGContext,
theIsCoreProfile);
}
Expand All @@ -288,7 +288,7 @@ public:
bool Init(NSOpenGLContext* theGContext, const bool theIsCoreProfile = false)
{
return Init((Aspect_Drawable)0,
(Aspect_Display)0,
(Aspect_Display) nullptr,
(Aspect_RenderingContext)theGContext,
theIsCoreProfile);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Visualization/TKOpenGl/OpenGl/OpenGl_Window_1.mm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ - (NSSize )convertSizeToBacking: (NSSize )theSize;
const occ::handle<OpenGl_Context>& theShareCtx)
{
myGlContext = new OpenGl_Context (theCaps);
myOwnGContext = (theGContext == 0);
myOwnGContext = (theGContext == nullptr);
myPlatformWindow = thePlatformWindow;
mySizeWindow = theSizeWindow;
#if defined(__APPLE__) && defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
Expand Down
25 changes: 13 additions & 12 deletions src/Visualization/TKService/Xw/Xw_Window.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,19 @@ Xw_Window::Xw_Window(const occ::handle<Aspect_DisplayConnection>& theXDisplay,
aWinAttr.border_pixel = 0;
aWinAttr.override_redirect = False;

myXWindow = (Window)XCreateWindow(aDisp,
aParent,
myXLeft,
myYTop,
thePxWidth,
thePxHeight,
0,
aVisInfo != nullptr ? aVisInfo->depth : CopyFromParent,
InputOutput,
aVisInfo != nullptr ? aVisInfo->visual : CopyFromParent,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
&aWinAttr);
myXWindow =
(Window)XCreateWindow(aDisp,
aParent,
myXLeft,
myYTop,
thePxWidth,
thePxHeight,
0,
aVisInfo != nullptr ? aVisInfo->depth : CopyFromParent,
InputOutput,
aVisInfo != nullptr ? aVisInfo->visual : static_cast<Visual*>(nullptr),
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
&aWinAttr);
if (myXWindow == 0)
{
throw Aspect_WindowDefinitionError("Xw_Window, Unable to create window");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ bool SelectMgr_BaseIntersector::RayCylinderIntersection(const double theBottomR
return false;
}

std::sort(anIntersections, anIntersections + aNbIntersections);
// aNbIntersections is bounded by the fixed 4-element buffer; clamp defensively.
const int aNbToSort = std::min(aNbIntersections, 4);
std::sort(anIntersections, anIntersections + aNbToSort);
theTimeEnter = anIntersections[0];
if (aNbIntersections > 1)
{
Expand Down
Loading