From owner-svn-src-projects@FreeBSD.ORG Tue May 14 20:17:58 2013 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by hub.freebsd.org (Postfix) with ESMTP id 27D58690; Tue, 14 May 2013 20:17:58 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Message-ID: <51929B2B.4040206@FreeBSD.org> Date: Tue, 14 May 2013 16:14:35 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 MIME-Version: 1.0 To: Juli Mallett Subject: Re: svn commit: r250638 - in projects/flex-sf: contrib/flex usr.bin/lex/lib References: <201305141916.r4EJGs2Y056601@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 May 2013 20:17:58 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-05-14 16:04:57 -0400, Juli Mallett wrote: > On Tue, May 14, 2013 at 12:16 PM, Jung-uk Kim > wrote: >> Log: Fix build with GCC. Modified: >> projects/flex-sf/contrib/flex/scanflags.c >> ============================================================================== >> >> - --- projects/flex-sf/contrib/flex/scanflags.c Tue May 14 17:32:13 2013 (r250637) >> +++ projects/flex-sf/contrib/flex/scanflags.c Tue May 14 >> 19:16:54 2013 (r250638) @@ -62,7 +62,7 @@ sf_init (void) >> _sf_stk = (scanflags_t*) flex_alloc ( sizeof(scanflags_t) * >> (_sf_max = 32)); if (!_sf_stk) lerrsf_fatal(_("Unable to allocate >> %ld of stack"), - (long)sizeof(scanflags_t)); + >> (void *)(uintptr_t)sizeof(scanflags_t)); _sf_stk[_sf_top_ix] = >> 0; } > > This looks pretty strange. Moreover, it's not clear to me what > the benefit is of showing the sizeof scanflags_t, which isn't the > amount attempting to be allocated anyway, it's sizeof scanflags_t * > 32, right? (The assignment in the multiplication in the allocation > is pretty shady, too.) Yeah, it is ugly but it is much simpler than DragonFlyBSD's fix: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/655ed7a0#patch8 > But really, why does %ld expect a pointer? Is lerrsf_fatal some > esoteric thing that doesn't take varargs or use normal format > strings? If not, just use %zu and get rid of the cast > rollercoaster? The pointer cast is pretty astonishingly-odd > anyway. The lerrsf_fatal() is not printf-like and it only takes char[], i.e., lerrsf_fatal(char *, char[]). It is ugly but I didn't want to break other uses. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJRkpsrAAoJECXpabHZMqHO95sH/RjBkzRJyarPqzaKj/Q6ohdi Iz0q+GPiaOesxfefUkasMQ7VX9ek9JITvYADdodwm9/ch+uo6H5Xcup0GCVGsQIx Qiz1G24gqxA/uSaBVXp6VD27oZ6/fM6v/ixM/ePAHYhnOJXbwGI9VRyeT6p9U9Rw HPqJkG6GlI4JsH9Rl2drrQGIkonjfvEF3yDAZChY6Yq1wiFDvqmxr7jH5emY9u/u agKAu5ShggFn72tDUAMD7j7ia3pKSi7IGO3F390ZnTeNVIeyJ6Ke6N3Qx6EVOZsx ekKZ2xGYFMFDicTkQPmUfDG0QqNMbYa03nFv7rfNogmBlqw4k/17w8Lk46HIdgY= =HdpV -----END PGP SIGNATURE-----