Fix bugprone-macro-parentheses warnings
Bug: 150783705
Test: WITH_TIDY=1 make
Change-Id: If47b7adaa5f3ba3c518fb0be48f0ffdc81d204b2
diff --git a/libc/include/bits/posix_limits.h b/libc/include/bits/posix_limits.h
index 8dfea52..452f5f6 100644
--- a/libc/include/bits/posix_limits.h
+++ b/libc/include/bits/posix_limits.h
@@ -37,7 +37,7 @@
#define __BIONIC_POSIX_FEATURE_MISSING (-1)
#define __BIONIC_POSIX_FEATURE_SINCE(level) \
- (((__ANDROID_API__) >= level) ? _POSIX_VERSION : __BIONIC_POSIX_FEATURE_MISSING)
+ (((__ANDROID_API__) >= (level)) ? _POSIX_VERSION : __BIONIC_POSIX_FEATURE_MISSING)
/* Availability macros. */
/* See http://man7.org/linux/man-pages/man7/posixoptions.7.html for documentation. */
@@ -104,15 +104,15 @@
#define _POSIX2_UPE __BIONIC_POSIX_FEATURE_MISSING
#if defined(__LP64__)
-#define _POSIX_V7_ILP32_OFF32 -1
-#define _POSIX_V7_ILP32_OFFBIG -1
+#define _POSIX_V7_ILP32_OFF32 (-1)
+#define _POSIX_V7_ILP32_OFFBIG (-1)
#define _POSIX_V7_LP64_OFF64 1
#define _POSIX_V7_LPBIG_OFFBIG 1
#else
#define _POSIX_V7_ILP32_OFF32 1
-#define _POSIX_V7_ILP32_OFFBIG -1
-#define _POSIX_V7_LP64_OFF64 -1
-#define _POSIX_V7_LPBIG_OFFBIG -1
+#define _POSIX_V7_ILP32_OFFBIG (-1)
+#define _POSIX_V7_LP64_OFF64 (-1)
+#define _POSIX_V7_LPBIG_OFFBIG (-1)
#endif
#define _XOPEN_CRYPT __BIONIC_POSIX_FEATURE_MISSING
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index aa046b9..ba0af3c 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -162,14 +162,14 @@
*
* Available since API level 27.
*/
-#define M_DECAY_TIME -100
+#define M_DECAY_TIME (-100)
/**
* mallopt() option to immediately purge any memory not in use. This
* will release the memory back to the kernel. The value is ignored.
*
* Available since API level 28.
*/
-#define M_PURGE -101
+#define M_PURGE (-101)
/**
* [mallopt(3)](http://man7.org/linux/man-pages/man3/mallopt.3.html) modifies
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 331e92c..8bc897a 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -68,7 +68,7 @@
#define PTHREAD_ONCE_INIT 0
#if __ANDROID_API__ >= 24
-#define PTHREAD_BARRIER_SERIAL_THREAD -1
+#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
#endif
#if defined(__LP64__)
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 9e214e5..b4556a7 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -303,7 +303,7 @@
/* Intended for use in evaluated contexts. */
#define __bos_dynamic_check_impl_and(bos_val, op, index, cond) \
- (bos_val == __BIONIC_FORTIFY_UNKNOWN_SIZE || \
+ ((bos_val) == __BIONIC_FORTIFY_UNKNOWN_SIZE || \
(__builtin_constant_p(index) && bos_val op index && (cond)))
#define __bos_dynamic_check_impl(bos_val, op, index) \
diff --git a/libc/platform/bionic/reserved_signals.h b/libc/platform/bionic/reserved_signals.h
index 4ac6455..3c5bc02 100644
--- a/libc/platform/bionic/reserved_signals.h
+++ b/libc/platform/bionic/reserved_signals.h
@@ -47,9 +47,9 @@
// If you change this, also change __ndk_legacy___libc_current_sigrtmin
// in <android/legacy_signal_inlines.h> to match.
-#define BIONIC_SIGNAL_DEBUGGER __SIGRTMIN + 3
-#define BIONIC_SIGNAL_PROFILER __SIGRTMIN + 4
-#define BIONIC_SIGNAL_FDTRACK __SIGRTMIN + 7
+#define BIONIC_SIGNAL_DEBUGGER (__SIGRTMIN + 3)
+#define BIONIC_SIGNAL_PROFILER (__SIGRTMIN + 4)
+#define BIONIC_SIGNAL_FDTRACK (__SIGRTMIN + 7)
#define __SIGRT_RESERVED 8
static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigset, int how) {
diff --git a/libc/platform/bionic/tls_defines.h b/libc/platform/bionic/tls_defines.h
index 92f707a..78099b3 100644
--- a/libc/platform/bionic/tls_defines.h
+++ b/libc/platform/bionic/tls_defines.h
@@ -80,8 +80,8 @@
// [1] "Addenda to, and Errata in, the ABI for the ARM Architecture". Section 3.
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0045e/IHI0045E_ABI_addenda.pdf
-#define MIN_TLS_SLOT -1 // update this value when reserving a slot
-#define TLS_SLOT_BIONIC_TLS -1
+#define MIN_TLS_SLOT (-1) // update this value when reserving a slot
+#define TLS_SLOT_BIONIC_TLS (-1)
#define TLS_SLOT_DTV 0
#define TLS_SLOT_THREAD_ID 1
#define TLS_SLOT_APP 2 // was historically used for errno