Skip to content

Redefine Poco assertions for static analysis#1315

Merged
obiltschnig merged 1 commit intopocoproject:developfrom
kimgr:bugcheck-abort
Sep 14, 2016
Merged

Redefine Poco assertions for static analysis#1315
obiltschnig merged 1 commit intopocoproject:developfrom
kimgr:bugcheck-abort

Conversation

@kimgr
Copy link
Copy Markdown
Contributor

@kimgr kimgr commented Jul 15, 2016

Static analyzers typically don't do cross-translation unit analysis, so
they don't understand that most of the Poco::Bugcheck methods never
return.

Unfortunately, some of them also don't understand noreturn annotations
(see e.g. http://en.cppreference.com/w/cpp/language/attributes), so
decorating Bugcheck doesn't help.

Instead redefine all the Poco assertion macros to just call abort() iff
we're parsed by a known static analyzer.

Static analyzers typically don't do cross-translation unit analysis, so
they don't understand that most of the Poco::Bugcheck methods never
return.

Unfortunately, some of them also don't understand noreturn annotations
(see e.g. http://en.cppreference.com/w/cpp/language/attributes), so
decorating Bugcheck doesn't help.

Instead redefine all the Poco assertion macros to just call abort() iff
we're parsed by a known static analyzer.
@kimgr
Copy link
Copy Markdown
Contributor Author

kimgr commented Jul 15, 2016

Not sure if this is something you could consider for upstream. We're carrying a local patch which reduces false positives from static analyzers quite a lot.

@kimgr
Copy link
Copy Markdown
Contributor Author

kimgr commented Sep 14, 2016

Friendly ping!

@obiltschnig obiltschnig merged commit f0402f2 into pocoproject:develop Sep 14, 2016
@obiltschnig
Copy link
Copy Markdown
Member

Was actually stumbling across the same issue lately ;-)

@kimgr
Copy link
Copy Markdown
Contributor Author

kimgr commented Sep 14, 2016

Great, thanks!

obiltschnig added a commit that referenced this pull request Sep 14, 2016
@obiltschnig obiltschnig added this to the Release 1.7.6 milestone Sep 14, 2016
@obiltschnig obiltschnig self-assigned this Sep 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants