Skip to content

Commit df6dce8

Browse files
authored
Merge pull request #165 from mattip/gcc-warnings
BUG: Gcc warnings
2 parents 9e47a7d + 014e1ee commit df6dce8

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

src/vmp_stack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ int vmp_walk_and_record_stack(PY_STACK_FRAME_T *frame, void ** result,
262262
}
263263

264264
int depth = 0;
265-
PY_STACK_FRAME_T * top_most_frame = frame;
265+
//PY_STACK_FRAME_T * top_most_frame = frame;
266266
while ((depth + _per_loop()) <= max_depth) {
267267
unw_get_proc_info(&cursor, &pip);
268268

@@ -400,7 +400,7 @@ int vmp_read_vmaps(const char * fname) {
400400
if (fd == NULL) {
401401
return 0;
402402
}
403-
char * saveptr;
403+
char * saveptr = NULL;
404404
char * line = NULL;
405405
char * he = NULL;
406406
char * name;

src/vmprof_common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include <errno.h>
55

66
#ifdef RPYTHON_VMPROF
7+
8+
int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, intptr_t pc);
9+
710
#ifdef RPYTHON_LL2CTYPES
811
/* only for testing: ll2ctypes sets RPY_EXTERN from the command-line */
912

@@ -193,7 +196,7 @@ PY_STACK_FRAME_T *get_vmprof_stack(void)
193196
#endif
194197

195198
intptr_t vmprof_get_traceback(void *stack, void *ucontext,
196-
intptr_t *result_p, intptr_t result_length)
199+
void **result_p, intptr_t result_length)
197200
{
198201
int n;
199202
int enabled;

src/vmprof_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ PY_STACK_FRAME_T *get_vmprof_stack(void);
9696
#endif
9797
RPY_EXTERN
9898
intptr_t vmprof_get_traceback(void *stack, void *ucontext,
99-
intptr_t *result_p, intptr_t result_length);
99+
void **result_p, intptr_t result_length);
100100
#endif
101101

102102
int vmprof_get_signal_type(void);

vmprof/test/test_c_source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class TestStack(object):
1010
def setup_class(cls):
1111
stack_ffi = FFI()
1212
stack_ffi.cdef("""
13-
typedef uint64_t ptr_t;
13+
typedef intptr_t ptr_t;
1414
int vmp_binary_search_ranges(ptr_t ip, ptr_t * l, int count);
1515
int vmp_ignore_ip(ptr_t ip);
1616
int vmp_ignore_symbol_count(void);
@@ -28,7 +28,7 @@ def setup_class(cls):
2828
stack_ffi.set_source("vmprof.test._test_stack", source, include_dirs=['src'],
2929
define_macros=[('_CFFI_USE_EMBEDDING',1), ('PY_TEST',1),
3030
('VMP_SUPPORTS_NATIVE_PROFILING',1)],
31-
libraries=libs, extra_compile_args=['-g'])
31+
libraries=libs, extra_compile_args=['-Werror', '-g'])
3232

3333
stack_ffi.compile(verbose=True)
3434
from vmprof.test import _test_stack as clib

vmprof/test/test_c_symboltable.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
{
2424
*name = gname;
2525
*src = gsrc;
26-
gname[0] = '\x00';
27-
gsrc[0] = '\x00';
26+
gname[0] = 0;
27+
gsrc[0] = 0;
2828
return vmp_resolve_addr(&vmp_resolve_addr, gname, 64,
2929
lineno, gsrc, 128);
3030
}
3131
int test_extract_sofile(char ** name, int * lineno, char ** src)
3232
{
3333
*name = gname;
3434
*src = gsrc;
35-
gname[0] = '\x00';
36-
gsrc[0] = '\x00';
35+
gname[0] = 0;
36+
gsrc[0] = 0;
3737
return vmp_resolve_addr(&abs, gname, 64,
3838
lineno, gsrc, 128);
3939
}
@@ -57,7 +57,7 @@
5757

5858
extra_compile = []
5959
if sys.platform.startswith("linux"):
60-
extra_compile = ['-DVMPROF_LINUX', '-DVMPROF_UNIX']
60+
extra_compile = ['-DVMPROF_LINUX', '-DVMPROF_UNIX', '-Werror', '-g']
6161

6262
# trick: compile with _CFFI_USE_EMBEDDING=1 which will not define Py_LIMITED_API
6363
ffi.set_source("vmprof.test._test_symboltable", source, include_dirs=includes,

vmprof/test/test_run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,13 @@ class TestNative(object):
398398
def setup_class(cls):
399399
ffi = FFI()
400400
ffi.cdef("""
401-
void native_gzipgzipgzip();
401+
void native_gzipgzipgzip(void);
402402
""")
403403
source = """
404404
#include "zlib.h"
405405
unsigned char input[100];
406406
unsigned char output[100];
407-
void native_gzipgzipgzip() {
407+
void native_gzipgzipgzip(void) {
408408
z_stream defstream;
409409
defstream.zalloc = Z_NULL;
410410
defstream.zfree = Z_NULL;
@@ -429,7 +429,7 @@ def setup_class(cls):
429429
# trick: compile with _CFFI_USE_EMBEDDING=1 which will not define Py_LIMITED_API
430430
ffi.set_source("vmprof.test._test_native_gzip", source, include_dirs=['src'],
431431
define_macros=[('_CFFI_USE_EMBEDDING',1),('_PY_TEST',1)], libraries=libs,
432-
extra_compile_args=['-g', '-O0'])
432+
extra_compile_args=['-Werror', '-g', '-O0'])
433433

434434
ffi.compile(verbose=True)
435435
from vmprof.test import _test_native_gzip as clib

0 commit comments

Comments
 (0)