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

0024574: ICC compiler warnings on Windows

NCollection_UtfString and NCollection_UtfIterator classes are refactored to use methods overloading instead of switches to dispatch implementation depending on character (Unicode code unit) size.

ICC-specific preprocessor directives are added to avoid warnings.
Unused local functions and variables, class methods, unreachable statements, and extra throw() declarations reported by ICC are removed.
Usage of "expl" for name of local variable is avoided as it conflicts with standard C function "expl" defined in math.h as preprocessor macro.

Non-standard (MS-specific) argument envp is removed in definition of main() function on Windows.
Functions _main_ and _WinMain_ are renamed to Draw_Main and Draw_WinMain, respectively, to avoid using names reserved in C++.

Doxygen warning is fixed in XDE User's Guide.
This commit is contained in:
abv
2017-10-19 17:12:05 +03:00
committed by bugmaster
parent f6c2b39aac
commit cf0786daf1
22 changed files with 259 additions and 298 deletions

View File

@@ -46,26 +46,26 @@ static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
#endif
#ifdef _WIN32
//=======================================================================
//NOTE: OCC11
// On Windows NT, both console (UNIX-like) and windowed (classical on
// WNT, with three separated windows - input, output and graphic)
// modes are supported.
// Depending on compilation mode of executable (CONSOLE or WINDOWS),
// either _main_ or _WinMain_ becomes entry point;
// either Draw_Main or Draw_WinMain becomes entry point;
// the further different behaviour of DRAW is determined by variable
// Draw_IsConsoleSubsystem which is set by _main_ only
// Draw_IsConsoleSubsystem which is set by Draw_Main only
//=======================================================================
extern Standard_Boolean Draw_IsConsoleSubsystem;
//=======================================================================
//function : _main_
//function : Draw_Main
//purpose :
//=======================================================================
Standard_Integer _main_ (int /*argc*/, char* argv[], char* /*envp*/[], const FDraw_InitAppli fDraw_InitAppli)
Standard_Integer Draw_Main (int /*argc*/, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
{
Draw_IsConsoleSubsystem = Standard_True;
theDraw_InitAppli = fDraw_InitAppli;
@@ -83,11 +83,11 @@ Standard_Integer _main_ (int /*argc*/, char* argv[], char* /*envp*/[], const FDr
}
//=======================================================================
//function : _WinMain_
//function : Draw_WinMain
//purpose :
//=======================================================================
Standard_Integer _WinMain_ (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR /*lpCmdLine*/, int nCmdShow, const FDraw_InitAppli fDraw_InitAppli)
Standard_Integer Draw_WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR /*lpCmdLine*/, int nCmdShow, const FDraw_InitAppli fDraw_InitAppli)
{
theDraw_InitAppli = fDraw_InitAppli;
int aNbArgs = 0;
@@ -96,13 +96,15 @@ Standard_Integer _WinMain_ (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR
LocalFree (anArgVec);
return 0;
}
#else
//=======================================================================
//function : _main_
//function : Draw_Main
//purpose :
//=======================================================================
Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
Standard_Integer Draw_Main (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
{
// MKV 01.02.05
#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
@@ -111,4 +113,5 @@ Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAp
Draw_Appli(argc, argv, fDraw_InitAppli);
return 0;
}
#endif

View File

@@ -30,37 +30,32 @@
typedef void (*FDraw_InitAppli)(Draw_Interpretor&);
#ifndef _WIN32
Standard_EXPORT Standard_Integer _main_ (Standard_Integer argc,
Standard_PCharacter argv[],
const FDraw_InitAppli Draw_InitAppli);
#else
#include <windows.h>
Standard_EXPORT Standard_Integer _WinMain_ (HINSTANCE hInstance,
HINSTANCE hPrevinstance,
LPSTR lpCmdLine,
Standard_Integer nCmdShow,
const FDraw_InitAppli Draw_InitAppli);
Standard_EXPORT Standard_Integer _main_ (int argc,
char* argv[],
char* envp[],
const FDraw_InitAppli Draw_InitAppli);
#endif
Standard_EXPORT Standard_Integer Draw_Main (Standard_Integer argc, Standard_PCharacter argv[], const FDraw_InitAppli Draw_InitAppli);
// Declarations of macros DRAW_MAIN to be used in executables instead of explicit main/WinMain
#ifndef _WIN32
// main()
#define DRAW_MAIN int main (Standard_Integer argc, char* argv[])\
{return _main_ (argc, argv, Draw_InitAppli);}
#else
#ifdef _WIN32
#include <windows.h>
Standard_EXPORT Standard_Integer Draw_WinMain (HINSTANCE hInstance,
HINSTANCE hPrevinstance,
LPSTR lpCmdLine,
Standard_Integer nCmdShow,
const FDraw_InitAppli Draw_InitAppli);
// WinMain() and main()
#define DRAW_MAIN Standard_Integer PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, Standard_Integer nCmdShow)\
{return _WinMain_ (hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli);}\
#define DRAW_MAIN Standard_Integer PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, Standard_Integer nCmdShow) \
{ return Draw_WinMain (hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); } \
\
int main (int argc, char* argv[], char* envp[])\
{return _main_ (argc, argv, envp, Draw_InitAppli);}
#endif
int main (int argc, char* argv[]) \
{ return Draw_Main (argc, argv, Draw_InitAppli); }
#else
// main()
#define DRAW_MAIN int main (Standard_Integer argc, char* argv[]) \
{ return Draw_Main (argc, argv, Draw_InitAppli); }
#endif
#endif

View File

@@ -86,7 +86,7 @@ BOOL CreateProc(HWND hWndFrame)
| COMMAND PROCEDURE
| Handler for message WM_COMMAND
| It is used when Draw_IsConsoleSubsystem = Standard_False
| i.e. in non-console mode (see _main_() in Draw_Main.cxx).
| i.e. in non-console mode (see Draw_main() in Draw_Main.cxx).
\*--------------------------------------------------------------------------*/
LRESULT APIENTRY CmdProc(HWND hWndFrame, UINT wMsg, WPARAM /*wParam*/, LPARAM /*lParam*/)
{