Open
Bug 1714305
Opened 5 years ago
Updated 4 years ago
readability-simplify-boolean-expr --fix generates invalid code
Categories
(Developer Infrastructure :: Source Code Analysis, defect, P3)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
NEW
People
(Reporter: valentin, Unassigned)
References
()
Details
Ran ./mach static-analysis check netwerk/ --fix
24:03.06 /home/icecold/mozilla-central/netwerk/ipc/SocketProcessChild.cpp
24:03.06 Warning: readability-simplify-boolean-expr in netwerk/ipc/SocketProcessChild.cpp: redundant boolean literal in conditional return statement
24:03.06 /home/icecold/mozilla-central/netwerk/ipc/SocketProcessChild.cpp:148:12: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
24:03.06 return false;
24:03.06 ~~~~~~~~~~~^~~~~~
Generated replaced these lines with the following:
return == 0;
Which is obviously wrong and doesn't build.
I assume it was going for return rv == 0;
Flags: needinfo?(bpostelnicu)
| Reporter | ||
Comment 1•5 years ago
|
||
Second (similar) bug
28:03.07 Warning: readability-else-after-return in netwerk/protocol/http/AltSvcTransactionParent.cpp: do not use 'else' after 'return'
28:03.07 /home/icecold/mozilla-central/netwerk/protocol/http/AltSvcTransactionParent.cpp:21:3: warning: do not use 'else' after 'return' [readability-else-after-return]
28:03.07 NS_INTERFACE_MAP_ENTRY_CONCRETE(AltSvcTransactionParent)
28:03.07 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28:03.07 /home/icecold/mozilla-central/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:1297:3: note: expanded from macro 'NS_INTERFACE_MAP_ENTRY_CONCRETE'
28:03.07 NS_IMPL_QUERY_BODY_CONCRETE(_class)
28:03.07 ^
28:03.07 /home/icecold/mozilla-central/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:1227:5: note: expanded from macro 'NS_IMPL_QUERY_BODY_CONCRETE'
28:03.07 } else
28:03.07 ^
turned NS_INTERFACE_MAP_ENTRY_CONCRETE(AltSvcTransactionParent) into
AltSvcTransactionParent)
Updated•5 years ago
|
Flags: needinfo?(bpostelnicu)
See Also: → https://bugs.llvm.org/show_bug.cgi?id=50713
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Here is a more general problem with how this checker treats macro definitions, instead of trying an autofix it should branch out by not giving a solution, since in this context we cannot guarantee that there is a solution.
Updated•5 years ago
|
Priority: -- → P3
Updated•4 years ago
|
Severity: -- → S3
Updated•4 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•