-
Notifications
You must be signed in to change notification settings - Fork 601
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (47 loc) · 1.49 KB
/
main.cpp
File metadata and controls
57 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "tscexecutor.h"
#include <cstdio>
#include <cstdlib>
#ifdef _WIN32
#include <windows.h>
static char exename[1024] = {0};
#endif
int main(int argc, char* argv[])
{
// MS Visual C++ memory leak debug tracing
#if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif
TscanCodeExecutor exec;
#ifdef _WIN32
GetModuleFileNameA(NULL, exename, sizeof(exename)/sizeof(exename[0])-1);
argv[0] = exename;
#endif
#ifdef NDEBUG
try {
#endif
return exec.check(argc, argv);
#ifdef NDEBUG
} catch (const InternalError& e) {
printf("%s\n", e.errorMessage.c_str());
} catch (const std::exception& error) {
printf("%s\n", error.what());
} catch (...) {
printf("Unknown exception\n");
}
return EXIT_FAILURE;
#endif
}
// Warn about deprecated compilers
#ifdef __clang__
# if ( __clang_major__ < 2 || ( __clang_major__ == 2 && __clang_minor__ < 9))
# warning "Using Clang 2.8 or earlier. Support for this version will be removed soon."
# endif
#elif defined(__GNUC__)
# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
# warning "Using GCC 4.3 or earlier. Support for this version will be removed soon."
# endif
#elif defined(_MSC_VER)
# if (_MSC_VER < 1600)
# pragma message("WARNING: Using Visual Studio 2008 or earlier. Support for this version will be removed soon.")
# endif
#endif