Skip to content

Misra.md: a check named for a rule finds what the rule asks - #111

Merged
theAndreas merged 2 commits into
mainfrom
misra-md-honest
Nov 17, 2026
Merged

theAndreas merged 2 commits into
mainfrom
misra-md-honest

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

What

docs/Misra.md of a project now says in part where the tool it names for a rule misses part of it, and what review takes:

  • 7.0.5: -Wsign-conversion reports a signed operand that turns unsigned, not the promotion of a uint8_t to int.
  • 0.1.2: -Wunused-result reports only a result marked as FN-10 asks.
  • 8.19.1, 10.0.1: -Wcomma and readability-isolate-declaration leave out the head of a for loop.
  • 15.1.3: cpplint's runtime/explicit leaves out a conversion operator; CodingStyle C-4 now names it beside the constructor.

7.0.5 and 0.1.2 become deviations with their reasons. A cast at every promotion would hide the computation, which T-19 widens where it could overflow. FN-10 marks only a result that is a mistake to drop.

The update note of v0.13.0 in the CHANGELOG also says how to take out parentheses that clang-tidy --fix puts in twice. That happens when one run covers several files that include the same header, as at eight places in MaxMatrix.

Why

A row that names a check reads as covered, and a project that reports compliance from the matrix would claim more than its tools find.

How it was checked

  • Each gap was measured against the tools on a small file:
    • -Wsign-conversion (GCC and clang) is silent on uint8_t + uint8_t and reports int16_t + uint32_t.
    • -Wcomma misses i++, j-- in a for head.
    • readability-isolate-declaration misses int i{0}, j{n} there.
    • cpplint is silent on operator int().
    • readability-redundant-parentheses --fix takes ((a == b)) && c back to (a == b) && c.
  • tests/check.sh lint docs passes for the Arduino library and with --no-arduino; tests/doc_indent.py passes.

Five rows named a tool that misses part of the rule, measured against the
tools: -Wsign-conversion reports a signed operand that turns unsigned, not
the promotion of a uint8_t to int (7.0.5); -Wunused-result only a result
marked as FN-10 asks (0.1.2); -Wcomma and readability-isolate-declaration
leave out the head of a for loop (8.19.1, 10.0.1); cpplint's
runtime/explicit leaves out a conversion operator (15.1.3). Each now says
in part, and what review takes.

7.0.5 and 0.1.2 are deviations with their reasons: a cast at every
promotion would hide the computation, which T-19 widens where it could
overflow, and FN-10 marks only a result that is a mistake to drop.
CodingStyle C-4 and the reason in .clang-tidy name the conversion operator
beside the constructor.
A run of clang-tidy --fix over several files that include the same header
inserts the parentheses there once per file, as MaxMatrix found at eight
places. The update note of v0.13.0 now says how to take the second pair
out: a second run with readability-redundant-parentheses, whose fix-it
does.
@theAndreas
theAndreas merged commit 640c39f into main Nov 17, 2026
1 check passed
@theAndreas
theAndreas deleted the misra-md-honest branch November 17, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants