This is the mail archive of the
gcc-patches@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" <jsm at polyomino dot org dot uk>, Zack Weinberg <zack at codesourcery dot com>, Neil Booth <neil at daikokuya dot co dot uk>, gcc-patches at gcc dot gnu dot org
- Date: 21 Jul 2003 09:57:26 +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><m3vfuayizy.fsf@uniton.integrable-solutions.net><3F1A1654.4476090C@yk.rim.or.jp><Pine.LNX.4.56.0307201539320.2839@kern.srcf.societies.cam.ac.uk><3F1B275C.515D7FE1@yk.rim.or.jp>
Ishikawa <ishikawa@yk.rim.or.jp> writes:
| "Joseph S. Myers" wrote:
| >
| > On Sun, 20 Jul 2003, Ishikawa wrote:
| >
| > > BTW, Does anyone use the format_decoder function?
| > > (It looks that a format_decoder, c_tree_printer in
| > > c-objc-common.c, is used. But it seems to be used for
| > > internal compiler diagnostics and so we don't need to
| > > use positional parameter with it. So we don't lose if I am not
| > > mistaken.)
| >
| > It is extensively used by the C++ front end, and now extensively used by
| > the C front end after Gaby's removal of usage of warning_with_decl etc. -
| > it is clearly necessary to handle usages such as %2$D. In fact you will
| > see that the Turkish language translation already has usages such as %3$T.
| > You'll probably need to split the interface for custom decoders into
| > separate parts to decode the type wanted and store type information; to
| > extract the argument value from the variable arguments; and to print that
| > previously extracted value.
|
| Thank you for the feedback.
|
| Now I have a few questions that I hope someone can clear up.
|
| 1. Which CVS version should I be working on? Currently,
| I have used 3.3 branch CVS since gcc 3.3 had an issue
| which brought me into analyzing the problem by looking at
| at the source files.
Please mainline, don't specify any tag. See instruction at
http://gcc.gnu.org/cvs.html
| 2. Even under 3.3 branch, I found that Turkish po file
| uses ALREADY(!) the positional prameters.
| (But not 'T' as in %3$T. Was it meant to be 'D' as in %3D?
| Maybe in newer release?)
I don't know. But I'm sure something like %3D does not make sense
within the diagnostic framework.
| While this illustrates the necessity of positional paramaters
| for I18N/L10N work, I think something is wrong here since
| the released GCC diagnostic doesn't support the positional parameter.
| I am wondering if Turkish people got the right diagnostic messages
| with 3.3 under appropriate environment setting.
|
| 3. > You'll probably need to split the interface for custom decoders
| into
| > separate parts
| > to decode the type wanted and store type information;
| > to extract the argument value from the variable arguments;
| > and to print that previously extracted value.
| (I re-indented the quote. )
|
| This is exactly what the support for positional parameters needs to
| do.
| (All the more reason why I am puzzled if the latest Turkish po file
| in newer CVS branches already has %3$D, etc.. Or is it the case that
| the installed decoder itself handles the positional parameter???)
|
| Do people already have an idea on the appropriate APIs?
I'm not sure I understand that question, couold you elaborate?
| Or can I concoct something on the fly and prpose it in the patch?
|
| 4. Again, assuming that I need to fetch the latest CVS branch
| (whichever is appropriate), which file(s) should I read to
| learn the usage of custom decoders for C++ and C.
| (Especially C++. I have not used g++ much and so am not familiar with
| g++ source file structure.)
the C++ format decoder is in cp/error.c, but beware: that is
spaghetti code.
I don't think you need to understand the code there. What you need
(I think) is to convince output_format to give you the string you get
by formatting a tree, remember it for latter use.
-- Gaby