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


> >
> > As per Zack's suggestion, I am working on the initial cut of
> > the support of %n$s notation in diagnostic.c
> > (This is not strictly I18N/L10N stuff, though.)
> >
> > Anyway, here is an overview of what I am coding and
> > comment/feedback welcome.
> 
> You've got the right idea.  Two comments:

Thanks!
 
> > (UNLESS one such reference to a format specifier in the form of
> > %n$c is done, we won't have the overhead of the array construction.)
> 
> Diagnostic message output doesn't have to be hyper-efficient.  If it
> simplifies the code to make the array always, do that.

I might do the array construction always, or actually,
I might overhaul the output_format to handle
the two passes (one for scanning the type, and then later
for value if necessary) internally within the same function.
This clutters up the code somewhat, but keeps the logic of
handling various format specifier characters such as 'c', 'd', etc.
and the associated type size, etc. in one place.
Right now, I used a separate function so as not to clutter the
code.

> > Now, I am not entirely sure of the usage
> > rule of %n$c format specifier.
> >
> > It seems to me ONCE we use the %n$ construct,
> > we probably need to use this format from this point on always.
> > (Or we need to use this form for ALL the format specifiers.)
> 
> I believe SUS says somewhere that you can use this notation for all or
> none, but not some.  Even if it doesn't, I think that's an acceptable
> limitation for GCC's implementation.

Thank you again. In a separate post, Joseph Myers directed me to
a paragraph that exactly says this. One question solved completely.


I am planning to submit an initial cut of the patch
in one week or so. 

-- 
int main(void){int j=2003;/*(c)2003 cishikawa. */
char t[] ="<CI> @abcdefghijklmnopqrstuvwxyz.,\n\"";
char *i ="g>qtCIuqivb,gCwe\np@.ietCIuqi\"tqkvv is>dnamz";
while(*i)((j+=strchr(t,*i++)-(int)t),(j%=sizeof t-1),
(putchar(t[j])));return 0;}/* under GPL */


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