This is the mail archive of the gcc-bugs@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: code that could be improved


On Tue, 2 Mar 2004, Gabriel Dos Reis wrote:

> this probably the piece I did not understand.  I thought the proposal
> would be
> 
>    %`D%::%T%'  for '%D::T'
> 
> and
> 
>    %q%s or %q%D for  "%s" and '%D'
> 
> Could you reformulate, please?

I was thinking of q as a flag, so that %qs would be for '%s' and %qD would 
be for '%D'.  (I don't think there should be a distinction between them, 
and any single/double quote distinction wouldn't carry over well to 
non-English languages.  Further, there are still places using %s where %D 
could be used, and it would be odd for them to get different formatting - 
though they can easily be changed incrementally to use %D.)

Proposed specification:

%`      Opening quote
%'      Closing quote
(where strings output from the compiler will consist of whatever-language
text, an opening quote, decl name etc. from the source file, then a
closing quote and maybe more text - the decl name or whatever will be a
left-to-right oriented string even if the language is right-to-left, so
the clear specification of quotes as opening or closing rather than left
or right is relevant for RTL languages to set them so that the Unicode
bidirectional algorithm, applied to the compiler output (which is always
in logical rather than display ordering), yields proper results)

q       Flag in all formats other than %%, %`, %' to indicate that the 
format output is surrounded by quotes; thus, %qs, %qD, %#qD or %q#D 
(equivalent), %qd, ....

Implementing these formats doesn't require anything special to be done
about better quoting in C locale with UTF-8; that's separate (though while
the strings may be translated as _("`") and _("'") we do probably want to
arrange the default left quote, for C locale or no translation available,
to be "'" rather than "`").  If however formats in the compiler are
globally changed to this style before tree-ssa is merged, some track needs
to be kept of the various global changes and they need either applying to
tree-ssa as well or applying after the merge to new strings brought in
from tree-ssa.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


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