Omit unnecessary checks

This is a repost of https://github.com/danmar/cppcheck/pull/357 with two commits combined