code that could be improved

Joseph S. Myers jsm@polyomino.org.uk
Tue Mar 2 12:58:00 GMT 2004


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

> I don't think that default would be appropriate.  There are common
> situations where we want to say
> 
>    "fubar '%D::%T' is foo and bar" 

That seems quite rare; the bulk of uses are quoted on their own and there
are a few cases that are unquoted for no obvious reason.

decl.c:     error ("explicit specialization of %D after first use",
decl.c:         error ("duplicate initialization of %D", decl);
parser.c:    error ("%D redeclared with different access", decl);
pt.c:                 error ("specialization of %D after instantiation",

> | %` for a left quote (' in C locale)
> | %' for a right quote (' in C locale)
> | %qs for quoted string
> | %qD for unquoted decl
> 
> I would prefer a simple
> 
>   %q for quoted tree or string
> 
> There is no conceptual difference when a tree  or string literal is
> reported in diagnostics.

We need %` and %' for all the cases such as '%D::%T' you gave where more 
than a single format specifier is quoted.  But where a single specifier is 
quoted, there is a case for consistency in use of %q even if this does 
mean almost all uses of %D become %qD.

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



More information about the Gcc-bugs mailing list