Merge pull request #5754 from OPM/stricter-warnings-linux

Stricter warnings linux
This commit is contained in:
Kristian Bendiksen
2020-05-20 15:19:38 +02:00
committed by GitHub
24 changed files with 30 additions and 64 deletions

View File

@@ -1729,7 +1729,8 @@ void RiaGuiApplication::runIdleProcessing()
}
else
{
idleIterationCount = std::min( ++idleIterationCount, 500 );
++idleIterationCount;
idleIterationCount = std::min( idleIterationCount, 500 );
if ( idleIterationCount == 500 )
{
iterationInterval = 5;

View File

@@ -390,6 +390,15 @@ if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch")
# Treat warnings as errors on new gcc versions
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.2)
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch -Werror")
endif()
endif()
if (MSVC)
# The following warnings are supposed to be used in ResInsight, but temporarily disabled to avoid too much noise
# warning C4245: 'return': conversion from 'int' to 'size_t', signed/unsigned mismatch

View File

@@ -809,7 +809,6 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
{
const auto wellPath =
RicWellPathExportCompletionsFileTools::findWellPathFromExportName( completion.wellName() );
auto item = wellPathToLgrNameMap.find( wellPath );
wellPathToLgrNameMap[wellPath].insert( completionsForLgr.first );
}
}

View File

