https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90176
Bug ID: 90176 Summary: diagnostics should generally contain underscore only inside quotes Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: translation Assignee: unassigned at gcc dot gnu.org Reporter: roland.illig at gmx dot de Target Milestone: --- From nds32.c: if (!TREE_PUBLIC (decl)) error ("indirect_call attribute can%'t apply for static function"); Names of attributes or pragmas are usually %<quoted%>. Since many attributes correspond to an English adjective, this can produce ambiguous warnings like this: warning (OPT_Wattributes, "critical attribute has no effect on interrupt functions"); The "critical attribute" is so difficult to decide that I think only humans can do this, as of April 2019. The case of "indirect_call attribute" is easier to decide though since written everyday English doesn't make use of the underscore character. It's debatable whether words like x86_64 need to be quoted in every case. To find out which words need to be quoted and which words don't, the check-internal-format-escaping.py should be extended to warn about all words that contain an underscore and appear outside of any %<quotes%>. To do this, it's probably time to switch the linter to using polib, so that diagnostics that consist of multiple lines can be checked correctly, such as: msgid "" "%<" "this_is_ok" "%>" " " "and_this_is_not" The check might then be: for each occurrence of "_" in msg.msgid: before = text before the "_" if count("%<", before) == count("%>", before): warn(msg, 'underscore outside of quotes')