public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: "Patrick Monnerat" <Patrick.Monnerat@datasphere.ch>
To: <insight@sourceware.org>
Subject: [PATCH] print format does not match argument type
Date: Thu, 05 Apr 2012 16:34:00 -0000	[thread overview]
Message-ID: <AB5E58B87EB73C46A38073D8F459F113D9F883@dataspheresrv01> (raw)

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

In gdb/gdbtk/generic/gdbtk-register.c, 2 statements try to use a print
format of "%lx" for a size_t argument. The correctness of such
statements is architecture dependent. If warnings are treated as errors,
the compilation fails.
 
The attached patch fixes these statements by unconditionally converting
the size_t argument to an unsigned long.
 
Cheers,
Patrick

[-- Attachment #2: insight-7.4.50-sizesizet.patch --]
[-- Type: application/octet-stream, Size: 1072 bytes --]

diff -Naur insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-register.c insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-register.c
--- insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-register.c	2012-03-30 09:36:10.000000000 +0200
+++ insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-register.c	2012-04-05 18:03:20.875181085 +0200
@@ -239,7 +239,8 @@
 	{
 	  Tcl_Obj *ar[3], *list;
 	  char *buff;
-	  buff = xstrprintf ("%lx", (size_t)TYPE_FIELD_TYPE (reg_vtype, i));
+	  buff = xstrprintf ("%lx", (unsigned long)
+				    (size_t)TYPE_FIELD_TYPE (reg_vtype, i));
 	  ar[0] = Tcl_NewStringObj (TYPE_FIELD_NAME (reg_vtype, i), -1);
 	  ar[1] = Tcl_NewStringObj (buff, -1);
 	  if (TYPE_CODE (TYPE_FIELD_TYPE (reg_vtype, i)) == TYPE_CODE_FLT)
@@ -255,7 +256,7 @@
     {
       Tcl_Obj *ar[3], *list;
       char *buff;
-      buff = xstrprintf ("%lx", (size_t)reg_vtype);
+      buff = xstrprintf ("%lx", (unsigned long)(size_t)reg_vtype);
       ar[0] = Tcl_NewStringObj (TYPE_NAME(reg_vtype), -1);
       ar[1] = Tcl_NewStringObj (buff, -1);
       if (TYPE_CODE (reg_vtype) == TYPE_CODE_FLT)

             reply	other threads:[~2012-04-05 16:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 16:34 Patrick Monnerat [this message]
2012-04-10 14:30 Roland Schwingel
2012-04-10 15:10 ` Patrick Monnerat
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
2012-04-10 16:59 Roland Schwingel
2012-04-11 11:38 Roland Schwingel
2012-04-11 17:24 ` 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=AB5E58B87EB73C46A38073D8F459F113D9F883@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).