Closed Bug 1549852 Opened 6 years ago Closed 6 years ago

[Automated review] Coverity or clang-format thinks ifdefs always go one way

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Gijs, Unassigned)

Details

Phabricator URL: https://phabricator.services.mozilla.com/D29892#inline-175786

Execution cannot reach the expression "xpc::IsInAutomation()" inside this statement: "if (allowSingleProcessOutsi...".

Code in question:

#if defined(MOZILLA_OFFICIAL) && MOZ_BUILD_APP_IS_BROWSER
  bool allowSingleProcessOutsideAutomation = false;
#else
  bool allowSingleProcessOutsideAutomation = true;
#endif

  int status = kE10sEnabledByDefault;
  if (allowSingleProcessOutsideAutomation || xpc::IsInAutomation()) {

It is late and I am not clever about C++, but given I just typed up a giant comment at bug 1548941 comment 8 about what happens when we do reach this expression in the valgrind test, I beg to differ.

Unfortunately we don't have a solution for this since the analysis is performed on the AST, so at the AST level we don't have information on code that was discarding during the build time.

The priority flag is not set for this bug.
:sylvestre, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(sledru)

Yeah, not much we can do here...
But one could argue that we could use the #if defined(MOZILLA_OFFICIAL) && MOZ_BUILD_APP_IS_BROWSER also on the other part of the code to make it obvious to the tools and humans that it won't be executed in the other cases.

This is a limitation of tools on which we are based and it would be pretty hard to fix.

Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(sledru)
Resolution: --- → WONTFIX
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.