Updating from version 6 -> 8 from upstream. Declarations for variables and function bodies were added to avoid unnecessary failures with -Werror. (cherry picked from commit 4cc91ceb3992ef4f51302b56178c3b2c2aeaaaad)