Revert^4 "Use DoNotOptimize rather than rely on a volatile."

The previous code used a volatile to avoid optimizing away
the strlen, but it can trigger the unused variable warning.
Instead use DoNotOptimize to avoid the code being optimized away.

Break out the DoNotOptimize into it's own header since the entirety
of utils.h cannot be included here without getting compile errors.
Add the new include to all tests that use DoNotOptimize.

Change-Id: Ica91ed6511ed6075cc6943c1036f82c5ee428830
Test: Tests build and pass.
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 105c261..da7926d 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -91,6 +91,8 @@
 
 #include <array>
 
+#include "DoNotOptimize.h"
+
 #ifndef COMPILATION_TESTS
 #include <android-base/silent_death_test.h>
 #include <gtest/gtest.h>
@@ -146,8 +148,7 @@
     for (char& c : contents) {
       c ^= always_zero;
     }
-    // Store in a volatile, so the strlen itself cannot be optimized out.
-    volatile size_t _strlen_result = strlen(&contents.front());
+    DoNotOptimize(strlen(&contents.front()));
   };
 
   EXPECT_NO_DEATH(run_strlen_with_contents({'f', 'o', '\0'}));