public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: "Patrick Monnerat" <Patrick.Monnerat@datasphere.ch>
To: <insight@sourceware.org>
Subject: RE: [PATCH] print format does not match argument type
Date: Tue, 10 Apr 2012 15:10:00 -0000	[thread overview]
Message-ID: <AB5E58B87EB73C46A38073D8F459F113D9F885@dataspheresrv01> (raw)
In-Reply-To: <4F8443D1.9080105@onevision.com>

 
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=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
-fasynchronous-unwind-tables   -I. -I. -I./common -I./config
-DLOCALEDIR="\"/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=1 -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=\"/usr/share/insight\"
-DSRC_DIR=\"/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

  reply	other threads:[~2012-04-10 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 14:30 Roland Schwingel
2012-04-10 15:10 ` Patrick Monnerat [this message]
2012-04-10 16:08 ` Patrick Monnerat
2012-04-10 16:28   ` Keith Seitz
2012-04-13 14:52     ` Pierre Muller
2012-04-13 15:18       ` Keith Seitz
2012-04-13 15:25         ` Pierre Muller
  -- strict thread matches above, loose matches on Subject: below --
2012-04-11 11:38 Roland Schwingel
2012-04-11 17:24 ` Patrick Monnerat
2012-04-10 16:59 Roland Schwingel
2012-04-05 16:34 Patrick Monnerat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AB5E58B87EB73C46A38073D8F459F113D9F885@dataspheresrv01 \
    --to=patrick.monnerat@datasphere.ch \
    --cc=insight@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).