From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 5 14:38:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 2C815106566C; Mon, 5 Dec 2011 14:38:15 +0000 (UTC) Date: Mon, 5 Dec 2011 14:38:15 +0000 From: Alexander Best To: Sergey Kandaurov Message-ID: <20111205143815.GA34379@freebsd.org> References: <20111204222203.GA8898@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Cc: freebsd-hackers@freebsd.org Subject: Re: strange printf(9) format specifier ("Z") in dev/drm code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 14:38:15 -0000 --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon Dec 5 11, Sergey Kandaurov wrote: > On 5 December 2011 02:22, Alexander Best wrote: > > hi there, > > > > i was going through the clang warnings from a GENERIC buildkernel and noticed > > the following: > > > > ===> drm/mga (all) > > /usr/subversion-src/sys/modules/drm/mga/../../../dev/drm/mga_state.c:56:2: error: invalid conversion specifier 'Z' [-Werror,-Wformat-invalid-specifier] > >        BEGIN_DMA(2); > >        ^~~~~~~~~~~ > > @/dev/drm/mga_drv.h:291:35: note: expanded from: > >                DRM_INFO( "   space=0x%x req=0x%Zx\n",                  \ > >                                                ^ > > @/dev/drm/drmP.h:317:60: note: expanded from: > > #define DRM_INFO(fmt, ...)  printf("info: [" DRM_NAME "] " fmt , ##__VA_ARGS__) > >                                                           ^ > > these lines should cover all warnings: > > > > otaku% egrep -r "%[0-9]*Zx" /usr/src/sys/dev/drm > > dev/drm/mga_drv.h:              DRM_INFO( "   space=0x%x req=0x%Zx\n",                  \ > > dev/drm/mga_drv.h:              DRM_INFO( "   DMA_WRITE( 0x%08x ) at 0x%04Zx\n",        \ > > > > ... i couldn't find a reference to an upercase "Z" in the printf(9) man page. > > i talked to dinoex on #freebsd-clang (EFNet) and he said that the "Z" might > > come from linux'es libc5 and is the equaivalent to glibc's "z". > > > > can we adjust those lines, so the clang warnings disappear? > > Hi, Alexander. > > Can you build-test with this change? > Thanks in advance. no that didn't work, but the following patch fixed it for me. cheers. alex > > Index: sys/dev/drm/mga_drv.h > =================================================================== > --- sys/dev/drm/mga_drv.h (revision 228276) > +++ sys/dev/drm/mga_drv.h (working copy) > @@ -288,7 +288,7 @@ > do { \ > if ( MGA_VERBOSE ) { \ > DRM_INFO( "BEGIN_DMA( %d )\n", (n) ); \ > - DRM_INFO( " space=0x%x req=0x%Zx\n", \ > + DRM_INFO( " space=0x%x req=0x%x\n", \ > dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ > } \ > prim = dev_priv->prim.start; \ > @@ -338,7 +338,7 @@ > #define DMA_WRITE( offset, val ) \ > do { \ > if ( MGA_VERBOSE ) { \ > - DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04Zx\n", \ > + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ > (u32)(val), write + (offset) * sizeof(u32) ); \ > } \ > *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ > > -- > wbr, > pluknet --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mga_drv.h.diff" Index: sys/dev/drm/mga_drv.h =================================================================== --- sys/dev/drm/mga_drv.h (revision 228276) +++ sys/dev/drm/mga_drv.h (working copy) @@ -288,7 +288,7 @@ do { \ if ( MGA_VERBOSE ) { \ DRM_INFO( "BEGIN_DMA( %d )\n", (n) ); \ - DRM_INFO( " space=0x%x req=0x%Zx\n", \ + DRM_INFO( " space=0x%x req=0x%lx\n", \ dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ } \ prim = dev_priv->prim.start; \ @@ -338,7 +338,7 @@ #define DMA_WRITE( offset, val ) \ do { \ if ( MGA_VERBOSE ) { \ - DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04Zx\n", \ + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04lx\n", \ (u32)(val), write + (offset) * sizeof(u32) ); \ } \ *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ --tKW2IUtsqtDRztdT--