BUG: Fix -Wunused-but-set-variable warnings for assert statements

Using NDEBUG preprocessor macro

Change-Id: Ia85b1b0405ecc9d4f2781abe691b7dbecf233370
Merge topic '14497-fix-compiler-warnings' into next

ce50578 BUG: Fix -Wunused-but-set-variable warnings for assert statements