On 1/10/21 10:18 PM, Martin Sebor wrote:
> On 1/10/21 3:29 AM, Matthias Klose wrote:
>> is the newline intended? It's followed by a debug_rtx call.
> 
> To avoid the warning there shouldn't be any trailing punctuation
> or whitespace in the message.  The GCC quoting directives should
> be preferred over the literal characters (as per GCC Coding
> Conventions).  %qc and %qs are preferable to %<%c%>.
> 
> Symbols/identifiers should be formatted using the appropriate
> directives or quoted in %< %>.  Underscores in words like
> emit_insn are taken as indicators that the word is an identifier
> and to trigger warnings.

is this?
https://gcc.gnu.org/codingconventions.html#Diagnostics

I think that's a bit terse, and grepping sources for %< shows many more
occurences than %qX.

>> ../../src/gcc/rtl.c:860:42: warning: unquoted sequence of 2 consecutive
>> punctuation characters '',' in format [-Wformat-diag]
>>    860 |     ("RTL check: expected elt %d type '%c', have '%c' (rtx %s) in 
>> %s, at
>> %s:%d",
>>
>> `%c', or some %q quoting?
> 
> The purpose of the -Wformat-diag warnings is to improve the consistency
> of user-visible messages and make them easier to translate.  There was
> a discussion some time back about whether internal errors should fall
> into this category.  I'm not sure if it reached a conclusion one way
> or the other but in similar situations elsewhere in GCC we have
> suppressed the warning via #pragma GCC diagnostic.  If it takes too
> much effort to clean them up it might make sense to do the same here
> (the downside is that it doesn't help translators).  Otherwise,
> the messages are not really phrased in a way that's comprehensible
> either to users or to tranlators (acronyms like elt or rtx aren't universally
> understood).

[...]

>> again, `' quotes, or some %q option?
>>
> 
> The latter: %qs with an argument is best in general (it can reduce
> translation effort between repeated messages parameterized on
> the quoted string).

if the URL above is the correct place for the conventions, then maybe make it
more explicit there about the preferred choice.

Matthias

Reply via email to