diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-11-28 11:26:52 -0500 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-11-28 11:26:52 -0500 |
commit | 29bdbdb17f088a997b772415d57c37258576f0f5 (patch) | |
tree | 33e666ae8cef67e323c62376f95e4393f2a9dd13 | |
parent | 70514d65f670ac2160af4c282ebad1e7eb852341 (diff) | |
download | systemtap-steved-29bdbdb17f088a997b772415d57c37258576f0f5.tar.gz systemtap-steved-29bdbdb17f088a997b772415d57c37258576f0f5.tar.xz systemtap-steved-29bdbdb17f088a997b772415d57c37258576f0f5.zip |
PR5947: make runtime code -Wpointer-arith-clean
-rw-r--r-- | buildrun.cxx | 3 | ||||
-rw-r--r-- | runtime/transport/ChangeLog | 8 | ||||
-rw-r--r-- | runtime/transport/symbols.c | 11 | ||||
-rw-r--r-- | runtime/transport/utt.c | 4 | ||||
-rw-r--r-- | runtime/transport/utt.h | 2 |
5 files changed, 21 insertions, 7 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index 9eeab4ba..ef2a483f 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -139,6 +139,9 @@ compile_pass (systemtap_session& s) // Assumes linux 2.6 kbuild o << "EXTRA_CFLAGS += -Wno-unused -Werror" << endl; + #if CHECK_POINTER_ARITH_PR5947 + o << "EXTRA_CFLAGS += -Wpointer-arith" << endl; + #endif o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl; // XXX: this may help ppc toc overflow // o << "CFLAGS := $(subst -Os,-O2,$(CFLAGS)) -fminimal-toc" << endl; diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 796fa573..c6dfa005 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,11 @@ +2008-11-28 Frank Ch. Eigler <fche@elastic.org> + + PR5947: make code -Wpointer-arith clean + * symbols.c (generic_swap): Cast void* to char* as needed. + (_stp_sort): Ditto. + * utt.c (utt_switch_subbuf): Ditto. + * utt.h (utt_reserve): Ditto. + 2008-11-13 Masami Hiramatsu <mhiramat@redhat.com> * utt.c (utt_trace_setup): Use KERN_WARNING and show buffer size. diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 1cd78724..6e3bef1b 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -78,10 +78,12 @@ static void u32_swap(void *a, void *b, int size) static void generic_swap(void *a, void *b, int size) { + char *aa = a; + char *bb = b; do { - char t = *(char *)a; - *(char *)a++ = *(char *)b; - *(char *)b++ = t; + char t = *aa; + *aa++ = *bb; + *bb++ = t; } while (--size > 0); } @@ -101,9 +103,10 @@ static void generic_swap(void *a, void *b, int size) * O(n*n) worst-case behavior and extra memory requirements that make * it less suitable for kernel use. */ -void _stp_sort(void *base, size_t num, size_t size, +void _stp_sort(void *_base, size_t num, size_t size, int (*cmp) (const void *, const void *), void (*swap) (void *, void *, int size)) { + char *base = (char*) _base; /* pre-scale counters for performance */ int i = (num / 2 - 1) * size, n = num * size, c, r; diff --git a/runtime/transport/utt.c b/runtime/transport/utt.c index 8ed84473..21d2ab8a 100644 --- a/runtime/transport/utt.c +++ b/runtime/transport/utt.c @@ -40,7 +40,7 @@ static int utt_overwrite_flag = 0; size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, size_t length) { - void *old, *new; + char *old, *new; size_t old_subbuf, new_subbuf; if (unlikely(buf == NULL)) @@ -69,7 +69,7 @@ size_t utt_switch_subbuf(struct utt_trace *utt, struct rchan_buf *buf, old = buf->data; new_subbuf = buf->subbufs_produced % buf->chan->n_subbufs; - new = buf->start + new_subbuf * buf->chan->subbuf_size; + new = (char*)buf->start + new_subbuf * buf->chan->subbuf_size; buf->offset = 0; if (!buf->chan->cb->subbuf_start(buf, new, old, buf->prev_padding)) { buf->offset = buf->chan->subbuf_size + 1; diff --git a/runtime/transport/utt.h b/runtime/transport/utt.h index fd704009..df225b3c 100644 --- a/runtime/transport/utt.h +++ b/runtime/transport/utt.h @@ -68,7 +68,7 @@ static inline void *utt_reserve(struct utt_trace *utt, size_t length) if (!length) return NULL; } - reserved = buf->data + buf->offset; + reserved = (char*)buf->data + buf->offset; buf->offset += length; return reserved; |