warning: long unsigned int format, time_t arg
Hi all,
during compiling 2.6.0-test5-pa6 with gcc-3.3, i noticed some warning of type:
[snip]
CC fs/exec.ofs/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
Review
Quoted 3 lines
rc = snprintf(out_ptr,
out_end-out_ptr,(quoted diff) +1
-1- "%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
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Quoted 5 lines · John David Anglin
Review
Quoted 3 lines
rc = snprintf(out_ptr,
out_end-out_ptr,(quoted diff) +1
-1- "%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.
Quoted 13 lines
I noticed in
include/asm-parisc/posix_types.hwe 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;
Quoted 4 lines
#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 ;-)
Signature · 3 lines
"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
Quoted 13 lines
Quoted 13 lines
/* 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
Quoted 4 lines
Quoted 2 lines
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
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Quoted 13 lines · John David Anglin
Quoted 13 lines
Quoted 13 lines
/* 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
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
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.
Signature · 3 lines
"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
On Sun, 2003-09-21 20:32:29 +0100, Matthew Wilcox <[email protected]> wrote in message <[email protected]>:
Quoted 6 lines · John David Anglin
Quoted 1 line
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
Signature · 4 lines
Jan-Benedict Glaw [email protected] . +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));