https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65378

            Bug ID: 65378
           Summary: Tweak to wording of -Wodr message
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org

I think the wording to the -Wodr message is overly terse, and potentially
confusing.

See e.g. bug 64275 where this message is reported:

warning: type 'struct failure' violates one definition rule [-Wodr]
     class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error

A reasonable (but incorrect) way for a user to read the above message is to
think that there are some "definition rules", and that of these "definition
rules", "struct failure" violates one of them, and then to wonder which such
definition rule is being violated.

I think this message at least needs a "the":
  "type %qT violates the one definition rule"
making the message be:
 warning: type 'struct failure' violates the one definition rule [-Wodr]

In many articles I've seen discussing the ODR, I've seen the words "One
Definition Rule" be capitalized, and given that the warning flag is an acronym,
capitalizing the words is reasonable.  Hence the wording could be:
  "type %qT violates the One Definition Rule"
i.e. adding the "the", and capitalizing the letters in the term.

With that, the message would read:
 warning: type 'struct failure' violates the One Definition Rule [-Wodr]

Message in question is here in ipa-devirt.c:
  if (!warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (t1)), OPT_Wodr,
           "type %qT violates one definition rule",
           t1))

Reply via email to