This story goes back to 2015, when Haiku OS and PVS-Studio static analyzer developers decided to join forces and improve this OS code quality. At first it was more like an experiment, as there was no Linux analyzer at that time and the team had to work only with the compiled executable analyzer file. The entire infrastructure for parsing compiler parameters, running preprocessor, analysis paralleling and so on was taken from the Compiler Monitoring UI utility in C#, which was ported in parts to the Mono platform in order to be run in Linux.
haiku
Haiku (BeOS Family)
BUG OF THE MONTH | Memory handling
Continue reading
Start using static code analysis
Fragment taken from the Haiku project (inheritor of BeOS). The code contains an error that analyzer diagnoses in the following way: V501 There are identical sub-expressions to the left and to the right of the ‘<‘ operator: lJack->m_jackType < lJack->m_jackType Continue reading
Beware of the ‘continue’ operator inside do {…} while (…)
Fragment taken from the Haiku project (inheritor of BeOS). The code contains an error that analyzer diagnoses in the following way: V696 The ‘continue’ operator will terminate ‘do { … } while (FALSE)’ loop because the condition is always false. Continue reading
Beware of the ?: operator and enclose it in parentheses
Fragment taken from the Haiku project (inheritor of BeOS). The error is detected by the following diagnostic: V502 Perhaps the ‘?:’ operator works in a different way than it was expected. The ‘?:’ operator has a lower priority than the ‘-‘ operator. Continue reading