Skip to contentSkip to conversation

scrpits: Remove unneeded assignment parentheses

PATCH In review Xu Wang 3 participants 3 messages May 21, 2020

Subsystems (2)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 scrpits: Remove unneeded assignment parentheses

Remove unneeded assignment parentheses.

---
 scripts/extract-cert.c | 2 +-
 scripts/sign-file.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/extract-cert.c +1 -1
index b071bf476fea..8005911926b8 100644
@@ -61,7 +61,7 @@ static void drain_openssl_errors(void)
 
 #define ERR(cond, fmt, ...)				\
 	do {						\
-		bool __cond = (cond);			\
+		bool __cond = cond;			\
 		display_openssl_errors(__LINE__);	\
 		if (__cond) {				\
 			err(1, fmt, ## __VA_ARGS__);	\
scripts/sign-file.c +1 -1
index fbd34b8e8f57..9ea08b07a0aa 100644
@@ -104,7 +104,7 @@ static void drain_openssl_errors(void)
 
 #define ERR(cond, fmt, ...)				\
 	do {						\
-		bool __cond = (cond);			\
+		bool __cond = cond;			\
 		display_openssl_errors(__LINE__);	\
 		if (__cond) {				\
 			err(1, fmt, ## __VA_ARGS__);	\
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Xu Wang

Remove unneeded assignment parentheses.

I really don't think this is a good idea. Best practice for macros is to parenthesize every argument even if there are technically some cases where it's unnecessary because the problems in the majority cases are huge and unexpected.

James

Quoted 32 lines
---
 scripts/extract-cert.c | 2 +-
 scripts/sign-file.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/extract-cert.c +1 -1
index b071bf476fea..8005911926b8 100644
@@ -61,7 +61,7 @@ static void drain_openssl_errors(void)
 
 #define ERR(cond, fmt, ...)				\
 	do {						\
-		bool __cond = (cond);			\
+		bool __cond = cond;			\
 		display_openssl_errors(__LINE__);	\
 		if (__cond) {				\
 			err(1, fmt, ## __VA_ARGS__);	\
scripts/sign-file.c +1 -1
index fbd34b8e8f57..9ea08b07a0aa 100644
@@ -104,7 +104,7 @@ static void drain_openssl_errors(void)
 
 #define ERR(cond, fmt, ...)				\
 	do {						\
-		bool __cond = (cond);			\
+		bool __cond = cond;			\
 		display_openssl_errors(__LINE__);	\
 		if (__cond) {				\
 			err(1, fmt, ## __VA_ARGS__);	\
maintainer
#2 lore raw
Quoted 6 lines · James Bottomley
Quoted 1 line

Remove unneeded assignment parentheses.

I really don't think this is a good idea. Best practice for macros is to parenthesize every argument even if there are technically some cases where it's unnecessary because the problems in the majority cases are huge and unexpected.

Yep.

David