From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8708 invoked by alias); 10 Apr 2012 15:10:44 -0000 Received: (qmail 8699 invoked by uid 22791); 10 Apr 2012 15:10:42 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,TW_BT,TW_DB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.datasphere.ch (HELO mail.datasphere.ch) (195.70.3.149) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Apr 2012 15:10:20 +0000 Received: from dataspheresrv01.datasphere.ch ([195.70.3.151]) by mail.datasphere.ch (8.14.4/8.14.4) with ESMTP id q3AFADmY001337 for ; Tue, 10 Apr 2012 17:10:18 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] print format does not match argument type Date: Tue, 10 Apr 2012 15:10:00 -0000 Message-ID: In-Reply-To: <4F8443D1.9080105@onevision.com> References: <4F8443D1.9080105@onevision.com> From: "Patrick Monnerat" To: X-IsSubscribed: yes Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org X-SW-Source: 2012-q2/txt/msg00005.txt.bz2 =20 Roland Schwingel wrote: Hi Roland, Thanks for having paid attention to my report. > Which warnings do you get on which platform? Running on a Fedora Linux 64bit, but building for a 32bit (using mock). Thus this is a 32bit build on a (emulated) 32bit machine. When compiling with the default fedora rpm build flags, the following occurs: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=3D2 -fexceptions -fstack-protector --param=3Dssp-buffer-size=3D4 -m32 -march=3Di686 -mtune= =3Datom -fasynchronous-unwind-tables -I. -I. -I./common -I./config -DLOCALEDIR=3D"\"/usr/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./gnulib -Ignulib -DTUI=3D1 -DGDBTK -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Werror -c -o gdbtk-register.o -MT gdbtk-register.o -MMD -MP -MF .deps/gdbtk-register.Tpo -I./../libgui/src -I/usr/include -I/usr/include/tcl-private/generic -I/usr/include -I/usr/include/tk-private/generic -DGDBTK_LIBRARY=3D\"/usr/share/insight\" -DSRC_DIR=3D\"/builddir/build/BUILD/insight-7.4.50/gdb\" ./gdbtk/generic/gdbtk-register.c cc1: warnings being treated as errors ./gdbtk/generic/gdbtk-register.c: In function 'get_register_types': ./gdbtk/generic/gdbtk-register.c:242:4: error: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned int' ./gdbtk/generic/gdbtk-register.c:258:7: error: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned int' I don't know how W$ works, but in any case, "%lx" targets an unsigned long, whatever its real size is. The patch I've provided retains the conversion to size_t (for eventual truncation reasons), but finally converts the value to the type expected by the format. If the solution I provide is not OK on some platform, then a conditionally defined print format should be used, IMHO... Cheers, Patrick