From ff6472c6b73838d2acae82bd24b1f209807f4672 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 5 Jan 2024 15:13:50 +0100 Subject: [PATCH] Update to clang-16 Use runner Ubuntu 22.04 for clang-16 Remove unused code detected by clang-16 --- .github/workflows/ResInsightWithCache.yml | 38 +++++++++++++------ .../WellPathTools/RiaSCurveCalculator.cpp | 9 +---- .../FileInterface/RifSurfaceImporter.cpp | 5 --- .../Annotations/RimAnnotationCollection.cpp | 3 -- .../WellLog/RimWellLogTrack.cpp | 2 - .../UserInterface/RiuMainWindow.cpp | 1 - ThirdParty/custom-opm-common/opm-common | 2 +- ThirdParty/openzgy | 2 +- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 4d2be6dd14..8503c78576 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -33,11 +33,12 @@ jobs: vcpkg-triplet: x64-windows, build-python-module: true, execute-unit-tests: true, + execute-pytests: true, unity-build: true, publish-to-pypi: false, } - { - name: "Ubuntu Latest gcc", + name: "Ubuntu 20.04 gcc", os: ubuntu-20.04, cc: "gcc", cxx: "g++", @@ -45,18 +46,20 @@ jobs: vcpkg-triplet: x64-linux, build-python-module: true, execute-unit-tests: true, + execute-pytests: true, unity-build: false, publish-to-pypi: true, } - { - name: "Ubuntu Latest clang", - os: ubuntu-20.04, - cc: "clang", - cxx: "clang++", + name: "Ubuntu 22.04 clang-16", + os: ubuntu-22.04, + cc: "clang-16", + cxx: "clang++-16", vcpkg-response-file: vcpkg_x64-linux.txt, vcpkg-triplet: x64-linux, build-python-module: true, execute-unit-tests: true, + execute-pytests: false, unity-build: false, publish-to-pypi: false, } @@ -139,7 +142,7 @@ jobs: - name: Set apt mirror # see https://github.com/actions/runner-images/issues/7048 - if: ${{contains( matrix.config.os, 'ubuntu') }} + if: contains( matrix.config.os, 'ubuntu') run: | # make sure there is a `\t` between URL and `priority:*` attributes printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt @@ -147,11 +150,24 @@ jobs: sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list - name: Install Linux dependencies - if: ${{contains( matrix.config.os, 'ubuntu') }} + if: contains( matrix.config.os, 'ubuntu') run: | sudo apt-get update --option="APT::Acquire::Retries=3" sudo apt-get install --option="APT::Acquire::Retries=3" libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev + + - name: Install gcc-10 + if: contains( matrix.config.cc, 'gcc') + run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 + + - name: Install clang-16 + if: contains( matrix.config.cc, 'clang') + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + sudo apt-get upgrade + wget https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh 16 all - name: Install Qt uses: jurplel/install-qt-action@v3 @@ -170,14 +186,14 @@ jobs: appendedCacheKey: ${{ matrix.config.os }}-${{ matrix.config.cxx }}-cache-key-v2 - name: Cache dynamic version of OpenSSL (Linux) - if: ${{contains( matrix.config.os, 'ubuntu_disabled') }} + if: contains( matrix.config.os, 'ubuntu_disabled') uses: actions/cache@v3 with: path: ${{ github.workspace }}/ThirdParty/vcpkg/installed/x64-linux-dynamic key: ${{ matrix.config.os }}-vcpkg-x64-linux-dynamic_v05 - name: Install dynamic version of OpenSSL (Linux) - if: ${{contains( matrix.config.os, 'ubuntu') }} + if: contains( matrix.config.os, 'ubuntu') run: | $VCPKG_ROOT/vcpkg install --overlay-triplets=${{ github.workspace }}/ThirdParty/vcpkg-custom-triplets --triplet x64-linux-dynamic openssl @@ -239,7 +255,7 @@ jobs: ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m mypy *.py generated/generated_classes.py - name: Run pytest - if: matrix.config.build-python-module + if: matrix.config.execute-pytests env: RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationExeCode/ResInsight run: | @@ -256,7 +272,7 @@ jobs: path: GrpcInterface/Python/dist - name: Upload Windows install artifact - if: ${{contains( matrix.config.os, 'windows') }} + if: contains( matrix.config.os, 'windows') uses: actions/upload-artifact@v3 with: name: ResInsight-${{ matrix.config.name }} diff --git a/ApplicationLibCode/Application/Tools/WellPathTools/RiaSCurveCalculator.cpp b/ApplicationLibCode/Application/Tools/WellPathTools/RiaSCurveCalculator.cpp index 19084db449..f0015fcdfd 100644 --- a/ApplicationLibCode/Application/Tools/WellPathTools/RiaSCurveCalculator.cpp +++ b/ApplicationLibCode/Application/Tools/WellPathTools/RiaSCurveCalculator.cpp @@ -272,8 +272,7 @@ void RiaSCurveCalculator::initializeByFinding_q1q2( cvf::Vec3d p1, double azi1, SolveStatus solveResultStatus = NOT_SOLVED; - int backstepLevel = 0; - int iteration = 1; + int iteration = 1; for ( iteration = 1; iteration < maxIterations; ++iteration ) { if ( fabs( q1Step ) > maxStepSize || fabs( q2Step ) > maxStepSize ) @@ -349,18 +348,12 @@ void RiaSCurveCalculator::initializeByFinding_q1q2( cvf::Vec3d p1, double azi1, // if (isZeroCrossingR2) q2Step = 0.9 * q2Step * fabs( R2_error ) / ( fabs( R2_error_new ) + fabs( R2_error ) ); - ++backstepLevel; - #ifdef DEBUG_OUTPUT_ON std::cout << " Backstep needed. " << std::endl; #endif continue; } - else - { - backstepLevel = 0; - } } #ifdef DEBUG_OUTPUT_ON diff --git a/ApplicationLibCode/FileInterface/RifSurfaceImporter.cpp b/ApplicationLibCode/FileInterface/RifSurfaceImporter.cpp index 6cea5ba1a3..5ad12dd943 100644 --- a/ApplicationLibCode/FileInterface/RifSurfaceImporter.cpp +++ b/ApplicationLibCode/FileInterface/RifSurfaceImporter.cpp @@ -478,7 +478,6 @@ std::pair, std::vector> RifSurfaceImporter::re cvf::Vec2d primaryAxisVector = pairs[0].first * axesVectorCandidates[pairs[0].first]; - size_t row = 0; size_t column = 0; std::vector> indexToPointData; std::vector startOffsets; @@ -512,7 +511,6 @@ std::pair, std::vector> RifSurfaceImporter::re { indexToPointData.push_back( std::vector() ); } - row = 0; int offset = distanceOnLine( lineStartPoint, lineEndPoint, to2d( surfacePoints[index] ) ); if ( offset < 0 ) { @@ -524,7 +522,6 @@ std::pair, std::vector> RifSurfaceImporter::re for ( int i = 0; i < offset; i++ ) { indexToPointData[column].push_back( -1 ); - row++; } startOffsets.push_back( 0 ); } @@ -537,7 +534,6 @@ std::pair, std::vector> RifSurfaceImporter::re for ( size_t i = 1; i < rowDiff; i++ ) { indexToPointData[column].push_back( -1 ); - row++; } } int offset = distanceOnLine( lineStartPoint, lineEndPoint, to2d( surfacePoints[index] ) ); @@ -555,7 +551,6 @@ std::pair, std::vector> RifSurfaceImporter::re indexToPointData.push_back( std::vector() ); } indexToPointData[column].push_back( static_cast( index ) ); - row++; } for ( size_t i = 0; i < startOffsets.size(); i++ ) diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp index e02d4e9075..e676736ac3 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp @@ -164,7 +164,6 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines } } - size_t newLinesIdx = 0; for ( const QString& newFileName : newFileNames ) { RimPolylinesFromFileAnnotation* newPolyLinesAnnot = new RimPolylinesFromFileAnnotation; @@ -177,8 +176,6 @@ RimPolylinesFromFileAnnotation* RimAnnotationCollection::importOrUpdatePolylines m_polylineFromFileAnnotations->addAnnotation( newPolyLinesAnnot ); polyLinesObjsToReload.push_back( newPolyLinesAnnot ); - - ++newLinesIdx; } updateViewAnnotationCollections(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 3f344e78f2..d1dafcbb66 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -377,7 +377,6 @@ void RimWellLogTrack::calculatePropertyValueZoomRange() double maxValue = -HUGE_VAL; size_t topologyCurveCount = 0; - size_t visibleCurves = 0u; for ( const auto& curve : m_curves ) { double minCurveValue = HUGE_VAL; @@ -385,7 +384,6 @@ void RimWellLogTrack::calculatePropertyValueZoomRange() if ( curve->isChecked() ) { - visibleCurves++; if ( curve->propertyValueRangeInData( &minCurveValue, &maxCurveValue ) ) { if ( minCurveValue < minValue ) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 0953e039ab..bd95f4d6a2 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1765,7 +1765,6 @@ void RiuMainWindow::updateMemoryUsage() QColor okColor( 0, 150, 0 ); QColor warningColor( 200, 0, 0 ); - QColor criticalColor( 255, 100, 0 ); float currentUsageFraction = 0.0f; float availVirtualFraction = 1.0f; diff --git a/ThirdParty/custom-opm-common/opm-common b/ThirdParty/custom-opm-common/opm-common index 046ed00ac6..f0c77de5d4 160000 --- a/ThirdParty/custom-opm-common/opm-common +++ b/ThirdParty/custom-opm-common/opm-common @@ -1 +1 @@ -Subproject commit 046ed00ac67c5991768de21913ca2ef497ddb9cf +Subproject commit f0c77de5d4a0b04b989c90f9750b7f507326341b diff --git a/ThirdParty/openzgy b/ThirdParty/openzgy index 2463662b48..61126458c7 160000 --- a/ThirdParty/openzgy +++ b/ThirdParty/openzgy @@ -1 +1 @@ -Subproject commit 2463662b48c220db468df2ba6c8ba7ed314613ae +Subproject commit 61126458c761f4fa4fffa817cb162f7912afef3c