Closed Bug 1756504 Opened 3 years ago Closed 3 years ago

Remove cpp-virtual-final linter, a minor style check that doesn't diagnose real bugs.

Categories

(Core :: General, task, P3)

task

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix
firefox99 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

In bug 1436263, I added a cpp-virtual-final.yml linter to warn about virtual function declarations that included more than one virtual function specifier virtual, final, or override.

I think we should remove this linter now because:

  • It's just a style check and doesn't diagnose a real bug. Including more than one virtual function specifier (virtual, final, or override) is harmless and unambiguous, just unnecessary extra code.
  • It has caused some engineer frustration because this style check caused their changeset to be backed out of autoland. Backing out and fixing these style issues are not a good use of sheriffs' or engineers' time.
  • It doesn't catch all virtual/final/override style issues because:
    • It can't analyze virtual function definitions that span multiple lines.
    • It doesn't check for virtual void Foo() override because there are over 6000 cases already, so our code will never follow this style check consistently.

(In reply to Chris Peterson [:cpeterson] from comment #0)

  • It's just a style check and doesn't diagnose a real bug. Including more than one virtual function specifier (virtual, final, or override) is harmless and unambiguous, just unnecessary extra code.

As I wrote in bug 1436263, foo() final implies override while virtual foo() final does not. So it is not a harmless redundant code.

  • It has caused some engineer frustration because this style check caused their changeset to be backed out of autoland. Backing out and fixing these style issues are not a good use of sheriffs' or engineers' time.

If we do not check

class A { virtual void foo(); };
class B: public A { virtual void foo() final; };

someone may change A::foo() without syncing B::foo(). The bug may not be noticed until the change is released and someone report the bug. Is it really better than immediate back outs?
We should have not changed final override to final if we stop checking virtual final.

  • It doesn't catch all virtual/final/override style issues because:
    • It can't analyze virtual function definitions that span multiple lines.
    • It doesn't check for virtual void Foo() override because there are over 6000 cases already, so our code will never follow this style check consistently.

Why do we remove checks instead of improving them?

That said, virtual override, final override, and virtual final override are harmless. We can remove those checks, yes. Rather, we should force final override if we remove virtual final check.

In bug 1436263, I added a cpp-virtual-final.yml linter to warn about virtual function declarations that included more than one virtual function specifier virtual, final, or override.

I think we should remove this linter now because:

  • It's just a style check and doesn't diagnose a real bug. Including more than one virtual function specifier (virtual, final, or override) is harmless and unambiguous, just unnecessary extra code.
  • It has caused some engineer frustration because this style check caused their changeset to be backed out of autoland. Backing out and fixing these style issues are not a good use of sheriffs' or engineers' time.
  • It doesn't catch all virtual/final/override style issues because:
    • It can't analyze virtual function definitions that span multiple lines.
    • It doesn't check for virtual void Foo() override because there are over 6000 cases already, so our code will never follow this style check consistently.
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/849eb13e577a Remove cpp-virtual-final linter, a minor style check that doesn't diagnose real bugs. r=firefox-static-analysis-reviewers,sylvestre
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: