[Automated review] Coverity or clang-format thinks ifdefs always go one way
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
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.
Comment 1•6 years ago
|
||
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.
Comment 2•6 years ago
|
||
The priority flag is not set for this bug.
:sylvestre, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 3•6 years ago
|
||
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.
Updated•3 years ago
|
Description
•