Closed Bug 1601103 Opened 5 years ago Closed 5 years ago

Enable clang-tidy's cppcoreguidelines-pro-type-member-init

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement
Not set
normal

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: jgilbert, Assigned: jgilbert)

Details

Attachments

(1 file)

This would have caught a bug for me.

Component: Lint and Formatting → Source Code Analysis

Many thanks for doing that!
I am curious, which bug it would have caught?

FYI, we have 1180 occurrences of this issue in our code base.

Flags: needinfo?(jgilbert)

More or less:

class WebGLContext {
  bool mOptionsFrozen;
};

WebGLContext::WebGLContext() {
  [...] // many lines
  mOptionsFrozen = false; // This line removed by refactor
}

bool WebGLContext::EnsureDefaultFB() {
  if (!Resize(mRequestedSize)) {
    if (mOptionsFrozen) { // ASAN generates cryptic "unusual bool value" crash here
      LoseContext();
    }
    return false;
  }
  return true;
}

I did debate myself on what reliability to give this, and settled on high, but I can be talked down to medium.

This is a common thing we do in our C++03-era code, but that we should really stop doing. It's not a huge foot-gun when first writing code, but it's a definite tripwire for refactors.

After landing this I intend to yak-shave all the instances from my modules out.

Flags: needinfo?(jgilbert)
Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/584510e57b7b Enable clang-tidy's cppcoreguidelines-pro-type-member-init. r=andi
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
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: