This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] readline/util.c: use '%d' instead of 'ld' to avoid compiling warning
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: jan dot kratochvil at redhat dot com, drow at false dot org, ezannoni at kwikemart dot cygnus dot com, brobecker at gnat dot com, muller at sourceware dot org, palves at redhat dot com, nickc at redhat dot com, macro at linux-mips dot org, binutils at sourceware dot org
- Date: Fri, 30 May 2014 10:50:31 +0800
- Subject: Re: [PATCH] readline/util.c: use '%d' instead of 'ld' to avoid compiling warning
- Authentication-results: sourceware.org; auth=none
- References: <5387CCBD dot 7070203 at gmail dot com> <20140530021507 dot GT6679 at bubble dot grove dot modra dot org>
On 05/30/2014 10:15 AM, Alan Modra wrote:
> On Fri, May 30, 2014 at 08:11:41AM +0800, Chen Gang wrote:
>> getpid() will return 'pid_t' which is always 'int', so need use '%d'
>> instead of '%ld' in sprintf().
>
> Please do not copy many lists and/or maintainers. This patch should
> have gone just to gdb-patches@sourceware.org, since readline belongs
> to the gdb project.
>
> Also, gdb and binutils generally require patches to be supplied with a
> ChangeLog entry. See other posts on the mailing list.
>
OK, thanks.
If we have a tool to tell members (especially new members) the related
mailing addresses (e.g. "scripts/get_maintainer.pl" under Linux kernel
and/or Qemu), that will be cool!
> Now, on to the substance of your patch. It's wrong to claim that
> "pid_t" is always "int". I know of systems that use or used to use
> "short". In fact
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
> says
>
> "The implementation shall support one or more programming environments
> in which the widths of blksize_t, pid_t, size_t, ssize_t, and
> suseconds_t are no greater than the width of type long."
>
> So the correct patch would be to cast the return of getpid() to long,
> continuing to use '%ld' in the format string.
>
That sounds fine to me.
Please help integrate it into mainline. If need me send patch v2, please
let me know (no reply means "will integrate the correct fix into
mainline by maintainers directly").
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed