From fe6964f010a9881ad323a770e97f17a77e2f2b7f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 10 Aug 2022 00:17:58 -0700 Subject: [PATCH 6/6] maint: parenthesize macro definiens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/intprops.h (INT_ADD_OK, INT_SUBTRACT_OK, INT_MULTIPLY_OK): * lib/pipe-filter-ii.c (GetLastError): * lib/thread-optim.h (gl_multithreaded): Parenthesize function-like macro definiens beginning with a unary operator; needed for weird invocations like ‘m (...)[p]’. --- ChangeLog | 9 +++++++++ lib/intprops.h | 6 +++--- lib/pipe-filter-ii.c | 2 +- lib/thread-optim.h | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5293fc104f..f9499921dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2022-08-10 Paul Eggert + + maint: parenthesize macro definiens + * lib/intprops.h (INT_ADD_OK, INT_SUBTRACT_OK, INT_MULTIPLY_OK): + * lib/pipe-filter-ii.c (GetLastError): + * lib/thread-optim.h (gl_multithreaded): Parenthesize + function-like macro definiens beginning with a unary operator; + needed for weird invocations like ‘m (...)[p]’. + 2022-08-09 Paul Eggert stdckdint: prefer to intprops when easy diff --git a/lib/intprops.h b/lib/intprops.h index b911384532..f182ddc1fe 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -328,8 +328,8 @@ These macros are tuned for B being a constant. */ -#define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r) -#define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r) -#define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r) +#define INT_ADD_OK(a, b, r) (! INT_ADD_WRAPV (a, b, r)) +#define INT_SUBTRACT_OK(a, b, r) (! INT_SUBTRACT_WRAPV (a, b, r)) +#define INT_MULTIPLY_OK(a, b, r) (! INT_MULTIPLY_WRAPV (a, b, r)) #endif /* _GL_INTPROPS_H */ diff --git a/lib/pipe-filter-ii.c b/lib/pipe-filter-ii.c index 8f547791c6..06729584f0 100644 --- a/lib/pipe-filter-ii.c +++ b/lib/pipe-filter-ii.c @@ -98,7 +98,7 @@ CloseHandle (HANDLE h) # define _endthreadex(x) return (x) # define TerminateThread(h, e) DosKillThread (h->tid) -# define GetLastError() -1 +# define GetLastError() (-1) # ifndef ERROR_NO_DATA # define ERROR_NO_DATA 232 diff --git a/lib/thread-optim.h b/lib/thread-optim.h index daf887fda9..dc1ad8622c 100644 --- a/lib/thread-optim.h +++ b/lib/thread-optim.h @@ -52,7 +52,7 @@ #if HAVE_SYS_SINGLE_THREADED_H /* glibc >= 2.32 */ # include -# define gl_multithreaded() !__libc_single_threaded +# define gl_multithreaded() (!__libc_single_threaded) #else # define gl_multithreaded() 1 #endif -- 2.34.1