mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 01:20:50 +08:00
Coding - Fix CI compilation warnings (#1253)
Refactor NULL to nullptr in OpenGL-related files Fix some MacOS, Ubuntu warnings and disable too strict warning checks
This commit is contained in:
9
.github/actions/configure-occt/action.yml
vendored
9
.github/actions/configure-occt/action.yml
vendored
@@ -70,9 +70,9 @@ runs:
|
||||
brew update || true
|
||||
# temporary workaround for missing tcl-tk
|
||||
brew install tcl-tk || true
|
||||
# Force link any conflicting packages
|
||||
brew link --overwrite python@3.12 || true
|
||||
brew link --overwrite python@3.13 || true
|
||||
# Force link any conflicting packages (only if the keg is installed)
|
||||
brew list python@3.12 >/dev/null 2>&1 && brew link --overwrite python@3.12 || true
|
||||
brew list python@3.13 >/dev/null 2>&1 && brew link --overwrite python@3.13 || true
|
||||
shell: bash
|
||||
|
||||
- name: Configure OCCT (Windows)
|
||||
@@ -152,7 +152,6 @@ 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" \
|
||||
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
||||
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
||||
-D BUILD_INCLUDE_SYMLINK=ON \
|
||||
@@ -168,6 +167,7 @@ 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
|
||||
@@ -183,7 +183,6 @@ 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" \
|
||||
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
|
||||
-D BUILD_INCLUDE_SYMLINK=ON \
|
||||
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#define FUNC (*((TheISurface*)(func)))
|
||||
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc()
|
||||
: surf(NULL),
|
||||
func(NULL),
|
||||
: surf(nullptr),
|
||||
func(nullptr),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
@@ -55,7 +55,7 @@ IntImp_ZerImpFunc::IntImp_ZerImpFunc(const ThePSurface& PS, const TheISurface& I
|
||||
}
|
||||
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS)
|
||||
: surf(NULL),
|
||||
: surf(nullptr),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
|
||||
@@ -1005,7 +1005,7 @@ void PointProcess(const gp_Pnt& Pt,
|
||||
bool IsRegularity(const TheArc& /*A*/, const occ::handle<TheTopolTool>& aDomain)
|
||||
{
|
||||
void* anEAddress = aDomain->Edge();
|
||||
if (anEAddress == NULL)
|
||||
if (anEAddress == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1026,7 +1026,7 @@ int TreatLC(const TheArc& A,
|
||||
int anExitCode = 1, aNbExt;
|
||||
|
||||
void* anEAddress = aDomain->Edge();
|
||||
if (anEAddress == NULL)
|
||||
if (anEAddress == nullptr)
|
||||
{
|
||||
return anExitCode;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ static void APIENTRY glGetTexLevelParameterfv(GLenum target,
|
||||
static void APIENTRY glGetPointerv(GLenum name, GLvoid** params)
|
||||
{
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
*params = NULL;
|
||||
*params = nullptr;
|
||||
::glEnable(0xFFFF); // added to OpenGL ES 3.2
|
||||
(void)name;
|
||||
#else
|
||||
@@ -1913,7 +1913,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
||||
}
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
theCtx.core11ffp = NULL;
|
||||
theCtx.core11ffp = nullptr;
|
||||
#else
|
||||
theCtx.core11ffp = !isCoreProfile ? (OpenGl_GlCore11*)this : nullptr;
|
||||
#endif
|
||||
@@ -2065,7 +2065,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
||||
#ifndef __EMSCRIPTEN__
|
||||
&& hasMapBufferRange
|
||||
#endif
|
||||
&& hasInstanced && theCtx.arbSamplerObject != NULL && theCtx.arbFBOBlit != NULL
|
||||
&& hasInstanced && theCtx.arbSamplerObject != nullptr && theCtx.arbFBOBlit != nullptr
|
||||
&& FindProcShort(glReadBuffer) && FindProcShort(glDrawRangeElements)
|
||||
&& FindProcShort(glTexImage3D) && FindProcShort(glTexSubImage3D)
|
||||
&& FindProcShort(glCopyTexSubImage3D) && FindProcShort(glCompressedTexImage3D)
|
||||
@@ -2161,7 +2161,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
||||
if (isGlGreaterEqualShort(3, 2) || checkExtensionShort("GL_KHR_debug"))
|
||||
{
|
||||
// this functionality become a part of OpenGL ES 3.2
|
||||
theCtx.arbDbg = NULL;
|
||||
theCtx.arbDbg = nullptr;
|
||||
if (isGlGreaterEqualShort(3, 2) && FindProcShort(glDebugMessageControl)
|
||||
&& FindProcShort(glDebugMessageInsert) && FindProcShort(glDebugMessageCallback)
|
||||
&& FindProcShort(glGetDebugMessageLog))
|
||||
@@ -2182,7 +2182,7 @@ void OpenGl_GlFunctions::load(OpenGl_Context& theCtx, bool theIsCoreProfile)
|
||||
|
||||
// load OpenGL ES 3.2 new functions
|
||||
const bool has32es =
|
||||
isGlGreaterEqualShort(3, 2) && has31es && hasTexBuffer32 && theCtx.arbDbg != NULL
|
||||
isGlGreaterEqualShort(3, 2) && has31es && hasTexBuffer32 && theCtx.arbDbg != nullptr
|
||||
&& FindProcShort(glBlendBarrier) && FindProcShort(glCopyImageSubData)
|
||||
&& FindProcShort(glPushDebugGroup) && FindProcShort(glPopDebugGroup)
|
||||
&& FindProcShort(glObjectLabel) && FindProcShort(glGetObjectLabel)
|
||||
|
||||
@@ -80,7 +80,7 @@ static const occ::handle<OpenGl_Context> TheNullGlCtx;
|
||||
//! Wrapper over eglChooseConfig() called with preferred defaults.
|
||||
static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<OpenGl_Caps>& theCaps)
|
||||
{
|
||||
EGLConfig aCfg = NULL;
|
||||
EGLConfig aCfg = nullptr;
|
||||
EGLint aNbConfigs = 0;
|
||||
for (int aGlesVer = 3; aGlesVer >= 2; --aGlesVer)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
||||
#endif
|
||||
|
||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||
&& aCfg != NULL)
|
||||
&& aCfg != nullptr)
|
||||
{
|
||||
return aCfg;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
||||
aConfigAttribs[1 * 2 + 1] = 8;
|
||||
aConfigAttribs[2 * 2 + 1] = 8;
|
||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||
&& aCfg != NULL)
|
||||
&& aCfg != nullptr)
|
||||
{
|
||||
return aCfg;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ static EGLConfig chooseEglSurfConfig(EGLDisplay theDisplay, const occ::handle<Op
|
||||
// try config with smaller depth buffer
|
||||
aConfigAttribs[4 * 2 + 1] = 16;
|
||||
if (eglChooseConfig(theDisplay, aConfigAttribs, &aCfg, 1, &aNbConfigs) == EGL_TRUE
|
||||
&& aCfg != NULL)
|
||||
&& aCfg != nullptr)
|
||||
{
|
||||
return aCfg;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
||||
|
||||
myEglDisplay = (Aspect_Display)EGL_NO_DISPLAY;
|
||||
myEglContext = (Aspect_RenderingContext)EGL_NO_CONTEXT;
|
||||
myEglConfig = NULL;
|
||||
myEglConfig = nullptr;
|
||||
#endif
|
||||
myIsOwnContext = false;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ bool OpenGl_GraphicDriver::InitContext()
|
||||
}
|
||||
|
||||
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
||||
if (myEglConfig == NULL)
|
||||
if (myEglConfig == nullptr)
|
||||
{
|
||||
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
||||
return false;
|
||||
@@ -367,7 +367,7 @@ bool OpenGl_GraphicDriver::InitContext()
|
||||
eglCreateContext((EGLDisplay)myEglDisplay, myEglConfig, EGL_NO_CONTEXT, anEglCtxAttribs2);
|
||||
}
|
||||
#else
|
||||
EGLint* anEglCtxAttribs = NULL;
|
||||
EGLint* anEglCtxAttribs = nullptr;
|
||||
if (eglBindAPI(EGL_OPENGL_API) != EGL_TRUE)
|
||||
{
|
||||
::Message::SendFail("Error: EGL does not provide OpenGL client");
|
||||
@@ -417,10 +417,10 @@ bool OpenGl_GraphicDriver::InitEglContext(Aspect_Display theEglDisplay,
|
||||
myEglDisplay = theEglDisplay;
|
||||
myEglContext = theEglContext;
|
||||
myEglConfig = theEglConfig;
|
||||
if (theEglConfig == NULL)
|
||||
if (theEglConfig == nullptr)
|
||||
{
|
||||
myEglConfig = chooseEglSurfConfig((EGLDisplay)myEglDisplay, myCaps);
|
||||
if (myEglConfig == NULL)
|
||||
if (myEglConfig == nullptr)
|
||||
{
|
||||
::Message::SendFail("Error: EGL does not provide compatible configurations");
|
||||
return false;
|
||||
@@ -454,7 +454,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo()
|
||||
XVisualInfo aVisInfoTmp;
|
||||
memset(&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
|
||||
aVisInfoTmp.screen = DefaultScreen(aDisp);
|
||||
if (myEglDisplay != EGL_NO_DISPLAY && myEglConfig != NULL
|
||||
if (myEglDisplay != EGL_NO_DISPLAY && myEglConfig != nullptr
|
||||
&& eglGetConfigAttrib((EGLDisplay)myEglDisplay,
|
||||
myEglConfig,
|
||||
EGL_NATIVE_VISUAL_ID,
|
||||
|
||||
@@ -194,7 +194,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
EGLContext anEglContext = (EGLContext)theDriver->getRawGlContext();
|
||||
EGLConfig anEglConfig = (EGLConfig)theDriver->getRawGlConfig();
|
||||
if (anEglDisplay == EGL_NO_DISPLAY || anEglContext == EGL_NO_CONTEXT
|
||||
|| (anEglConfig == NULL && (EGLContext)theGContext == EGL_NO_CONTEXT))
|
||||
|| (anEglConfig == nullptr && (EGLContext)theGContext == EGL_NO_CONTEXT))
|
||||
{
|
||||
throw Aspect_GraphicDeviceDefinitionError(
|
||||
"OpenGl_Window, EGL does not provide compatible configurations!");
|
||||
@@ -215,7 +215,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
anEglSurf = eglCreateWindowSurface(anEglDisplay,
|
||||
anEglConfig,
|
||||
(EGLNativeWindowType)myPlatformWindow->NativeHandle(),
|
||||
NULL);
|
||||
nullptr);
|
||||
if (anEglSurf == EGL_NO_SURFACE && myPlatformWindow->NativeHandle() != 0)
|
||||
{
|
||||
throw Aspect_GraphicDeviceDefinitionError(
|
||||
@@ -226,7 +226,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
// window-less EGL context (off-screen)
|
||||
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
||||
// surface!");
|
||||
if (anEglConfig != NULL)
|
||||
if (anEglConfig != nullptr)
|
||||
{
|
||||
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
||||
const int aSurfAttribs[] = {EGL_WIDTH,
|
||||
@@ -267,7 +267,7 @@ void OpenGl_Window::Init(const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
// window-less EGL context (off-screen)
|
||||
// throw Aspect_GraphicDeviceDefinitionError("OpenGl_Window, EGL is unable to retrieve current
|
||||
// surface!");
|
||||
if (anEglConfig != NULL)
|
||||
if (anEglConfig != nullptr)
|
||||
{
|
||||
#if !defined(__EMSCRIPTEN__) // eglCreatePbufferSurface() is not implemented by Emscripten EGL
|
||||
const int aSurfAttribs[] = {EGL_WIDTH,
|
||||
|
||||
@@ -136,10 +136,10 @@ void OpenGl_Window::Init (const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
Cocoa_LocalPool aLocalPool;
|
||||
|
||||
// all GL context within one OpenGl_GraphicDriver should be shared!
|
||||
NSOpenGLContext* aGLCtxShare = theShareCtx.IsNull() ? NULL : theShareCtx->myGContext;
|
||||
NSOpenGLContext* aGLCtxShare = theShareCtx.IsNull() ? nullptr : theShareCtx->myGContext;
|
||||
NSOpenGLContext* aGLContext = theGContext;
|
||||
bool isCore = false;
|
||||
if (aGLContext == NULL)
|
||||
if (aGLContext == nullptr)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute anAttribs[32] = {};
|
||||
int aLastAttrib = 0;
|
||||
@@ -195,19 +195,19 @@ void OpenGl_Window::Init (const occ::handle<OpenGl_GraphicDriver>& theDriver,
|
||||
NSOpenGLPixelFormat* aGLFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes: anAttribs] autorelease];
|
||||
aGLContext = [[NSOpenGLContext alloc] initWithFormat: aGLFormat
|
||||
shareContext: aGLCtxShare];
|
||||
if (aGLContext != NULL)
|
||||
if (aGLContext != nullptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (aGLContext != NULL)
|
||||
if (aGLContext != nullptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (aGLContext == NULL)
|
||||
if (aGLContext == nullptr)
|
||||
{
|
||||
TCollection_AsciiString aMsg ("OpenGl_Window::CreateWindow: NSOpenGLContext creation failed");
|
||||
throw Aspect_GraphicDeviceDefinitionError(aMsg.ToCString());
|
||||
@@ -402,7 +402,7 @@ void OpenGl_Window::init()
|
||||
const int aViewport[4] = { 0, 0, mySize.x(), mySize.y() };
|
||||
myGlContext->ResizeViewport (aViewport);
|
||||
myGlContext->SetDrawBuffer (GL_BACK);
|
||||
if (myGlContext->core11ffp != NULL)
|
||||
if (myGlContext->core11ffp != nullptr)
|
||||
{
|
||||
myGlContext->core11ffp->glMatrixMode (GL_MODELVIEW);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
virtual Aspect_Drawable NativeParentHandle() const override { return 0; }
|
||||
|
||||
//! Returns nothing on OS X
|
||||
virtual Aspect_FBConfig NativeFBConfig() const override { return NULL; }
|
||||
virtual Aspect_FBConfig NativeFBConfig() const override { return nullptr; }
|
||||
|
||||
//! Sets window title.
|
||||
Standard_EXPORT virtual void SetTitle(const TCollection_AsciiString& theTitle) override;
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
//! Invalidate entire window content by setting NSView::setNeedsDisplay property.
|
||||
//! Call will be implicitly redirected to the main thread when called from non-GUI thread.
|
||||
Standard_EXPORT virtual void InvalidateContent(
|
||||
const occ::handle<Aspect_DisplayConnection>& theDisp = NULL) override;
|
||||
const occ::handle<Aspect_DisplayConnection>& theDisp = nullptr) override;
|
||||
|
||||
protected:
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
|
||||
Reference in New Issue
Block a user