Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2007 03:28:34 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 131210 for review
Message-ID:  <200712190328.lBJ3SYp3008244@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=131210

Change 131210 by jb@jb_freebsd1 on 2007/12/19 03:28:17

	Fix more pointer alignment warnings.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/ctf.c#12 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/ctf.c#12 (text) ====

@@ -661,8 +661,8 @@
 
 	dptr = data + h->cth_typeoff;
 	while (dptr < data + h->cth_stroff) {
-		/* LINTED - pointer alignment */
-		ctf_type_t *ctt = (ctf_type_t *)dptr;
+		void *v = (void *) dptr;
+		ctf_type_t *ctt = v;
 		size_t vlen = CTF_INFO_VLEN(ctt->ctt_info);
 		size_t size, increment;
 
@@ -733,9 +733,9 @@
 	int lastidx = 0, baseidx = -1;
 	char *baselabel = NULL;
 	ctf_lblent_t *ctl;
+	void *v = (void *) buf;
 
-	/* LINTED - pointer alignment */
-	for (ctl = (ctf_lblent_t *)buf; (caddr_t)ctl < buf + bufsz; ctl++) {
+	for (ctl = v; (caddr_t)ctl < buf + bufsz; ctl++) {
 		char *label = sbuf + ctl->ctl_label;
 
 		lastidx = ctl->ctl_typeidx;
@@ -779,8 +779,8 @@
 
 	symit_reset(si);
 	for (dptr = buf; dptr < buf + bufsz; dptr += 2) {
-		/* LINTED - pointer alignment */
-		ushort_t id = *((ushort_t *)dptr);
+		void *v = (void *) dptr;
+		ushort_t id = *((ushort_t *)v);
 		iidesc_t *ii;
 		GElf_Sym *sym;
 
@@ -827,8 +827,8 @@
 
 	symit_reset(si);
 	while (dptr < buf + bufsz) {
-		/* LINTED - pointer alignment */
-		info = *((ushort_t *)dptr);
+		void *v = (void *) dptr;
+		info = *((ushort_t *)v);
 		dptr += 2;
 
 		if (!(sym = symit_next(si, STT_FUNC)) && info != 0)
@@ -840,8 +840,8 @@
 			continue;
 		}
 
-		/* LINTED - pointer alignment */
-		retid = *((ushort_t *)dptr);
+		v = (void *) dptr;
+		retid = *((ushort_t *)v);
 		dptr += 2;
 
 		if (retid >= tdsize)
@@ -860,8 +860,8 @@
 			    xmalloc(sizeof (tdesc_t *) * ii->ii_nargs);
 
 		for (i = 0; i < ii->ii_nargs; i++, dptr += 2) {
-			/* LINTED - pointer alignment */
-			ushort_t id = *((ushort_t *)dptr);
+			v = (void *) dptr;
+			ushort_t id = *((ushort_t *)v);
 			if (id >= tdsize)
 				parseterminate("Reference to invalid type %d",
 				    id);
@@ -921,8 +921,8 @@
 		if (tid >= tdsize)
 			parseterminate("Reference to invalid type %d", tid);
 
-		/* LINTED - pointer alignment */
-		ctt = (ctf_type_t *)dptr;
+		void *v = (void *) dptr;
+		ctt = v;
 
 		get_ctt_size(ctt, &size, &increment);
 		dptr += increment;
@@ -946,8 +946,8 @@
 			tdp->t_type = INTRINSIC;
 			tdp->t_size = size;
 
-			/* LINTED - pointer alignment */
-			data = *((uint_t *)dptr);
+			v = (void *) dptr;
+			data = *((uint_t *)v);
 			dptr += sizeof (uint_t);
 			encoding = CTF_INT_ENCODING(data);
 
@@ -973,8 +973,8 @@
 			tdp->t_type = INTRINSIC;
 			tdp->t_size = size;
 
-			/* LINTED - pointer alignment */
-			data = *((uint_t *)dptr);
+			v = (void *) dptr;
+			data = *((uint_t *)v);
 			dptr += sizeof (uint_t);
 
 			ip = xcalloc(sizeof (intr_t));
@@ -994,8 +994,8 @@
 			tdp->t_type = ARRAY;
 			tdp->t_size = size;
 
-			/* LINTED - pointer alignment */
-			cta = (ctf_array_t *)dptr;
+			v = (void *) dptr;
+			cta = v;
 			dptr += sizeof (ctf_array_t);
 
 			tdp->t_ardef = xmalloc(sizeof (ardef_t));
@@ -1012,9 +1012,8 @@
 			if (size < CTF_LSTRUCT_THRESH) {
 				for (i = 0, mpp = &tdp->t_members; i < vlen;
 				    i++, mpp = &((*mpp)->ml_next)) {
-					/* LINTED - pointer alignment */
-					ctf_member_t *ctm = (ctf_member_t *)
-					    dptr;
+					v = (void *) dptr;
+					ctf_member_t *ctm = v;
 					dptr += sizeof (ctf_member_t);
 
 					*mpp = xmalloc(sizeof (mlist_t));
@@ -1027,9 +1026,8 @@
 			} else {
 				for (i = 0, mpp = &tdp->t_members; i < vlen;
 				    i++, mpp = &((*mpp)->ml_next)) {
-					/* LINTED - pointer alignment */
-					ctf_lmember_t *ctlm = (ctf_lmember_t *)
-					    dptr;
+					v = (void *) dptr;
+					ctf_lmember_t *ctlm = v;
 					dptr += sizeof (ctf_lmember_t);
 
 					*mpp = xmalloc(sizeof (mlist_t));
@@ -1052,8 +1050,8 @@
 
 			for (i = 0, epp = &tdp->t_emem; i < vlen;
 			    i++, epp = &((*epp)->el_next)) {
-				/* LINTED - pointer alignment */
-				cte = (ctf_enum_t *)dptr;
+				v = (void *) dptr;
+				cte = v;
 				dptr += sizeof (ctf_enum_t);
 
 				*epp = xmalloc(sizeof (elist_t));
@@ -1088,9 +1086,8 @@
 			tdp->t_fndef = xcalloc(sizeof (fndef_t));
 			tdp->t_fndef->fn_ret = tdarr[ctt->ctt_type];
 
-			/* LINTED - pointer alignment */
-			if (vlen > 0 && *(ushort_t *)(dptr +
-			    (sizeof (ushort_t) * (vlen - 1))) == 0)
+			v = (void *) (dptr + (sizeof (ushort_t) * (vlen - 1)));
+			if (vlen > 0 && *(ushort_t *)v == 0)
 				tdp->t_fndef->fn_vargs = 1;
 
 			tdp->t_fndef->fn_nargs = vlen - tdp->t_fndef->fn_vargs;
@@ -1098,8 +1095,8 @@
 			    vlen - tdp->t_fndef->fn_vargs);
 
 			for (i = 0; i < vlen; i++) {
-				/* LINTED - pointer alignment */
-				argid = *(ushort_t *)dptr;
+				v = (void *) dptr;
+				argid = *(ushort_t *)v;
 				dptr += sizeof (ushort_t);
 
 				if (argid != 0)
@@ -1229,8 +1226,8 @@
 	if (bufsz < sizeof (ctf_header_t))
 		parseterminate("Corrupt CTF - short header");
 
-	/* LINTED - pointer alignment */
-	h = (ctf_header_t *)buf;
+	void *v = (void *) buf;
+	h = v;
 	buf += sizeof (ctf_header_t);
 	bufsz -= sizeof (ctf_header_t);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712190328.lBJ3SYp3008244>