Fix warnings generated by clang (#132)

This commit is contained in:
J. Peter Mugaas 2023-12-21 11:13:47 -05:00 committed by GitHub
parent de7730929e
commit 8c1dab1b89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 43 additions and 17 deletions

View File

@ -359,6 +359,12 @@ elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm"))
endforeach()
endif()
if(MINGW)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_link_options(${t} PRIVATE -municode)
endforeach()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WarningsLib -Wall -Wpedantic -Wextra)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
@ -370,10 +376,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
foreach(t IN LISTS TOOL_EXES)
target_compile_options(${t} PRIVATE ${WarningsEXE})
endforeach()
elseif(MINGW)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "-Wno-ignored-attributes")
target_link_options(${t} PRIVATE -municode)
endforeach()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})

View File

@ -113,7 +113,10 @@ namespace
}
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning( suppress : 4127 )
#endif
if ((sizeof(IndexType) == sizeof(uint16_t)) && (*nNewVerts > 0x0fffe))
{
DPF(0, "Resulting mesh is too large to fit in 16-bit mesh.");
@ -137,6 +140,9 @@ namespace
pReverseRemapArray[i] = static_cast<uint32_t>(i);
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
memcpy(vOutVertexRemapBuffer.data(), pReverseRemapArray, (*nNewVerts) * sizeof(uint32_t));
memcpy(pOutIndexData, pNewIndexData, 3 * nFaces * sizeof(IndexType));

View File

@ -1488,7 +1488,6 @@ Isochart::IMTFromTextureMapEx(
memset(tempSumIMT, 0, sizeof(double) * IMT_DIM);
double dTotal2DArea = 0;
double dPieceArea = 0;
for (size_t ii = 0; ii < dwRowLineCount - 1; ii++)
{
@ -1518,7 +1517,6 @@ Isochart::IMTFromTextureMapEx(
tempSumIMT[kk] += tempIMT[kk];
}
dTotal2DArea += dPieceArea;
}
}

View File

@ -1263,8 +1263,6 @@ HRESULT CIsochartEngine::ApplyInitEngine(
delete pRootChart;
return E_OUTOFMEMORY;
}
size_t dwTestVertexCount = 0;
size_t dwTestFaceCount = 0;
while (!m_currentChartHeap.empty())
{
CIsochartMesh* pChart = m_currentChartHeap.cutTopData();
@ -1312,8 +1310,6 @@ HRESULT CIsochartEngine::ApplyInitEngine(
delete pChart;
return E_OUTOFMEMORY;
}
dwTestVertexCount += pChart->GetVertexNumber();
dwTestFaceCount += pChart->GetFaceNumber();
}
}
@ -1704,7 +1700,6 @@ HRESULT CIsochartEngine::FillExportFaceIndexBuffer(
{
assert(pvFaceBuffer != nullptr);
uint32_t dwFaceId = 0;
size_t dwOffset = 0;
auto pBaseFaces = reinterpret_cast<INDEXTYPE*>(pvFaceBuffer->data());
@ -1729,7 +1724,6 @@ HRESULT CIsochartEngine::FillExportFaceIndexBuffer(
= static_cast<INDEXTYPE>(pChartFaceBuffer[j].dwVertexID[2]
+ dwOffset);
dwFaceId++;
}
dwOffset += pChart->GetVertexNumber();
}

View File

@ -2752,8 +2752,10 @@ HRESULT CIsochartMesh::CalMinPathToOtherBoundary(
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning( disable : 4706 )
#endif
HRESULT CIsochartMesh::RetreiveVertDijkstraPathToSource(
uint32_t dwVertexID,
@ -2787,7 +2789,9 @@ HRESULT CIsochartMesh::RetreiveVertDijkstraPathToSource(
return hr;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
HRESULT CIsochartMesh::CalMinPathBetweenBoundaries(
VERTEX_ARRAY& allBoundaryList,

View File

@ -769,7 +769,6 @@ HRESULT CIsochartMesh::OptimizeGeoLnInfiniteStretch(
return hr;
}
size_t dwBoundaryInfFaces = 0;
if (bCanOptimize)
{
if (optimizeInfo.dwInfinitStretchVertexCount == 0)
@ -811,12 +810,6 @@ HRESULT CIsochartMesh::OptimizeGeoLnInfiniteStretch(
optimizeInfo.dwInfinitStretchVertexCount++;
optimizeInfo.fInfinitFacesArea +=
m_baseInfo.pfFaceAreaArray[m_pFaces[i].dwIDInRootMesh];
bool bBoundary =
m_pVerts[m_pFaces[i].dwVertexID[0]].bIsBoundary
|| m_pVerts[m_pFaces[i].dwVertexID[1]].bIsBoundary
|| m_pVerts[m_pFaces[i].dwVertexID[2]].bIsBoundary;
dwBoundaryInfFaces += (bBoundary ? 1 : 0);
}
else if (optimizeInfo.pfFaceStretch[i] > m_baseInfo.fExpectAvgL2SquaredStretch)
{

View File

@ -9,6 +9,7 @@
#pragma once
#ifdef _MSC_VER
// Off by default warnings
#pragma warning(disable : 4619 4616 4061 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4820 4987 5026 5027 5031 5032 5039 5045 5264 26451 26812)
// C4619/4616 #pragma warning warnings
@ -41,6 +42,7 @@
// Xbox One XDK related Off by default warnings
#pragma warning(disable : 4643)
// C4643 Forward declaring in namespace std is not permitted by the C++ Standard
#endif
#ifdef __clang__
#pragma clang diagnostic ignored "-Wc++98-compat"
@ -59,8 +61,10 @@
#define WIN32_LEAN_AND_MEAN
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define NOMINMAX 1
#define NODRAWTEXT
#define NOGDI
@ -68,7 +72,9 @@
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <Windows.h>
#include <objbase.h>
@ -101,17 +107,25 @@
#include <queue>
#ifdef UVATLAS_USE_EIGEN
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4127 4244 4265 4456 4464 5220)
#endif
#include <Eigen/Dense>
#include <Spectra/SymEigsSolver.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4774)
#endif
#include <random>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifndef _WIN32
#include <mutex>

View File

@ -10,8 +10,10 @@
// http://go.microsoft.com/fwlink/?LinkID=512686
//--------------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
@ -19,7 +21,9 @@
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "Mesh.h"

View File

@ -10,8 +10,10 @@
// http://go.microsoft.com/fwlink/?LinkID=512686
//--------------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX 1
#define NODRAWTEXT
@ -19,7 +21,9 @@
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "Mesh.h"
#include "WaveFrontReader.h"

View File

@ -9,8 +9,10 @@
// http://go.microsoft.com/fwlink/?LinkID=512686
//--------------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
@ -18,7 +20,9 @@
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#if __cplusplus < 201703L
#error Requires C++17 (and /Zc:__cplusplus with MSVC)