This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[wwwdocs, PATCH] C++ terminology: the One Definition Rule in diagnostics
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 14 Mar 2017 10:18:46 -0400
- Subject: [wwwdocs, PATCH] C++ terminology: the One Definition Rule in diagnostics
- Authentication-results: sourceware.org; auth=none
Looking at PR ipa/80000, which notes that ipa-devirt.c has two trailing
spaces in:
if (warning_at (
DECL_SOURCE_LOCATION(TYPE_NAME (DECL_CONTEXT (vtable->decl))),
OPT_Wodr,
"virtual table of type %qD violates "
"one definition rule ",
DECL_CONTEXT (vtable->decl)))
and thus emits:
foo.cc: virtual table of type 'foo' violates one definition rule
...I think the wording here is a little confusing to a novice C++
coder: it could be misread that the compiler is complaining that there
are "definition rules", and that one of them has been somehow violated
("why aren't you telling me which one?"), as opposed to the correct
reading, that there is a rule that there must be one definition.
There are 5 such diagnostics, all in ipa-devirt.c.
So I think the wording could be improved by adding a "the", and maybe
capitalizing, to make it:
foo.cc: virtual table of type 'foo' violates the One Definition Rule
(giving a big hint to the user that the "One Definition Rule" is the thing that they should be typing into their search engine, and that "ODR" is an acronym form of it).
I've even seen it hyphenated in some places, which would make it:
foo.cc: virtual table of type 'foo' violates the One-Definition Rule
or:
foo.cc: virtual table of type 'foo' violates the one-definition rule
Here's a patch to the terminology part of our conventions, which suggests adding a "the" and capitalizing (but without the hyphen).
Thoughts?
Dave
Index: htdocs/codingconventions.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/codingconventions.html,v
retrieving revision 1.80
diff -u -p -r1.80 codingconventions.html
--- htdocs/codingconventions.html 13 Mar 2017 22:01:05 -0000 1.80
+++ htdocs/codingconventions.html 14 Mar 2017 14:08:01 -0000
@@ -448,6 +448,10 @@ and code. The following table lists som
<td>"Objective C"</td>
</tr>
<tr>
+ <td>"one definition rule"</td>
+ <td>"the One Definition Rule" (capitalize and use "the")</td>
+ </tr>
+ <tr>
<td>"prologue"</td>
<td>"prolog"</td>
<td>Established convention</td>