Closed Bug 1920717 Opened 10 months ago Closed 9 months ago

Build a linter that checks for global variable with runtime initialization

Categories

(Firefox Build System :: General, task)

task

Tracking

(firefox134 fixed)

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: sergesanspaille, Assigned: sergesanspaille)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This linter would be quite close to -Wglobal-constructors but it would be aware of MOZ_GLOBAL_CLASS, and of a new attribute MOZ_RUNINIT that explicitly flags global variable that requires runtime initialization.

The goal is to avoid adding such globals (i.e. no regression) and make existing state explicit.

Depends on: 1920718

This patch both:

  1. Provides a static checker to detect global variables which may not be
    initialized at compile-time

  2. Verify that variables flagged as MOZ_RUNINIT are indeed
    initialized at runtime, unless they are also flagged as MOZ_GENERATED
    (to avoid false positive)

Attachment #9426821 - Attachment description: Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium → Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium!
Attachment #9426821 - Attachment description: Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium! → Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium
Attachment #9426821 - Attachment description: Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium → Bug 1920717 - Add static checker for global variables with runtime initialisation r=glandium!
Pushed by sguelton@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/39dc4be7fd58 Add static checker for global variables with runtime initialisation r=glandium
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
Depends on: 1928157
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: