Move declarations to follow their definitions

Helpfully, the only "error" this caused was the compiler not realizing
any more than some of the arguments are printf formats...

Change-Id: I783a0ce04777c4ccfc48085f31f647a429bdd73b
diff --git a/aos/common/logging/BUILD b/aos/common/logging/BUILD
index 9223c44..78d1cbd 100644
--- a/aos/common/logging/BUILD
+++ b/aos/common/logging/BUILD
@@ -71,14 +71,11 @@
   srcs = [
     'logging_interface.cc',
   ],
-  copts = [
-    # TODO(austin): This is wrong.
-    '-Wno-error=format-nonliteral'
-  ],
   deps = [
     '//aos/common:die',
     '//aos/common/libc:aos_strerror',
     '//aos/linux_code/logging:linux_interface',
+    '//aos/common:macros',
   ],
 )
 
diff --git a/aos/common/logging/logging_impl.h b/aos/common/logging/logging_impl.h
index ab4b728..5fdeec7 100644
--- a/aos/common/logging/logging_impl.h
+++ b/aos/common/logging/logging_impl.h
@@ -106,18 +106,6 @@
   return LOG_UNKNOWN;
 }
 
-// Takes a message and logs it. It will set everything up and then call DoLog
-// for the current LogImplementation.
-void VLog(log_level level, const char *format, va_list ap)
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 2, 0)));
-// Adds to the saved up message.
-void VCork(int line, const char *function, const char *format, va_list ap)
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0)));
-// Actually logs the saved up message.
-void VUnCork(int line, const char *function, log_level level, const char *file,
-             const char *format, va_list ap)
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 5, 0)));
-
 // Will call VLog with the given arguments for the next logger in the chain.
 void LogNext(log_level level, const char *format, ...)
   __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 2, 3)));
@@ -217,18 +205,6 @@
 // Prints message to output.
 void PrintMessage(FILE *output, const LogMessage &message);
 
-// Prints format (with ap) into output and correctly deals with the result
-// being too long etc.
-size_t ExecuteFormat(char *output, size_t output_size, const char *format,
-                     va_list ap)
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0)));
-
-// Runs the given function with the current LogImplementation (handles switching
-// it out while running function etc).
-// levels is how many LogImplementations to not use off the stack.
-void RunWithCurrentImplementation(
-    int levels, ::std::function<void(LogImplementation *)> function);
-
 }  // namespace internal
 }  // namespace logging
 }  // namespace aos
diff --git a/aos/common/logging/logging_interface.h b/aos/common/logging/logging_interface.h
index af591ee..97587bf 100644
--- a/aos/common/logging/logging_interface.h
+++ b/aos/common/logging/logging_interface.h
@@ -7,6 +7,7 @@
 #include <functional>
 
 #include "aos/common/logging/logging.h"
+#include "aos/common/macros.h"
 
 namespace aos {
 
@@ -17,6 +18,18 @@
 namespace aos {
 namespace logging {
 
+// Takes a message and logs it. It will set everything up and then call DoLog
+// for the current LogImplementation.
+void VLog(log_level level, const char *format, va_list ap)
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 2, 0)));
+// Adds to the saved up message.
+void VCork(int line, const char *function, const char *format, va_list ap)
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0)));
+// Actually logs the saved up message.
+void VUnCork(int line, const char *function, log_level level, const char *file,
+             const char *format, va_list ap)
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 5, 0)));
+
 // Represents a system that can actually take log messages and do something
 // useful with them.
 // All of the code (transitively too!) in the DoLog here can make
@@ -90,6 +103,21 @@
   LogImplementation *next_;
 };
 
+namespace internal {
+
+// Prints format (with ap) into output and correctly deals with the result
+// being too long etc.
+size_t ExecuteFormat(char *output, size_t output_size, const char *format,
+                     va_list ap)
+    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 3, 0)));
+
+// Runs the given function with the current LogImplementation (handles switching
+// it out while running function etc).
+// levels is how many LogImplementations to not use off the stack.
+void RunWithCurrentImplementation(
+    int levels, ::std::function<void(LogImplementation *)> function);
+
+}  // namespace internal
 }  // namespace logging
 }  // namespace aos