summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-02-20 21:17:36 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-20 21:17:36 +0000
commit56e7b7eaede52e8d2123e909d7d42220f8c63143 (patch)
tree73e1dc4b2e53d68c3a9d5269f9140142ef08c187 /mysql-test/lib
parent9d97e6010ebdeab0579a8371d01f34118c518b30 (diff)
downloadmariadb-git-56e7b7eaede52e8d2123e909d7d42220f8c63143.tar.gz
Make possible to use clang on Windows (clang-cl)
-DWITH_ASAN can be used as well now, on x64 Fix many clang-cl warnings.
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_kill_win.cc20
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process_win.cc10
2 files changed, 15 insertions, 15 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index 8cb805b1bbc..68a069ad319 100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -77,14 +77,14 @@ void dump_single_process(DWORD pid)
process= OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
if (!process)
{
- fprintf(stderr, "safe_kill : cannot open process pid=%u to create dump, last error %u\n",
+ fprintf(stderr, "safe_kill : cannot open process pid=%lu to create dump, last error %lu\n",
pid, GetLastError());
goto exit;
}
if (QueryFullProcessImageName(process, 0, path, &size) == 0)
{
- fprintf(stderr, "safe_kill : cannot read process path for pid %u, last error %u\n",
+ fprintf(stderr, "safe_kill : cannot read process path for pid %lu, last error %lu\n",
pid, GetLastError());
goto exit;
}
@@ -116,17 +116,17 @@ void dump_single_process(DWORD pid)
{
if (!GetTempFileName(".", filename, 0, tmpname))
{
- fprintf(stderr, "GetTempFileName failed, last error %u", GetLastError());
+ fprintf(stderr, "GetTempFileName failed, last error %lu", GetLastError());
goto exit;
}
- strncat(tmpname, ".dmp", sizeof(tmpname));
+ strncat_s(tmpname, ".dmp", sizeof(tmpname));
filename= tmpname;
}
if (!GetCurrentDirectory(MAX_PATH, working_dir))
{
- fprintf(stderr, "GetCurrentDirectory failed, last error %u", GetLastError());
+ fprintf(stderr, "GetCurrentDirectory failed, last error %lu", GetLastError());
goto exit;
}
@@ -135,14 +135,14 @@ void dump_single_process(DWORD pid)
if (file == INVALID_HANDLE_VALUE)
{
- fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
+ fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %lu\n",
filename, working_dir, GetLastError());
goto exit;
}
if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0, 0, 0))
{
- fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
+ fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %lu\n",
filename, working_dir, GetLastError());
goto exit;
}
@@ -214,7 +214,7 @@ int main(int argc, const char** argv )
if (!GetExitCodeProcess(process,&exit_code))
{
- fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
+ fprintf(stderr, "GetExitCodeProcess failed, pid= %lu, err= %lu\n",
pid, GetLastError());
exit(1);
}
@@ -232,7 +232,7 @@ int main(int argc, const char** argv )
Sleep(100);
else
{
- fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n",
+ fprintf(stderr, "Failed to open shutdown_event '%s', error: %lu\n",
safe_process_name, GetLastError());
exit(3);
}
@@ -240,7 +240,7 @@ int main(int argc, const char** argv )
if(SetEvent(shutdown_event) == 0)
{
- fprintf(stderr, "Failed to signal shutdown_event '%s', error: %d\n",
+ fprintf(stderr, "Failed to signal shutdown_event '%s', error: %lu\n",
safe_process_name, GetLastError());
CloseHandle(shutdown_event);
exit(4);
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index dca2faded71..e7fb0d69c91 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -75,7 +75,7 @@ static void message(const char* fmt, ...)
static void die(const char* fmt, ...)
{
- DWORD last_err= GetLastError();
+ int last_err= GetLastError();
va_list args;
fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
va_start(args, fmt);
@@ -106,7 +106,7 @@ static void die(const char* fmt, ...)
DWORD get_parent_pid(DWORD pid)
{
HANDLE snapshot;
- DWORD parent_pid= -1;
+ DWORD parent_pid= 0;
PROCESSENTRY32 pe32;
pe32.dwSize= sizeof(PROCESSENTRY32);
@@ -127,7 +127,7 @@ DWORD get_parent_pid(DWORD pid)
} while(Process32Next( snapshot, &pe32));
CloseHandle(snapshot);
- if (parent_pid == -1)
+ if (parent_pid == 0)
die("Could not find parent pid");
return parent_pid;
@@ -163,7 +163,7 @@ int main(int argc, const char** argv )
PROCESS_INFORMATION process_info= {0};
BOOL nocore= FALSE;
- sprintf(safe_process_name, "safe_process[%d]", pid);
+ sprintf(safe_process_name, "safe_process[%lu]", pid);
/* Create an event for the signal handler */
if ((shutdown_event=
@@ -298,7 +298,7 @@ int main(int argc, const char** argv )
BOOL process_created= FALSE;
BOOL jobobject_assigned= FALSE;
- for (int i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
+ for (size_t i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
{
process_created= CreateProcess(NULL, (LPSTR)child_args,
NULL,