Skip to contentSkip to conversation

NFS: remove trailing semicolon in macro definition

PATCH In review [email protected] 2 participants 4 messages Nov 28, 2020 – Nov 29, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: remove trailing semicolon in macro definition

From: Tom Rix <[email protected]>

The macro use will already have a semicolon.

---
 net/sunrpc/auth_gss/gss_generic_token.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_generic_token.c +1 -1
index fe97f3106536..9ae22d797390 100644
@@ -46,7 +46,7 @@
 /* TWRITE_STR from gssapiP_generic.h */
 #define TWRITE_STR(ptr, str, len) \
 	memcpy((ptr), (char *) (str), (len)); \
-	(ptr) += (len);
+	(ptr) += (len)
 
 /* XXXX this code currently makes the assumption that a mech oid will
    never be longer than 127 bytes.  This assumption is not inherent in
Signature · 1 line
2.18.4
#1 lore raw

Hi Tom,

Quoted 20 lines · On Fri, 2020-11-27 at 11:43 -0800, [email protected] wrote:

From: Tom Rix <[email protected]>

The macro use will already have a semicolon.

---
 net/sunrpc/auth_gss/gss_generic_token.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_generic_token.c +1 -1
index fe97f3106536..9ae22d797390 100644
@@ -46,7 +46,7 @@
  /* TWRITE_STR from gssapiP_generic.h */
  #define TWRITE_STR(ptr, str, len) \
         memcpy((ptr), (char *) (str), (len)); \
-       (ptr) += (len);
+       (ptr) += (len)
Quoted 5 lines


 /* XXXX this code currently makes the assumption that a mech oid will
    never be longer than 127 bytes.  This assumption is not inherent in

There is exactly 1 use of this macro in the code AFAICS. Can we please just get rid of it, and make the code trivially easier to read?

Thanks
Trond

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
#2 lore raw
Quoted 25 lines · Trond Myklebust

Hi Tom,

Quoted 22 lines · On Fri, 2020-11-27 at 11:43 -0800, [email protected] wrote:

From: Tom Rix <[email protected]>

The macro use will already have a semicolon.

---
 net/sunrpc/auth_gss/gss_generic_token.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_generic_token.c +1 -1
index fe97f3106536..9ae22d797390 100644
@@ -46,7 +46,7 @@
  /* TWRITE_STR from gssapiP_generic.h */
  #define TWRITE_STR(ptr, str, len) \
         memcpy((ptr), (char *) (str), (len)); \
-       (ptr) += (len);
+       (ptr) += (len)


 /* XXXX this code currently makes the assumption that a mech oid

Quoted 9 lines
Quoted 4 lines

will
    never be longer than 127 bytes.  This assumption is not inherent
in

There is exactly 1 use of this macro in the code AFAICS. Can we please
just get rid of it, and make the code trivially easier to read?

BTW: To illustrate just how obfuscating this kind of macro can be, note that the line you are changing above will be completely optimised away in the 1 use case we're talking about. It is bumping a pointer value that immediately gets discarded.

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
author
#3 lore raw
Quoted 35 lines · Trond Myklebust
Quoted 24 lines · Trond Myklebust

Hi Tom,

Quoted 21 lines · On Fri, 2020-11-27 at 11:43 -0800, [email protected] wrote:

From: Tom Rix <[email protected]>

The macro use will already have a semicolon.

---
 net/sunrpc/auth_gss/gss_generic_token.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_generic_token.c +1 -1
index fe97f3106536..9ae22d797390 100644
@@ -46,7 +46,7 @@
  /* TWRITE_STR from gssapiP_generic.h */
  #define TWRITE_STR(ptr, str, len) \
         memcpy((ptr), (char *) (str), (len)); \
-       (ptr) += (len);
+       (ptr) += (len)

Quoted 9 lines
Quoted 5 lines

 /* XXXX this code currently makes the assumption that a mech oid will
    never be longer than 127 bytes.  This assumption is not inherent
in

There is exactly 1 use of this macro in the code AFAICS. Can we please
just get rid of it, and make the code trivially easier to read?

Quoted 4 lines

BTW: To illustrate just how obfuscating this kind of macro can be, note that the line you are changing above will be completely optimised away in the 1 use case we're talking about. It is bumping a pointer value that immediately gets discarded.

Yes, I agree.

I was wondering about expanding treewide, all the single shot macros defined/used in c files.

other fixers that cleanup unused variables would remove the unneeded expansions like this one.