Closed Bug 1605181 Opened 5 years ago Closed 5 years ago

[Automated review] Coverity and clang-tidy warnings when using if constexpr

Categories

(Developer Infrastructure :: Source Code Analysis, defect, P1)

defect

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: sg, Assigned: Sylvestre)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Phabricator URL: https://phabricator.services.mozilla.com/D57799#1763765

In a construct using if constexpr, I get analyzer warnings from both clang-tidy and coverity, which do not seem to make sense:

Checker reliability is medium, meaning that the false positive ratio is medium.
An "if" statement with no "then" or "else" is suspicious.
The path that leads to this defect is:

    xpcom/tests/gtest/TestThreadUtils.cpp:267:
        stray_semicolon: An "if" statement with no "then" or "else" is suspicious..

    xpcom/tests/gtest/TestThreadUtils.cpp:267:
        remediation: Is the ";" after "if (false)" extraneous, or is the "if" itself unnecessary?.


Warning: Potentially unintended semicolon [clang-tidy: bugprone-suspicious-semicolon]
Checker reliability is high, meaning that the false positive ratio is low.


Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]
Checker reliability is high, meaning that the false positive ratio is low.

The offending code is

if constexpr (RunnableFactory::SupportsCopyWithDeletedMove) {
  // ...
}

where RunnableFactory::SupportsCopyWithDeletedMove is a bool depending on a template argument.

Priority: -- → P1
Assignee: nobody → sledru
Status: NEW → ASSIGNED
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7cb37c7ac4e9 'if constexpr' wasn't supported in clang-tidy r=andi
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Blocks: 1608396
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: