[llvm-dev] [RFC] Coding standard for error/warning messages
James Henderson via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 23 08:53:38 PDT 2020
This came up in a recent review. There is currently no documented style for
how to write error messages. For example, should they start with a capital
letter or end in a full stop? Consequently, there's quite a bit of
inconsistency in our diagnostics throughout the code base.
clang typically emits error messages with no leading capital letter and no
trailing full stop. For example:
"clang: error: no input files"
I have suggested this approach be followed in many different reviews,
primarily in the LLVM equivalents of the GNU binutils that I typically work
on. I'd like to propose that this be followed more widely too, and
documented in the coding standards as such. Note, I am not proposing
changing existing error messages as part of this. Do people agree with this
proposal? If not, what would you prefer to see?
As well as "regular" errors you'll see in typical usage, there are 3 other
kinds of errors that are widely used, with the following output styles:
Assertion failed: false && "this is the message", file <filepath>
this is the message
UNREACHABLE executed at <filepath>
LLVM ERROR: this is the message
Looking at the existing output, and how they are used, I think
llvm_unreachable and assertions do not need standardising, since they are
purely for internal usage, whilst report_fatal_error should be standardised
to the same as other normal errors (i.e. lower-case first letter, trailing
What do people think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev