Suppress unused return values when using -c opt.

Change-Id: I9cfe54f1b71d4b2b5e321cd09282db2852664377
diff --git a/aos/common/libc/aos_strerror.cc b/aos/common/libc/aos_strerror.cc
index 2c9735d..c91fd00 100644
--- a/aos/common/libc/aos_strerror.cc
+++ b/aos/common/libc/aos_strerror.cc
@@ -24,7 +24,11 @@
 __attribute__((unused))
 char *aos_strerror_handle_result(int error, int ret, char *buffer) {
   if (ret != 0) {
-    const int r = snprintf(buffer, kBufferSize, "Unknown error %d", error);
+#ifndef NDEBUG
+    // assert doesn't use the return value when building optimized.
+    const int r =
+#endif
+        snprintf(buffer, kBufferSize, "Unknown error %d", error);
     assert(r > 0);
   }
   return buffer;