From owner-p4-projects@FreeBSD.ORG Wed Dec 19 03:24:30 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E76CC16A469; Wed, 19 Dec 2007 03:24:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BF0D16A41B for ; Wed, 19 Dec 2007 03:24:29 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4E813C4D5 for ; Wed, 19 Dec 2007 03:24:29 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBJ3OT5O008006 for ; Wed, 19 Dec 2007 03:24:29 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBJ3OTZl008003 for perforce@freebsd.org; Wed, 19 Dec 2007 03:24:29 GMT (envelope-from jb@freebsd.org) Date: Wed, 19 Dec 2007 03:24:29 GMT Message-Id: <200712190324.lBJ3OTZl008003@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 131207 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2007 03:24:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=131207 Change 131207 by jb@jb_freebsd1 on 2007/12/19 03:24:25 Rather than just accepting compiler warnings given that the code has been linted, let's just code it cleanly. This is necessary for FreeBSD/arm. gcc 4.2 gets stroppy if it thinks we're dereferencing pointers that aren't 32-bit aligned. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/dump/dump.c#9 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/dump/dump.c#9 (text) ==== @@ -203,9 +203,8 @@ static int print_labeltable(const ctf_header_t *hp, const ctf_data_t *cd) { - /* LINTED - pointer alignment */ - const ctf_lblent_t *ctl = (ctf_lblent_t *)(cd->cd_ctfdata + - hp->cth_lbloff); + void *v = (void *) (cd->cd_ctfdata + hp->cth_lbloff); + const ctf_lblent_t *ctl = v; ulong_t i, n = (hp->cth_objtoff - hp->cth_lbloff) / sizeof (*ctl); print_line("- Label Table "); @@ -267,8 +266,8 @@ static int read_data(const ctf_header_t *hp, const ctf_data_t *cd) { - /* LINTED - pointer alignment */ - const ushort_t *idp = (ushort_t *)(cd->cd_ctfdata + hp->cth_objtoff); + void *v = (void *) (cd->cd_ctfdata + hp->cth_objtoff); + const ushort_t *idp = v; ulong_t n = (hp->cth_funcoff - hp->cth_objtoff) / sizeof (ushort_t); if (flags != F_STATS) @@ -311,11 +310,11 @@ static int read_funcs(const ctf_header_t *hp, const ctf_data_t *cd) { - /* LINTED - pointer alignment */ - const ushort_t *fp = (ushort_t *)(cd->cd_ctfdata + hp->cth_funcoff); + void *v = (void *) (cd->cd_ctfdata + hp->cth_funcoff); + const ushort_t *fp = v; - /* LINTED - pointer alignment */ - const ushort_t *end = (ushort_t *)(cd->cd_ctfdata + hp->cth_typeoff); + v = (void *) (cd->cd_ctfdata + hp->cth_typeoff); + const ushort_t *end = v; ulong_t id; int symidx; @@ -388,11 +387,11 @@ static int read_types(const ctf_header_t *hp, const ctf_data_t *cd) { - /* LINTED - pointer alignment */ - const ctf_type_t *tp = (ctf_type_t *)(cd->cd_ctfdata + hp->cth_typeoff); + void *v = (void *) (cd->cd_ctfdata + hp->cth_typeoff); + const ctf_type_t *tp = v; - /* LINTED - pointer alignment */ - const ctf_type_t *end = (ctf_type_t *)(cd->cd_ctfdata + hp->cth_stroff); + v = (void *) (cd->cd_ctfdata + hp->cth_stroff); + const ctf_type_t *end = v; ulong_t id; @@ -930,15 +929,15 @@ if (cd.cd_ctflen < sizeof (ctf_preamble_t)) die("%s does not contain a CTF preamble\n", filename); - /* LINTED - pointer alignment */ - pp = (const ctf_preamble_t *)cd.cd_ctfdata; + void *v = (void *) cd.cd_ctfdata; + pp = v; if (pp->ctp_magic != CTF_MAGIC) die("%s does not appear to contain CTF data\n", filename); if (pp->ctp_version == CTF_VERSION) { - /* LINTED - pointer alignment */ - hp = (ctf_header_t *)cd.cd_ctfdata; + v = (void *) cd.cd_ctfdata; + hp = v; cd.cd_ctfdata = (caddr_t)cd.cd_ctfdata + sizeof (ctf_header_t); if (cd.cd_ctflen < sizeof (ctf_header_t)) {