This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patchv3 1/8] Move utility functions to common/
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Aleksandar Ristovski <ARistovski at qnx dot com>
- Date: Fri, 28 Feb 2014 22:33:05 +0100
- Subject: Re: [patchv3 1/8] Move utility functions to common/
- Authentication-results: sourceware.org; auth=none
- References: <20140227213242 dot GB21121 at host2 dot jankratochvil dot net> <53107BBE dot 6040407 at redhat dot com> <20140228201055 dot GA21879 at host2 dot jankratochvil dot net> <5310FB60 dot 9030105 at redhat dot com>
On Fri, 28 Feb 2014 22:10:56 +0100, Pedro Alves wrote:
> There are gdb ports out there with TARGET_CHAR_BIT != 8.
OK. They do not have to be C90/C99/POSIX.
> We don't have any in the tree currently, but I believe most of the code we
> have actually works. I wouldn't have a problem with accepting such a port.
The problem is you have not accepted such a port. And there is (probably
unwritten) rule that any GDB code not required by current codebase can be
removed. With a versioning system any code can be easily returned back later.
> > already C90 defines CHAR_BIT as constant 8.
>
> Sorry, but that's not true. I'm looking at N1256 (C99/TC3 draft),
> and in 5.2.4.2.1, it shows:
>
> #define CHAR_BIT 8
>
> _but_, it also says just above:
>
> "The minimum magnitudes shown shall be replaced by implementation-defined
> magnitudes with the same sign."
>
> So that means it must be _at least_ 8-bit, but it also be wider than 8.
It may be true but I am not completely sure with it. The whole paragraph is:
Moreover, except for CHAR_BIT and MB_LEN_MAX, the following shall be
replaced by expressions that have the same type as would an expression
that is an object of the corresponding type converted according to the
integer promotions. Their implementation-defined values shall be equal
or greater in magnitude (absolute value) to those shown, with the same
sign.
Whether "except for CHAR_BIT and MB_LEN_MAX" applies only to the first
sentence or even to the last sentence is not clear to me, although it may be
more like you say.
> I could see deleting HOST_CHAR_BIT, that's a different story.
OK.
> host-defs.h
> already exists, and this being macro representing a fundamental
> characteristic of the host, it just feels better than a header
> for common string utilities and such.
OK, moved it to common/host-defs.h when that file already exists.
Thanks,
Jan