Page MenuHomePhabricator Dev

Bug 1387052 - Make Firefox code worse intentionally 2/2.
Needs ReviewPublic

Authored by janx on Nov 23 2018, 11:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 8, 4:22 PM
Unknown Object (File)
Aug 10 2026, 4:37 AM
Unknown Object (File)
Aug 4 2026, 7:40 PM
Unknown Object (File)
Aug 4 2026, 5:28 AM
Unknown Object (File)
Aug 2 2026, 6:49 PM
Unknown Object (File)
Aug 2 2026, 6:15 AM
Unknown Object (File)
Aug 1 2026, 5:25 AM
Unknown Object (File)
Jul 25 2026, 12:39 AM
Subscribers
None

Details

Reviewers
ReviewBot
Bugzilla Bug ID
1387052
Summary

Depends on D842

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
js/src/jsapi.cpp
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
241–242

Warning: Incorrect coding style [clang-format]

242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^

Code analysis found 23 defects in this patch:

  • 2 defects found by clang-format
  • 21 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
132

Warning: Suspicious string literal, probably missing a comma [clang-tidy: bugprone-suspicious-missing-comma]

"line 6"     // after: bugprone-suspicious-missing-comma
^
144

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES cannot be && ref-qualified [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int *get() && { return nullptr; } // after: mozilla-dangling-on-temporary
                                    ^
145

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES must return a pointer [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int test() { return 0; } // after: mozilla-dangling-on-temporary
                                   ^
189–190

Warning: Do not use 'else' after 'return' [clang-tidy: readability-else-after-return]

else if (ErrorTakesArguments(code_)) { // after: readability-misleading-indentation or readability-else-after-return
^~~~~~~~
226–229

Warning: Variable 'x' with floating point type 'float' should not be used as a loop counter [clang-tidy: clang-analyzer-security.FloatLoopCounter]

for (float x = 0.1f; x <= 1.0f; x += 0.1f) {} // after: clang-analyzer-security.FloatLoopCounter
^
231

Warning: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges [clang-tidy: clang-analyzer-security.insecureAPI.UncheckedReturn]

setuid(1); // after: clang-analyzer-security.insecureAPI.UncheckedReturn
^
232–233

Warning: Potentially unintended semicolon [clang-tidy: bugprone-suspicious-semicolon]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
232–233

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
           {
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^
260–264

Warning: Value stored to 'x' is never read [clang-tidy: clang-analyzer-deadcode.DeadStores]

x = 1; // after: clang-analyzer-deadcode.DeadStores
^
371–375

Warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [clang-tidy: performance-faster-string-find]

str.find("A"); // after: performance-faster-string-find
         ^~~~
         'A'
380–384

Warning: The type of the loop variable 'p' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const std::pair<const int, std::vector<std::cxx11::basic_string<char>, std::allocator<std::cxx11::basic_string<char> > > > &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [clang-tidy: performance-implicit-conversion-in-loop]

for (const std::pair<int, std::vector<std::string>>& p : my_map) {} // after: performance-implicit-conversion-in-loop
     ^
1725–1726

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
1770–1771

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"", source);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
5355–5356

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

StringifyBehavior::RestrictedSafe))
                                   ^
                                    {
6052–6054

Warning: Use '= default' to define a trivial destructor [clang-tidy: modernize-use-equals-default]

JSErrorNotes::~JSErrorNotes() {}
              ^               ~~
                              = default;

Code analysis found 23 defects in this patch:

  • 2 defects found by clang-format
  • 21 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
132

Warning: Suspicious string literal, probably missing a comma [clang-tidy: bugprone-suspicious-missing-comma]

"line 6"     // after: bugprone-suspicious-missing-comma
^
144

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES cannot be && ref-qualified [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int *get() && { return nullptr; } // after: mozilla-dangling-on-temporary
                                    ^
145

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES must return a pointer [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int test() { return 0; } // after: mozilla-dangling-on-temporary
                                   ^
189–190

Warning: Do not use 'else' after 'return' [clang-tidy: readability-else-after-return]

else if (ErrorTakesArguments(code_)) { // after: readability-misleading-indentation or readability-else-after-return
^~~~~~~~
226–229

Warning: Variable 'x' with floating point type 'float' should not be used as a loop counter [clang-tidy: clang-analyzer-security.FloatLoopCounter]

for (float x = 0.1f; x <= 1.0f; x += 0.1f) {} // after: clang-analyzer-security.FloatLoopCounter
^
231

Warning: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges [clang-tidy: clang-analyzer-security.insecureAPI.UncheckedReturn]

setuid(1); // after: clang-analyzer-security.insecureAPI.UncheckedReturn
^
232–233

Warning: Potentially unintended semicolon [clang-tidy: bugprone-suspicious-semicolon]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
232–233

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
           {
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^
260–264

Warning: Value stored to 'x' is never read [clang-tidy: clang-analyzer-deadcode.DeadStores]

x = 1; // after: clang-analyzer-deadcode.DeadStores
^
371–375

Warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [clang-tidy: performance-faster-string-find]

str.find("A"); // after: performance-faster-string-find
         ^~~~
         'A'
380–384

Warning: The type of the loop variable 'p' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const std::pair<const int, std::vector<std::cxx11::basic_string<char>, std::allocator<std::cxx11::basic_string<char> > > > &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [clang-tidy: performance-implicit-conversion-in-loop]

for (const std::pair<int, std::vector<std::string>>& p : my_map) {} // after: performance-implicit-conversion-in-loop
     ^
1725–1726

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
1770–1771

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"", source);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
5355–5356

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

StringifyBehavior::RestrictedSafe))
                                   ^
                                    {
6052–6054

Warning: Use '= default' to define a trivial destructor [clang-tidy: modernize-use-equals-default]

JSErrorNotes::~JSErrorNotes() {}
              ^               ~~
                              = default;

Code analysis found 8 defects in this patch:

  • 2 defects found by clang-format
  • 6 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^

Code analysis found 23 defects in this patch:

  • 2 defects found by clang-format
  • 21 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
132

Warning: Suspicious string literal, probably missing a comma [clang-tidy: bugprone-suspicious-missing-comma]

"line 6"     // after: bugprone-suspicious-missing-comma
^
144

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES cannot be && ref-qualified [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int *get() && { return nullptr; } // after: mozilla-dangling-on-temporary
                                    ^
145

Error: Methods annotated with MOZ_NO_DANGLING_ON_TEMPORARIES must return a pointer [clang-tidy: mozilla-dangling-on-temporary]

MOZ_NO_DANGLING_ON_TEMPORARIES int test() { return 0; } // after: mozilla-dangling-on-temporary
                                   ^
189–190

Warning: Do not use 'else' after 'return' [clang-tidy: readability-else-after-return]

else if (ErrorTakesArguments(code_)) { // after: readability-misleading-indentation or readability-else-after-return
^~~~~~~~
226–229

Warning: Variable 'x' with floating point type 'float' should not be used as a loop counter [clang-tidy: clang-analyzer-security.FloatLoopCounter]

for (float x = 0.1f; x <= 1.0f; x += 0.1f) {} // after: clang-analyzer-security.FloatLoopCounter
^
231

Warning: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges [clang-tidy: clang-analyzer-security.insecureAPI.UncheckedReturn]

setuid(1); // after: clang-analyzer-security.insecureAPI.UncheckedReturn
^
232–233

Warning: Potentially unintended semicolon [clang-tidy: bugprone-suspicious-semicolon]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
232–233

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

if (x < y); // after: bugprone-suspicious-semicolon; readability-braces-around-statements
          ^
           {
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^
260–264

Warning: Value stored to 'x' is never read [clang-tidy: clang-analyzer-deadcode.DeadStores]

x = 1; // after: clang-analyzer-deadcode.DeadStores
^
371–375

Warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [clang-tidy: performance-faster-string-find]

str.find("A"); // after: performance-faster-string-find
         ^~~~
         'A'
380–384

Warning: The type of the loop variable 'p' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const std::pair<const int, std::vector<std::cxx11::basic_string<char>, std::allocator<std::cxx11::basic_string<char> > > > &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [clang-tidy: performance-implicit-conversion-in-loop]

for (const std::pair<int, std::vector<std::string>>& p : my_map) {} // after: performance-implicit-conversion-in-loop
     ^
1725–1726

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
1770–1771

Warning: Escaped string literal can be written as a raw string literal [clang-tidy: modernize-raw-string-literal]

"\"string\", \"number\", or \"default\"", source);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R"("string", "number", or "default")"
5355–5356

Warning: Statement should be inside braces [clang-tidy: readability-braces-around-statements]

StringifyBehavior::RestrictedSafe))
                                   ^
                                    {
6052–6054

Warning: Use '= default' to define a trivial destructor [clang-tidy: modernize-use-equals-default]

JSErrorNotes::~JSErrorNotes() {}
              ^               ~~
                              = default;

Code analysis found 8 defects in this patch:

  • 2 defects found by clang-format
  • 6 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^

Code analysis found 8 defects in this patch:

  • 2 defects found by clang-format
  • 6 defects found by clang-tidy

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)
  • ./mach static-analysis check path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply).

If you see a problem in this automated review, please report it here.

js/src/jsapi.cpp
234

Warning: Use '= default' to define a trivial default constructor [clang-tidy: modernize-use-equals-default]

B() {} // after: modernize-use-equals-default
^   ~~
    = default;
235

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

B(const B&) {} // after: modernize-use-equals-default
^           ~~
            = default;
236

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

B(B &&) {} // after: performance-noexcept-move-constructor
^
241

Warning: Use '= default' to define a trivial copy constructor [clang-tidy: modernize-use-equals-default]

D(const D &RHS) : B(RHS) {} // after: modernize-use-equals-default
^
242

Warning: Move constructor initializes base class by calling a copy constructor [clang-tidy: performance-move-constructor-init]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
             ^
242

Warning: Move constructors should be marked noexcept [clang-tidy: performance-noexcept-move-constructor]

D(D &&RHS) : B(RHS) {} // after: performance-move-constructor-init; performance-noexcept-move-constructor
^