Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] warning: long unsigned int format, time_t arg
@ 2003-09-21 17:59 Joel Soete
  2003-09-21 18:46 ` John David Anglin
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Soete @ 2003-09-21 17:59 UTC (permalink / raw)
  To: parisc-linux

Hi all,

during compiling 2.6.0-test5-pa6 with gcc-3.3, i noticed some warning of 
type:
[snip]
  CC      fs/exec.o
fs/exec.c: In function `format_corename':
fs/exec.c:1219: warning: long unsigned int format, time_t arg (arg 4)
[snip]

for which I would suggest the following patch:
hpalin:/Debian-apt/SRC/linux-2.6.0-test5-pa6/fs# diff -Nau exec.c.Orig 
exec.c.new
--- exec.c.Orig    2003-09-10 18:18:40.000000000 +0200
+++ exec.c.new    2003-09-16 23:55:12.000000000 +0200
@@ -1216,7 +1216,7 @@
                 struct timeval tv;
                 do_gettimeofday(&tv);
                 rc = snprintf(out_ptr, out_end - out_ptr,
-                          "%lu", tv.tv_sec);
+                          "%lu", (unsigned long int)tv.tv_sec);
                 if (rc > out_end - out_ptr)
                     goto out;
                 out_ptr += rc;

I would like your opinion before submiting (hmm to Andrew I presume?)

Thanks in advance,
    Joel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] warning: long unsigned int format, time_t arg
  2003-09-21 17:59 [parisc-linux] warning: long unsigned int format, time_t arg Joel Soete
@ 2003-09-21 18:46 ` John David Anglin
  2003-09-21 19:04   ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: John David Anglin @ 2003-09-21 18:46 UTC (permalink / raw)
  To: Joel Soete; +Cc: parisc-linux

>                  rc = snprintf(out_ptr, out_end - out_ptr,
> -                          "%lu", tv.tv_sec);
> +                          "%lu", (unsigned long int)tv.tv_sec);

This looks ok to me, although you don't need the extra "int".

I noticed in include/asm-parisc/posix_types.h we have:

/* Note these change from narrow to wide kernels */
#ifdef __LP64__
typedef unsigned long           __kernel_size_t;
typedef long                    __kernel_ssize_t;
typedef long                    __kernel_ptrdiff_t;
typedef long                    __kernel_time_t;
#else
typedef unsigned int            __kernel_size_t;
typedef int                     __kernel_ssize_t;
typedef int                     __kernel_ptrdiff_t;
typedef int                     __kernel_time_t;
#endif

On narrow kernels, int and long are the same.  So, why not use long
for both narrow and wide?  Then, the ifdef can be eliminated.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] warning: long unsigned int format, time_t arg
  2003-09-21 18:46 ` John David Anglin
@ 2003-09-21 19:04   ` Matthew Wilcox
  2003-09-21 19:16     ` John David Anglin
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2003-09-21 19:04 UTC (permalink / raw)
  To: John David Anglin; +Cc: Joel Soete, parisc-linux

On Sun, Sep 21, 2003 at 02:46:20PM -0400, John David Anglin wrote:
> >                  rc = snprintf(out_ptr, out_end - out_ptr,
> > -                          "%lu", tv.tv_sec);
> > +                          "%lu", (unsigned long int)tv.tv_sec);
> 
> This looks ok to me, although you don't need the extra "int".

I'd rather not add these.  They are only warnings, after all.

> I noticed in include/asm-parisc/posix_types.h we have:
> 
> /* Note these change from narrow to wide kernels */
> #ifdef __LP64__
> typedef unsigned long           __kernel_size_t;
> typedef long                    __kernel_ssize_t;
> typedef long                    __kernel_ptrdiff_t;
> typedef long                    __kernel_time_t;
> #else
> typedef unsigned int            __kernel_size_t;
> typedef int                     __kernel_ssize_t;
> typedef int                     __kernel_ptrdiff_t;
> typedef int                     __kernel_time_t;
> #endif
> 
> On narrow kernels, int and long are the same.  So, why not use long
> for both narrow and wide?  Then, the ifdef can be eliminated.

I think it's because gcc complains ;-)

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] warning: long unsigned int format, time_t arg
  2003-09-21 19:04   ` Matthew Wilcox
@ 2003-09-21 19:16     ` John David Anglin
  2003-09-21 19:32       ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: John David Anglin @ 2003-09-21 19:16 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: soete.joel, parisc-linux

> > /* Note these change from narrow to wide kernels */
> > #ifdef __LP64__
> > typedef unsigned long           __kernel_size_t;
> > typedef long                    __kernel_ssize_t;
> > typedef long                    __kernel_ptrdiff_t;
> > typedef long                    __kernel_time_t;
> > #else
> > typedef unsigned int            __kernel_size_t;
> > typedef int                     __kernel_ssize_t;
> > typedef int                     __kernel_ptrdiff_t;
> > typedef int                     __kernel_time_t;
> > #endif
> > 
> > On narrow kernels, int and long are the same.  So, why not use long
> > for both narrow and wide?  Then, the ifdef can be eliminated.
> 
> I think it's because gcc complains ;-)

Possibly, but the pa seems to be about the only port doing this.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] warning: long unsigned int format, time_t arg
  2003-09-21 19:16     ` John David Anglin
@ 2003-09-21 19:32       ` Matthew Wilcox
  2003-09-22  6:48         ` Jan-Benedict Glaw
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2003-09-21 19:32 UTC (permalink / raw)
  To: John David Anglin; +Cc: Matthew Wilcox, soete.joel, parisc-linux

On Sun, Sep 21, 2003 at 03:16:23PM -0400, John David Anglin wrote:
> > > /* Note these change from narrow to wide kernels */
> > > #ifdef __LP64__
> > > typedef unsigned long           __kernel_size_t;
> > > typedef long                    __kernel_ssize_t;
> > > typedef long                    __kernel_ptrdiff_t;
> > > typedef long                    __kernel_time_t;
> > > #else
> > > typedef unsigned int            __kernel_size_t;
> > > typedef int                     __kernel_ssize_t;
> > > typedef int                     __kernel_ptrdiff_t;
> > > typedef int                     __kernel_time_t;
> > > #endif
> > > 
> > > On narrow kernels, int and long are the same.  So, why not use long
> > > for both narrow and wide?  Then, the ifdef can be eliminated.
> > 
> > I think it's because gcc complains ;-)
> 
> Possibly, but the pa seems to be about the only port doing this.

We're one of the few ports that builds both 32 and 64 bits from the same
port (actually, we were the first).  MIPS recently converted, and S390
before them.  PPC might in the future, and I doubt Sparc ever will.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] warning: long unsigned int format, time_t arg
  2003-09-21 19:32       ` Matthew Wilcox
@ 2003-09-22  6:48         ` Jan-Benedict Glaw
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2003-09-22  6:48 UTC (permalink / raw)
  To: parisc-linux

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

On Sun, 2003-09-21 20:32:29 +0100, Matthew Wilcox <willy@debian.org>
wrote in message <20030921193229.GJ13172@parcelfarce.linux.theplanet.co.uk>:
> On Sun, Sep 21, 2003 at 03:16:23PM -0400, John David Anglin wrote:
> > Possibly, but the pa seems to be about the only port doing this.
> 
> We're one of the few ports that builds both 32 and 64 bits from the same
> port (actually, we were the first).  MIPS recently converted, and S390
> before them.  PPC might in the future, and I doubt Sparc ever will.

Sparc won't go there - sparc32 and ultra-sparc are really two different
things...

MfG, JBG

-- 
   Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-09-22  6:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 17:59 [parisc-linux] warning: long unsigned int format, time_t arg Joel Soete
2003-09-21 18:46 ` John David Anglin
2003-09-21 19:04   ` Matthew Wilcox
2003-09-21 19:16     ` John David Anglin
2003-09-21 19:32       ` Matthew Wilcox
2003-09-22  6:48         ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox