Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Dec 2011 16:16:15 +0300
From:      Sergey Kandaurov <pluknet@freebsd.org>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: strange printf(9) format specifier ("Z") in dev/drm code
Message-ID:  <CAE-mSOJEwc9ESmCeOpiCujenuPAZfLjPi4sAJ7aJYOz4_XEkAQ@mail.gmail.com>
In-Reply-To: <20111204222203.GA8898@freebsd.org>
References:  <20111204222203.GA8898@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 December 2011 02:22, Alexander Best <arundel@freebsd.org> wrote:
> hi there,
>
> i was going through the clang warnings from a GENERIC buildkernel and not=
iced
> the following:
>
> =3D=3D=3D> 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-specifi=
er]
> =A0 =A0 =A0 =A0BEGIN_DMA(2);
> =A0 =A0 =A0 =A0^~~~~~~~~~~
> @/dev/drm/mga_drv.h:291:35: note: expanded from:
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DRM_INFO( " =A0 space=3D0x%x req=3D0x%Zx\n=
", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0^
> @/dev/drm/drmP.h:317:60: note: expanded from:
> #define DRM_INFO(fmt, ...) =A0printf("info: [" DRM_NAME "] " fmt , ##__VA=
_ARGS__)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^
> these lines should cover all warnings:
>
> otaku% egrep -r "%[0-9]*Zx" /usr/src/sys/dev/drm
> dev/drm/mga_drv.h: =A0 =A0 =A0 =A0 =A0 =A0 =A0DRM_INFO( " =A0 space=3D0x%=
x req=3D0x%Zx\n", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\
> dev/drm/mga_drv.h: =A0 =A0 =A0 =A0 =A0 =A0 =A0DRM_INFO( " =A0 DMA_WRITE( =
0x%08x ) at 0x%04Zx\n", =A0 =A0 =A0 =A0\
>
> ... i couldn't find a reference to an upercase "Z" in the printf(9) man p=
age.
> i talked to dinoex on #freebsd-clang (EFNet) and he said that the "Z" mig=
ht
> 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.

Index: sys/dev/drm/mga_drv.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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=3D0x%x req=3D0x%Zx\n",                 =
 \
+               DRM_INFO( "   space=3D0x%x req=3D0x%x\n",                  =
 \
                          dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \
        }                                                               \
        prim =3D 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)) =3D val; \

--=20
wbr,
pluknet



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