This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Support for %d$c format specifier in diagnostics.c
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Ishikawa <ishikawa at yk dot rim dot or dot jp>
- Cc: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>, Zack Weinberg <zack at codesourcery dot com>, Neil Booth <neil at daikokuya dot co dot uk>, gcc at gcc dot gnu dot org
- Date: 10 Jul 2003 08:48:49 +0200
- Subject: Re: Support for %d$c format specifier in diagnostics.c
- Organization: Integrable Solutions
- References: <m19WKhW-000H3mC@standard.erephon><20030628193135.GA1767@daikokuya.co.uk><87llvlk3gi.fsf@egil.codesourcery.com><3EFE65DC.52576EC7@yk.rim.or.jp><87vfupiglu.fsf@egil.codesourcery.com><3EFEE0EF.C560ED1A@yk.rim.or.jp><87isqoiwng.fsf@egil.codesourcery.com><3F061172.814BA7A0@yk.rim.or.jp><Pine.LNX.4.56.0307051127540.6302@kern.srcf.societies.cam.ac.uk><3F0CA938.1FA02D3E@yk.rim.or.jp>
Ishikawa <ishikawa@yk.rim.or.jp> writes:
| Hello,
|
| Thank you for your previous comments.
|
| Supporting %d$s form format specifier
hugh. what is that supposed to mean?
| might take a few days more than I originally thought it would.
|
| A potential Bug:
|
| As I dive through the code, I think I found a bug in
| the original code.
|
| Original BUG (?) found.
| Near line 517 of diagnostic.c , "u" ought to be "o"';
| case 'o':
| if (wide)
| output_formatted_scalar
| (buffer, "%" HOST_WIDE_INT_PRINT "o",
| va_arg (*text->args_ptr, unsigned HOST_WIDE_INT));
| else
| output_integer_with_precision
| Here ---> (buffer, *text->args_ptr, precision, unsigned, "u");
| break;
Yes, the "u" above should have been "o". Thanks.
| This means that this feature of using precision of
| %lu, and %llu as opposed to simple %u has not been used by
| the diagnostic messages. [ Maybe I can forget about the precision :-) ]
|
| A question.
|
| Why are we using HOST_WIDE_INT ?
because the "w" in "%wo" is for HOST_WIDE_INT. See
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02548.html
| Well this is somewhat a rhetorical question.
|
| I can guess that on some hosts, the distinction of short, int, and
| long is such that we need to go to long (instead of simple int) to
| make sure that we get the the most wide natural size of int.
|
| In that case, we must use HOST_WIDE_INT_PRINT_DEC instead of simple
| "%d" to print such data. diagnostic.c supports "%wd" as opposed to
| "%d" for this type of intrinsic wide int.
|
| But what surprised me a little bit is this.
| We already support %d, %ld, and %lld in diagnostic.c.
that should not be a surprise: %wd is not a susbtitute for %ld, nor %lld.
| So my main question would be why do we support two different series of
| enlarging the size of the types in diagnostic.c?
there were (still are?) places where we need to support at least %ld.
%wd is for abstracting over the actual data type behind HOST_WIDE_INT.
I think it also makes sense for uniformity to also support long long.
-- Gaby