Fixed compiler warnings.

This commit is contained in:
Till Rathmann 2019-02-20 16:28:27 +01:00
parent 77abc3bffd
commit 29140afe0c
3 changed files with 52 additions and 47 deletions

View File

@ -49,7 +49,8 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
const auto proc = GetCurrentProcess();
#ifndef __CYGWIN__
const auto inlineNum = std::min<DWORD>( MaxCbTrace - 1, SymAddrIncludeInlineTrace( proc, ptr ) );
DWORD ctx, idx;
DWORD ctx = 0;
DWORD idx;
BOOL doInline = FALSE;
if( inlineNum != 0 ) doInline = SymQueryInlineTrace( proc, ptr, 0, ptr, ptr, &ctx, &idx );
if( doInline )
@ -75,33 +76,36 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
si->NameLen = 9;
}
auto name = (char*)tracy_malloc( si->NameLen + 1 );
memcpy( name, si->Name, si->NameLen );
name[si->NameLen] = '\0';
cb_data[write].name = name;
const char* filename;
IMAGEHLP_LINE64 line;
DWORD displacement = 0;
line.SizeOfStruct = sizeof( IMAGEHLP_LINE64 );
if( SymGetLineFromAddr64( proc, ptr, &displacement, &line ) == 0 )
{
filename = "[unknown]";
cb_data[write].line = 0;
}
else
{
filename = line.FileName;
cb_data[write].line = line.LineNumber;
}
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
const auto fsz = strlen( filename );
auto file = (char*)tracy_malloc( fsz + 1 );
memcpy( file, filename, fsz );
file[fsz] = '\0';
{
auto name = (char*)tracy_malloc(si->NameLen + 1);
memcpy(name, si->Name, si->NameLen);
name[si->NameLen] = '\0';
cb_data[write].file = file;
cb_data[write].name = name;
const char* filename;
if (SymGetLineFromAddr64(proc, ptr, &displacement, &line) == 0)
{
filename = "[unknown]";
cb_data[write].line = 0;
}
else
{
filename = line.FileName;
cb_data[write].line = line.LineNumber;
}
const auto fsz = strlen(filename);
auto file = (char*)tracy_malloc(fsz + 1);
memcpy(file, filename, fsz);
file[fsz] = '\0';
cb_data[write].file = file;
}
#ifndef __CYGWIN__
if( doInline )
@ -121,6 +125,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
name[si->NameLen] = '\0';
cb.name = name;
const char* filename;
if( SymGetLineFromInlineContext( proc, ptr, ctx, 0, &displacement, &line ) == 0 )
{
filename = "[unknown]";
@ -168,7 +173,7 @@ static inline char* CopyString( const char* src )
return dst;
}
static int CallstackDataCb( void* data, uintptr_t pc, const char* fn, int lineno, const char* function )
static int CallstackDataCb( void* /*data*/, uintptr_t pc, const char* fn, int lineno, const char* function )
{
enum { DemangleBufLen = 64*1024 };
char demangled[DemangleBufLen];
@ -265,7 +270,7 @@ static int CallstackDataCb( void* data, uintptr_t pc, const char* fn, int lineno
}
}
static void CallstackErrorCb( void* data, const char* msg, int errnum )
static void CallstackErrorCb( void* /*data*/, const char* /*msg*/, int /*errnum*/ )
{
for( int i=0; i<cb_num; i++ )
{

View File

@ -88,9 +88,9 @@ namespace tracy
namespace
{
BOOL CALLBACK InitOnceCallback(
PINIT_ONCE initOnce,
PVOID Parameter,
PVOID *Context)
PINIT_ONCE /*initOnce*/,
PVOID /*Parameter*/,
PVOID* /*Context*/)
{
rpmalloc_initialize();
return TRUE;
@ -396,13 +396,13 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp )
switch( pExp->ExceptionRecord->ExceptionInformation[0] )
{
case 0:
msgPtr += sprintf( msgPtr, "Read violation at address 0x%" PRIxMAX ".", pExp->ExceptionRecord->ExceptionInformation[1] );
msgPtr += sprintf( msgPtr, "Read violation at address 0x%" PRIxPTR ".", pExp->ExceptionRecord->ExceptionInformation[1] );
break;
case 1:
msgPtr += sprintf( msgPtr, "Write violation at address 0x%" PRIxMAX ".", pExp->ExceptionRecord->ExceptionInformation[1] );
msgPtr += sprintf( msgPtr, "Write violation at address 0x%" PRIxPTR ".", pExp->ExceptionRecord->ExceptionInformation[1] );
break;
case 8:
msgPtr += sprintf( msgPtr, "DEP violation at address 0x%" PRIxMAX ".", pExp->ExceptionRecord->ExceptionInformation[1] );
msgPtr += sprintf( msgPtr, "DEP violation at address 0x%" PRIxPTR ".", pExp->ExceptionRecord->ExceptionInformation[1] );
break;
default:
break;
@ -503,7 +503,7 @@ static long s_profilerTid = 0;
static char s_crashText[1024];
static std::atomic<bool> s_alreadyCrashed( false );
static void ThreadFreezer( int signal )
static void ThreadFreezer( int /*signal*/ )
{
for(;;) sleep( 1000 );
}
@ -534,7 +534,7 @@ static inline void HexPrint( char*& ptr, uint64_t val )
while( bptr != buf );
}
static void CrashHandler( int signal, siginfo_t* info, void* ucontext )
static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
{
bool expected = false;
if( !s_alreadyCrashed.compare_exchange_strong( expected, true ) ) ThreadFreezer( signal );

View File

@ -850,10 +850,10 @@ read_attribute (enum dwarf_form form, struct dwarf_buf *buf,
return 1;
case DW_FORM_indirect:
{
uint64_t form;
uint64_t form2;
form = read_uleb128 (buf);
return read_attribute ((enum dwarf_form) form, buf, is_dwarf64,
form2 = read_uleb128 (buf);
return read_attribute ((enum dwarf_form) form2, buf, is_dwarf64,
version, addrsize, dwarf_str, dwarf_str_size,
val);
}
@ -2855,22 +2855,22 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
if (entry->u->abs_filename == NULL)
{
const char *filename;
const char *filename2;
filename = entry->u->filename;
if (filename != NULL
&& !IS_ABSOLUTE_PATH (filename)
filename2 = entry->u->filename;
if (filename2 != NULL
&& !IS_ABSOLUTE_PATH (filename2)
&& entry->u->comp_dir != NULL)
{
size_t filename_len;
size_t filename2_len;
const char *dir;
size_t dir_len;
char *s;
filename_len = strlen (filename);
filename2_len = strlen (filename2);
dir = entry->u->comp_dir;
dir_len = strlen (dir);
s = (char *) backtrace_alloc (state, dir_len + filename_len + 2,
s = (char *) backtrace_alloc (state, dir_len + filename2_len + 2,
error_callback, data);
if (s == NULL)
{
@ -2880,10 +2880,10 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
memcpy (s, dir, dir_len);
/* FIXME: Should use backslash if DOS file system. */
s[dir_len] = '/';
memcpy (s + dir_len + 1, filename, filename_len + 1);
filename = s;
memcpy (s + dir_len + 1, filename2, filename2_len + 1);
filename2 = s;
}
entry->u->abs_filename = filename;
entry->u->abs_filename = filename2;
}
return callback (data, pc, entry->u->abs_filename, 0, NULL);