config: clean up some of the macro definition

Unify the definition of `_LIBUNWIND_LOG_NON_ZERO` to make it clear what
it is defined to and make the definition unconditional.  Reorder the
debug and tracing macros to be defined in the same order.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@292720 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/config.h b/src/config.h
index 4e4dd99..8a6dff0 100644
--- a/src/config.h
+++ b/src/config.h
@@ -85,22 +85,32 @@
     fflush(stderr);                                                            \
     abort();                                                                   \
   } while (0)
-#define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
+
+#define _LIBUNWIND_LOG(msg, ...)                                               \
+  fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
 
 #if defined(_LIBUNWIND_HAS_NO_THREADS)
   // only used with pthread calls, not needed for the single-threaded builds
   #define _LIBUNWIND_LOG_NON_ZERO(x)
+#else
+  #if defined(NDEBUG)
+    #define _LIBUNWIND_LOG_NON_ZERO(x) x
+  #else
+    #define _LIBUNWIND_LOG_NON_ZERO(x)                                         \
+      do {                                                                     \
+        int _err = x;                                                          \
+        if (_err != 0)                                                         \
+          _LIBUNWIND_LOG("" #x "=%d in %s", _err, __FUNCTION__);               \
+      } while (0)
+  #endif
 #endif
 
 // Macros that define away in non-Debug builds
 #ifdef NDEBUG
   #define _LIBUNWIND_DEBUG_LOG(msg, ...)
   #define _LIBUNWIND_TRACE_API(msg, ...)
-  #define _LIBUNWIND_TRACING_UNWINDING 0
+  #define _LIBUNWIND_TRACING_UNWINDING (0)
   #define _LIBUNWIND_TRACE_UNWINDING(msg, ...)
-  #ifndef _LIBUNWIND_LOG_NON_ZERO
-    #define _LIBUNWIND_LOG_NON_ZERO(x) x
-  #endif
 #else
   #ifdef __cplusplus
     extern "C" {
@@ -111,23 +121,17 @@
     }
   #endif
   #define _LIBUNWIND_DEBUG_LOG(msg, ...)  _LIBUNWIND_LOG(msg, __VA_ARGS__)
-  #ifndef _LIBUNWIND_LOG_NON_ZERO
-    #define _LIBUNWIND_LOG_NON_ZERO(x) \
-              do { \
-                int _err = x; \
-                if ( _err != 0 ) \
-                  _LIBUNWIND_LOG("" #x "=%d in %s", _err, __FUNCTION__); \
-               } while (0)
-  #endif
-  #define _LIBUNWIND_TRACE_API(msg, ...) \
-            do { \
-              if ( logAPIs() ) _LIBUNWIND_LOG(msg, __VA_ARGS__); \
-            } while(0)
-  #define _LIBUNWIND_TRACE_UNWINDING(msg, ...) \
-            do { \
-              if ( logUnwinding() ) _LIBUNWIND_LOG(msg, __VA_ARGS__); \
-            } while(0)
+  #define _LIBUNWIND_TRACE_API(msg, ...)                                       \
+    do {                                                                       \
+      if (logAPIs())                                                           \
+        _LIBUNWIND_LOG(msg, __VA_ARGS__);                                      \
+    } while (0)
   #define _LIBUNWIND_TRACING_UNWINDING logUnwinding()
+  #define _LIBUNWIND_TRACE_UNWINDING(msg, ...)                                 \
+    do {                                                                       \
+      if (logUnwinding())                                                      \
+        _LIBUNWIND_LOG(msg, __VA_ARGS__);                                      \
+    } while (0)
 #endif
 
 #ifdef __cplusplus