1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030609: Coding - eliminate warnings issued by gcc 8.1.0

Warnings issued by gcc 8.1.0 are eliminated.

New Standard_WarningDisableFunctionCast.hxx header file is introduced to disable GCC warning "-Wcast-function-type" in those files *.cxx where it is issued. This warning is issued when the conversion from the pointer to one function type to the pointer to another function type takes places, it was added in gcc 8.1.0.

The function MyVISEDG in SWDRAW_ShapeAnalysis.cxx is removed as it does not seem to do anything useful and relevant DRAW command K_VISEDG is never used in tests.
This commit is contained in:
tiv
2019-10-25 16:01:09 +03:00
committed by apn
parent 53d770b3a2
commit f4a7308f61
15 changed files with 137 additions and 138 deletions

View File

@@ -31,6 +31,8 @@
#endif
#endif
#include <Standard_WarningDisableFunctionCast.hxx>
namespace {
#if defined(_WIN32) && !defined(OCCT_UWP)

View File

@@ -189,6 +189,8 @@ void OSD_SharedLibrary::Destroy() {
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Standard_WarningDisableFunctionCast.hxx>
static DWORD lastDLLError;
static wchar_t errMsg[1024];

View File

@@ -699,12 +699,13 @@ retry:
if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
{
size_t anOldDirLength;
StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength);
StringCchLengthW (oldDir, MAX_PATH, &anOldDirLength);
const size_t aNameLength = anOldDirLength + WILD_CARD_LEN + sizeof (L'\x00');
if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
&& (pName = (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
&& (pName = (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
{
StringCchCopyW (pName, sizeof(pName) / sizeof(pName[0]), oldDir);
StringCchCatW (pName, sizeof(pName), WILD_CARD);
StringCchCopyW (pName, aNameLength, oldDir);
StringCchCatW (pName, aNameLength, WILD_CARD);
retVal = TRUE;
hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
for (BOOL fFind = hFindFile != INVALID_HANDLE_VALUE; fFind; fFind = FindNextFileW (hFindFile, pFD))
@@ -715,23 +716,24 @@ retry:
continue;
}
size_t anOldDirLength2 = 0, aNewDirLength = 0, aFileNameLength = 0;
StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength2);
StringCchLengthW (newDir, sizeof(newDir) / sizeof(newDir[0]), &aNewDirLength);
size_t aNewDirLength = 0, aFileNameLength = 0;
StringCchLengthW (newDir, MAX_PATH, &aNewDirLength);
StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
|| (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aNewDirLength + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
const size_t aFullNameSrcLength = anOldDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
const size_t aFullNameDstLength = aNewDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
|| (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
{
break;
}
StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), oldDir);
StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
StringCchCopyW (pFullNameSrc, aFullNameSrcLength, oldDir);
StringCchCatW (pFullNameSrc, aFullNameSrcLength, L"/");
StringCchCatW (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), newDir);
StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
StringCchCopyW (pFullNameDst, aFullNameDstLength, newDir);
StringCchCatW (pFullNameDst, aFullNameDstLength, L"/");
StringCchCatW (pFullNameDst, aFullNameDstLength, pFD->cFileName);
if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
@@ -853,12 +855,13 @@ BOOL CopyDirectory (const wchar_t* dirSrc, const wchar_t* dirDst)
if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
{
size_t aDirSrcLength = 0;
StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength);
StringCchLengthW (dirSrc, MAX_PATH, &aDirSrcLength);
const size_t aNameLength = aDirSrcLength + WILD_CARD_LEN + sizeof (L'\x00');
if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
&& (pName = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
&& (pName = (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
{
StringCchCopyW(pName, sizeof(pName) / sizeof(pName[0]), dirSrc);
StringCchCatW (pName, sizeof(pName) / sizeof(pName[0]), WILD_CARD);
StringCchCopyW(pName, aNameLength, dirSrc);
StringCchCatW (pName, aNameLength, WILD_CARD);
retVal = TRUE;
hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
@@ -870,23 +873,24 @@ BOOL CopyDirectory (const wchar_t* dirSrc, const wchar_t* dirDst)
continue;
}
size_t aDirSrcLength2 = 0, aDirDstLength = 0, aFileNameLength = 0;
StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength2);
StringCchLengthW (dirDst, sizeof(dirDst) / sizeof(dirDst[0]), &aDirDstLength);
size_t aDirDstLength = 0, aFileNameLength = 0;
StringCchLengthW (dirDst, MAX_PATH, &aDirDstLength);
StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
|| (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aDirDstLength + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
const size_t aFullNameSrcLength = aDirSrcLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
const size_t aFullNameDstLength = aDirDstLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
|| (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
{
break;
}
StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), dirSrc);
StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
StringCchCatW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
StringCchCopyW (pFullNameSrc, aFullNameSrcLength, dirSrc);
StringCchCatW (pFullNameSrc, aFullNameSrcLength, L"/");
StringCchCatW (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), dirDst);
StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
StringCchCatW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
StringCchCopyW (pFullNameDst, aFullNameDstLength, dirDst);
StringCchCatW (pFullNameDst, aFullNameDstLength, L"/");
StringCchCatW (pFullNameDst, aFullNameDstLength, pFD->cFileName);
if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
retVal = CopyDirectory (pFullNameSrc, pFullNameDst);

View File

@@ -18,6 +18,8 @@
#include <Standard_Overflow.hxx>
#include <Standard_Assert.hxx>
#include <Standard_WarningDisableFunctionCast.hxx>
static OSD_SignalMode OSD_WasSetSignal = OSD_SignalMode_AsIs;
//=======================================================================