From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 16:10:08 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CB9510656B6; Mon, 20 Sep 2010 16:10:08 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout030.mac.com (asmtpout030.mac.com [17.148.16.105]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8AD8FC16; Mon, 20 Sep 2010 16:10:08 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp030.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0L9100LRWZK8CX00@asmtp030.mac.com>; Mon, 20 Sep 2010 09:09:45 -0700 (PDT) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1004200000 definitions=main-1009200075 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.0.10011,1.0.148,0.0.0000 definitions=2010-09-20_11:2010-09-20, 2010-09-20, 1970-01-01 signatures=0 From: Marcel Moolenaar In-reply-to: <20100920163758.A788@besplex.bde.org> Date: Mon, 20 Sep 2010 09:09:43 -0700 Message-id: <11C42F9D-7201-4804-8923-430F28E58C57@mac.com> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , src-committers@FreeBSD.org Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 16:10:08 -0000 On Sep 19, 2010, at 11:55 PM, Bruce Evans wrote: > On Mon, 20 Sep 2010, Marcel Moolenaar wrote: > >> Log: >> Unbreak the build on strong-aligned architectures (arm, ia64). >> Casting from (char *) to (struct ufs1_dinode *) changes the >> alignment requirement of the pointer and GCC does not know that >> the pointer is adequately aligned (due to malloc(3)), and warns >> about it. Cast to (void *) first to by-pass the check. > > A previous version in which the pointer (iobuf) the correct type to > begin with was better. It used to have type void *, but now has type > caddr_t (whose existence is a bug), in order to abuse caddr_t by > assuming that it is char * to do pointer arithmetic on it in 1 place > (iobuf + sblock.fs_cgsize). The 7 other places where iobuf is used > only assume that caddr_t is a pointer (or perhaps a [u]intptr_t). > > growfs has no other instances of caddr_t. My first instinct was to retype iobuf as (void *), but saw the pointer arithmetic and decided against it. If we had a macro that one can use to add X number of bytes to a pointer to any, I would have used that. Other macros to add X number of short, int, long, could be handy too, but that may not be as useful as for bytes. Would it be useful to add a macro like (don't mind the name): #define ADDBYTESTOPOINTER(ptr, cnt) \ ((__typeof(ptr))(void *)((uintptr_t)(void *)(ptr) + (cnt))) ? -- Marcel Moolenaar xcllnt@mac.com