This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support for %d$c format specifier in diagnostics.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]