From 297fee00f10c05d7a0340f7145d3afd21f52407f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 24 Jan 2025 10:44:57 +0000 Subject: [PATCH] COMP: adjustments for nvc++ compiler - remove unneeded -Wno-old-style flags with boost/cgal elements - add nvc equivalent to gcc/clang -Wno-invalid-offsetof - avoid warnings about set-but-unused variable and change of scoping STYLE: remove wmake 'CGAL' rule - was a transitional forward to 'cgal' rule since DEC-2020 --- .../foamyMesh/foamyHexMeshSurfaceSimplify/Make/options | 1 - .../utilities/preProcessing/viewFactorsGen/Make/options | 2 -- .../surfaceBooleanFeatures/PolyhedronReader/Make/options | 3 --- src/OSspecific/POSIX/printStack/printStack.C | 9 ++++----- .../displacementSmartPointSmoothingMotionSolver.C | 4 ++-- wmake/rules/General/CGAL | 1 - wmake/rules/General/Nvidia/c++ | 3 ++- 7 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 wmake/rules/General/CGAL diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options index 23df4fe774..ae6726cd0c 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options @@ -4,7 +4,6 @@ include $(GENERAL_RULES)/cgal EXE_INC = \ -DUNIX \ - -Wno-old-style-cast \ /* -IMarchingCubes */ \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ diff --git a/applications/utilities/preProcessing/viewFactorsGen/Make/options b/applications/utilities/preProcessing/viewFactorsGen/Make/options index cc5cbf8c6b..803c6f22ef 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/Make/options +++ b/applications/utilities/preProcessing/viewFactorsGen/Make/options @@ -1,7 +1,6 @@ include $(GENERAL_RULES)/cgal-header-only EXE_INC = \ - -Wno-old-style-cast \ $(COMP_FLAGS) \ ${CGAL_INC} \ -I$(LIB_SRC)/finiteVolume/lnInclude \ @@ -9,7 +8,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/distributed/lnInclude - EXE_LIBS = \ -lfiniteVolume \ -lsurfMesh \ diff --git a/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options b/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options index 3f7a39676c..36f8439a38 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options +++ b/applications/utilities/surface/surfaceBooleanFeatures/PolyhedronReader/Make/options @@ -1,8 +1,6 @@ EXE_NDEBUG = -DNDEBUG /* EXE_NDEBUG = -g -O0 -DFULLDEBUG */ -c++CGALWARN = -Wno-old-style-cast - /*-- Define CGAL_INEXACT to use inexact CGAL constructions */ include $(GENERAL_RULES)/cgal @@ -11,7 +9,6 @@ EXE_INC = \ ${ROUNDING_MATH} \ ${EXE_NDEBUG} \ ${CGAL_INC} \ - ${c++LESSWARN} \ -I.. \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/src/OSspecific/POSIX/printStack/printStack.C b/src/OSspecific/POSIX/printStack/printStack.C index a492937696..c81fdd4533 100644 --- a/src/OSspecific/POSIX/printStack/printStack.C +++ b/src/OSspecific/POSIX/printStack/printStack.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -64,12 +64,11 @@ std::string pipeOpen(const std::string& cmd, const int lineNum = 0) if (cnt == lineNum) { // Retain the last line, trimming trailing newline - str.assign(buf); - - if (str.size()) + if (nread > 0) { - str.resize(str.size()-1); + buf[nread-1] = '\0'; } + str.assign(buf); } } diff --git a/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementSmartPointSmoothingMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementSmartPointSmoothingMotionSolver.C index 88aa458a69..5ca6b84ff3 100644 --- a/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementSmartPointSmoothingMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementSmartPointSmoothingMotionSolver.C @@ -521,7 +521,7 @@ void Foam::displacementSmartPointSmoothingMotionSolver::solve() markAffectedFaces(facesToMove_, affectedFaces); - for(label i = 0; i < nPointSmootherIter_; i ++) + for (label nIter = 0; nIter < nPointSmootherIter_; ++nIter) { const pointField wantedPoints ( @@ -665,7 +665,7 @@ void Foam::displacementSmartPointSmoothingMotionSolver::solve() if (debug & 2) { - OBJstream os(debugDir/"untangle_" + Foam::name(i) + ".obj"); + OBJstream os(debugDir/"untangle_" + Foam::name(nIter) + ".obj"); const pointField wantedPoints ( diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL deleted file mode 100644 index 98b266f76f..0000000000 --- a/wmake/rules/General/CGAL +++ /dev/null @@ -1 +0,0 @@ -include $(GENERAL_RULES)/cgal diff --git a/wmake/rules/General/Nvidia/c++ b/wmake/rules/General/Nvidia/c++ index c7b0d2f9ff..d7e9f6b87b 100644 --- a/wmake/rules/General/Nvidia/c++ +++ b/wmake/rules/General/Nvidia/c++ @@ -12,7 +12,7 @@ ptFLAGS := -DNoRepository c++WARN = \ -Wall -Wextra \ - --diag_suppress=111,128,177,185,612,998,1098 \ + --diag_suppress=111,128,177,185,612,998,1098,1428 \ --display_error_number # Less restrictive warnings (eg, for flex++, CGAL, etc.) @@ -34,5 +34,6 @@ sinclude $(GENERAL_RULES)/common/c++$(WM_COMPILE_OPTION) #612-D: overloaded virtual function ... is only partially overridden #998-D: function XX is hidden by YY -- virtual function override intended? #1098-D: unknown attribute "fallthrough" +#1428-D: [offset_in_non_POD_nonstandard] # #------------------------------------------------------------------------------