Am 16.05.2019 um 22:24 schrieb Martin Sebor: > On 5/16/19 8:58 AM, Roland Illig wrote: >> - error ("#pragma GCC target string... is badly formed"); >> + error ("%<#pragma GCC target%> string is badly formed"); >> - error ("#pragma GCC optimize string... is badly formed"); >> + error ("%<#pragma GCC optimize%> string is badly formed"); >> >> I think the "string..." was supposed to go inside the quotes. > > The "string" refers to the pragma argument and quoting it would > imply that the word string should be verbatim. So I think it's > correct as is, despite the call above: > > GCC_BAD ("%<#pragma GCC optimize (string [,string]...)%> does " > "not have a final %<)%>"); > > where the string is part of the grammar being shown.
I disagree. All these messages are structurally the same. They refer to "#pragma GCC target" as a fixed string and "string..." as being a placeholder for arguments. It doesn't make sense to say "the string '#pragma GCC target' is malformed", which is what your suggested message implies. Either the word "string" should be left out completely, or it should be marked as a placeholder. You mentioned elsewhere that the diagnostics could use italics. This might be another case for them. Instead of the word "string", a more specific term should be used here, such as "argument to %<#pragma GCC optimize%> is badly formed". >> - error_at (loc, "typeid-expression is not a constant expression " >> + error_at (loc, "%<typeid%> is not a constant expression " >> >> This sounds like a term from the C++ grammar. > > It does but there is no /typeid-expression/ in the C++ grammar. > It's just %<typeid%> expression. I took out the word "expression" > because it seemed redundant with the "constant expression" that > follows. > > That said, it could be handy to be able to uniquely distinguish > grammar terms (do you translate C/C++ grammar terms or leave them > in English?). I'd like to add either a new directive or flag to > %< to let us do that. E.g. with something like: > > "%#<postfx-expression%#>" > > GCC could render the term in italics (there's a bug where we > discussed this that I can't find right now). In the German translation I kept most of these grammar production names in English, so that you can search for the exact terms. In the French, Russian and Swedish translations, most of them are translated into the user's native language, in order to make them more understandable. I'm not sure whether we really need additional directives or flags here. I think the normal %<quotes%> would give a strong enough indication already.