Revert "Revert "refs #8752. Cpp check issue around if.""

This reverts commit f9b415ab8b6f4108022cad31c0f839bcd71d0702.
refs #8752. Warning is not required.