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/DoNotOptimize.h b/tests/DoNotOptimize.h
new file mode 100644
index 0000000..711d339
--- /dev/null
+++ b/tests/DoNotOptimize.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+// From <benchmark/benchmark.h>.
+template <class Tp>
+static inline void DoNotOptimize(Tp const& value) {
+  asm volatile("" : : "r,m"(value) : "memory");
+}
+template <class Tp>
+static inline void DoNotOptimize(Tp& value) {
+  asm volatile("" : "+r,m"(value) : : "memory");
+}