@@ -248,9 +248,7 @@ VdeArrayDataPacket
const char* payloadPtr = rawPacketBuffer + VDE_HEADER_SIZE;
const size_t payloadSizeInBytes = bufferSize - VDE_HEADER_SIZE;
const size_t payloadSizeInBytesFromPacketFields = elementCount * sizeOfElement( elementType );
assert( payloadSizeInBytes == payloadSizeInBytesFromPacketFields );
assert( payloadSizeInBytes == elementCount * sizeOfElement( elementType ) );
VdeArrayDataPacket packet;
packet.assign( packetId, elementType, elementCount, imageWidth, imageHeight, imageCompCount, payloadPtr, payloadSizeInBytes );
@@ -284,8 +282,7 @@ bool VdeArrayDataPacket::assign( int arrayId,
bufferWriter.setUint16( VDE_BYTEOFFSET_IMAGE_WIDTH, imageWidth );
bufferWriter.setUint16( VDE_BYTEOFFSET_IMAGE_HEIGHT, imageHeight );
const size_t calcArraySizeInBytes = elementCount * sizeOfElement( elementType );
assert( arrayDataSizeInBytes == calcArraySizeInBytes );
assert( arrayDataSizeInBytes == elementCount * sizeOfElement( elementType ) );
std::copy( arrayDataPtr, arrayDataPtr + arrayDataSizeInBytes, m_packetBytes.begin() + VDE_HEADER_SIZE );
assert( m_packetBytes.size() == totalSizeBytes );

View File

@@ -347,7 +347,6 @@ void Riv3dWellLogCurveGeometryGenerator::createNewVerticesAlongSegment( const cv
const std::vector<cvf::Vec3d>& drawSurfaceVertices,
std::vector<cvf::Vec3d>* extraVertices )
{
cvf::Vec3d fullSegmentVector = ptEnd - ptStart;
extraVertices->push_back( ptStart );
// Find segments that intersects the triangle edges

View File

@@ -93,8 +93,6 @@ void RivContourMapProjectionPartMgr::appendPickPointVisToModel( cvf::ModelBasicL
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Vec2fArray> RivContourMapProjectionPartMgr::createTextureCoords( const std::vector<double>& values ) const
{
cvf::Vec2ui patchSize = m_contourMapProjection->numberOfVerticesIJ();
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray( values.size() );
#pragma omp parallel for

View File

@@ -67,8 +67,6 @@ void RivReachCircleAnnotationPartMgr::buildParts( const caf::DisplayCoordTransfo
cvf::ref<RivReachCircleAnnotationSourceInfo> sourceInfo = new RivReachCircleAnnotationSourceInfo( rimAnnotation );
Vec3d centerPositionInDomain = rimAnnotation->centerPoint();
auto lineColor = rimAnnotation->appearance()->color();
auto isDashedLine = rimAnnotation->appearance()->isDashed();
auto lineThickness = rimAnnotation->appearance()->thickness();

View File

@@ -103,9 +103,8 @@ void RivWellPathSourceInfo::normalizedIntersection( size_t triangleIn
cvf::Vec3d segmentStart = rigWellPath->m_wellPathPoints[segIndex];
cvf::Vec3d segmentEnd = rigWellPath->m_wellPathPoints[segIndex + 1];
double norm = 0.0;
cvf::Vec3d pointOnLine =
cvf::GeometryTools::projectPointOnLine( segmentStart, segmentEnd, globalIntersectionInDomain, &norm );
double norm = 0.0;
cvf::GeometryTools::projectPointOnLine( segmentStart, segmentEnd, globalIntersectionInDomain, &norm );
norm = cvf::Math::clamp( norm, 0.0, 1.0 );
*firstSegmentIndex = segIndex;

View File

@@ -147,10 +147,6 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
MeshLinesAccumulator meshAcc( m_hexGrid.p() );
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
std::vector<size_t> cellDummy;
m_hexGrid->findIntersectingCells( cvf::BoundingBox( cvf::Vec3d::ZERO, cvf::Vec3d::ZERO ), &cellDummy );
m_usedSurfaceData = m_surfaceInView->surface()->surfaceData();
const std::vector<cvf::Vec3d>& nativeVertices = m_usedSurfaceData->vertices();

View File

@@ -1236,7 +1236,7 @@ void Rim3dView::updateDisplayModelVisibility()
// Initialize the mask to show everything except the the bits controlled here
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit &
~intersectionCellFaceBit & ~intersectionCellMeshBit & ~intersectionFaultMeshBit;
~uintIntersectionCellFaceBit & ~uintIntersectionCellMeshBit & ~uintIntersectionFaultMeshBit;
// Then turn the appropriate bits on according to the user settings

View File

@@ -1946,7 +1946,8 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
int frmIdx2 = it->first.second;
int combIndex = it->second;
if ( frmIdx1 >= fnVector.size() || frmIdx2 >= fnVector.size() ) continue;
int fnVectorSize = fnVector.size();
if ( frmIdx1 >= fnVectorSize || frmIdx2 >= fnVectorSize ) continue;
QString frmName1 = fnVector[frmIdx1];
QString frmName2 = fnVector[frmIdx2];

View File

@@ -120,7 +120,6 @@ void RimFormationNames::updateConnectedViews()
std::vector<RimCase*> objects;
this->objectsWithReferringPtrFieldsOfType( objects );
bool updatedTracks = false;
for ( RimCase* caseObj : objects )
{
if ( caseObj )
@@ -135,7 +134,6 @@ void RimFormationNames::updateConnectedViews()
if ( track->formationNamesCase() == caseObj )
{
track->loadDataAndUpdate();
updatedTracks = true;
}
}
}

View File

@@ -375,8 +375,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
RiaDefines::DepthTypeEnum depthType = RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH;
DerivedMDSource derivedMDSource = NO_SOURCE;
DerivedMDSource derivedMDSource = NO_SOURCE;
if ( isCurveVisible() )
{
@@ -384,8 +383,6 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
depthType = wellLogPlot->depthType();
RimWellRftPlot* rftPlot = dynamic_cast<RimWellRftPlot*>( wellLogPlot );
bool showErrorBarsInObservedData = rftPlot ? rftPlot->showErrorBarsForObservedData() : false;
m_showErrorBars = showErrorBarsInObservedData;

View File

@@ -2484,11 +2484,6 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
RimDepthTrackPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
RimMainPlotCollection* mainPlotCollection;
this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection );
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
RigEclipseWellLogExtractor* eclWellLogExtractor =
RiaExtractionTools::wellLogExtractorEclipseCase( m_formationWellPathForSourceCase,
dynamic_cast<RimEclipseCase*>( m_formationCase() ) );

View File

@@ -83,7 +83,6 @@ double RigGeoMechBoreHoleStressCalculator::solveBisection( double minPw, double
minPw = largestNegativeValue.first;
double minPwFuncVal = largestNegativeValue.second;
maxPw = smallestPositiveValue.first;
double maxPwFuncVal = smallestPositiveValue.second;
double range = std::abs( maxPw - minPw );
@@ -94,8 +93,7 @@ double RigGeoMechBoreHoleStressCalculator::solveBisection( double minPw, double
double midPwFuncVal = ( this->*fn )( midPw, &theta );
if ( midPwFuncVal * minPwFuncVal < 0.0 )
{
maxPw = midPw;
maxPwFuncVal = midPwFuncVal;
maxPw = midPw;
}
else
{

View File

@@ -316,16 +316,16 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
{
if ( !lasFileValues.empty() )
{
double lasValue = getWellLogIntersectionValue( intersectionIdx, lasFileValues );
// Only accept las-values for PP_reservoir if the grid result is valid
bool validLasRegion = true;
if (isPPResResult)
double lasValue = getWellLogIntersectionValue( intersectionIdx, lasFileValues );
// Only accept las-values for PP_reservoir if the grid result is valid
bool validLasRegion = true;
if ( isPPResResult )
{
validLasRegion = intersectionIdx < gridValues.size() &&
validLasRegion = intersectionIdx < static_cast<int64_t>( gridValues.size() ) &&
gridValues[intersectionIdx] != std::numeric_limits<double>::infinity();
}
if ( validLasRegion && lasValue != std::numeric_limits<double>::infinity())
if ( validLasRegion && lasValue != std::numeric_limits<double>::infinity() )
{
unscaledValues[intersectionIdx] = lasValue;
finalSourcesPerSegment[intersectionIdx] = RigWbsParameter::LAS_FILE;

View File

@@ -126,7 +126,6 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe
for ( const auto& mapElement : tofToCellIndicesMap )
{
const double tofValue = mapElement.first;
const std::vector<size_t>& cellIndicesArr = mapElement.second;
for ( size_t cellIndex : cellIndicesArr )

View File

@@ -278,8 +278,6 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX
double c = b - ( b - a ) / phi;
double d = a + ( b - a ) / phi;
double fa = spline.value( a ) - y;
double fb = spline.value( b ) - y;
double fc = spline.value( c ) - y;
double fd = spline.value( d ) - y;
@@ -293,7 +291,6 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX
if ( std::fabs( fc ) < std::fabs( fd ) )
{
b = d;
fb = fd;
d = c;
fd = fc;
c = b - ( b - a ) / phi;
@@ -302,7 +299,6 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX
else
{
a = c;
fa = fc;
c = d;
fc = fd;
d = a + ( b - a ) / phi;

View File

@@ -200,12 +200,6 @@ TEST( RifEclipseInputFileToolsTest, EquilData )
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
EXPECT_EQ( (int)10, keywordContent.size() );
for ( const auto& s : keywordContent )
{
RigEquil equilRec = RigEquil::parseString( s );
// qDebug() << s;
}
}
}

View File

@@ -65,7 +65,6 @@ TEST( RigCellGeometryTools, calculateCellVolumeTest )
corner.x() += 0.5 * bbox.extent().x();
tetrahedronBBox.add( corner );
}
overlapVertices;
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices,
tetrahedronBBox,
&overlapVertices,

View File

@@ -97,5 +97,5 @@ TEST( RigHexIntersectionTools, DISABLED_planeHexCellIntersectionPerformanceTest
qDebug() << "Time rim elapsed: " << timeLocal.elapsed();
}
qDebug() << "Time total elapsed: " << timeTotal.elapsed();
qDebug() << "Time total elapsed: " << timeTotal.elapsed() << " intersected: " << static_cast<int>( isCellIntersected );
}

View File

@@ -867,10 +867,8 @@ void RiuQwtPlotWidget::recalculateAxisExtents( QwtPlot::Axis axis )
//--------------------------------------------------------------------------------------------------
caf::UiStyleSheet RiuQwtPlotWidget::createPlotStyleSheet() const
{
QColor backgroundColor = QColor( "white" );
QColor highlightColor = QApplication::palette().highlight().color();
QColor blendedHighlightColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 20 );
QColor nearlyBackgroundColor = RiaColorTools::blendQColors( highlightColor, backgroundColor, 1, 40 );
QColor backgroundColor = QColor( "white" );
QColor highlightColor = QApplication::palette().highlight().color();
caf::UiStyleSheet styleSheet;
styleSheet.set( "background-color", backgroundColor.name() );

View File

@@ -56,7 +56,6 @@ double RiuQwtScalePicker::axisValueAtPosition( const QwtScaleWidget* scale, cons
// translate the position in a value on the scale
double value = 0.0;
int axis = -1;
const QwtScaleDraw* sd = scale->scaleDraw();
switch ( scale->alignment() )
@@ -64,25 +63,21 @@ double RiuQwtScalePicker::axisValueAtPosition( const QwtScaleWidget* scale, cons
case QwtScaleDraw::LeftScale:
{
value = sd->scaleMap().invTransform( pos.y() );
axis = QwtPlot::yLeft;
break;
}
case QwtScaleDraw::RightScale:
{
value = sd->scaleMap().invTransform( pos.y() );
axis = QwtPlot::yRight;
break;
}
case QwtScaleDraw::BottomScale:
{
value = sd->scaleMap().invTransform( pos.x() );
axis = QwtPlot::xBottom;
break;
}
case QwtScaleDraw::TopScale:
{
value = sd->scaleMap().invTransform( pos.x() );
axis = QwtPlot::xTop;
break;
}
}

View File

@@ -488,7 +488,7 @@ bool AABBTree::buildTree()
{
bool bThreadRes = bRes;
#pragma omp for
for (int i = 0; i < m_previousLevelNodes.size(); ++i)
for (int i = 0; i < static_cast<int>(m_previousLevelNodes.size()); ++i)
{
bThreadRes = bThreadRes && buildTree(m_previousLevelNodes[i].node, m_previousLevelNodes[i].fromIdx, m_previousLevelNodes[i].toIdx, 4);
}