diff mbox series

NFS: remove trailing semicolon in macro definition

Message ID 20201127194325.2881566-1-trix@redhat.com (mailing list archive)
State New, archived
Headers show
Series NFS: remove trailing semicolon in macro definition | expand

Commit Message

Tom Rix Nov. 27, 2020, 7:43 p.m. UTC
From: Tom Rix <trix@redhat.com>

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 net/sunrpc/auth_gss/gss_generic_token.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Trond Myklebust Nov. 29, 2020, 4:42 p.m. UTC | #1
Hi Tom,

On Fri, 2020-11-27 at 11:43 -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> The macro use will already have a semicolon.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  net/sunrpc/auth_gss/gss_generic_token.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/auth_gss/gss_generic_token.c
> b/net/sunrpc/auth_gss/gss_generic_token.c
> index fe97f3106536..9ae22d797390 100644
> --- a/net/sunrpc/auth_gss/gss_generic_token.c
> +++ b/net/sunrpc/auth_gss/gss_generic_token.c
> @@ -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

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
Trond Myklebust Nov. 29, 2020, 4:50 p.m. UTC | #2
On Sun, 2020-11-29 at 16:42 +0000, Trond Myklebust wrote:
> Hi Tom,
> 
> On Fri, 2020-11-27 at 11:43 -0800, trix@redhat.com wrote:
> > From: Tom Rix <trix@redhat.com>
> > 
> > The macro use will already have a semicolon.
> > 
> > Signed-off-by: Tom Rix <trix@redhat.com>
> > ---
> >  net/sunrpc/auth_gss/gss_generic_token.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/sunrpc/auth_gss/gss_generic_token.c
> > b/net/sunrpc/auth_gss/gss_generic_token.c
> > index fe97f3106536..9ae22d797390 100644
> > --- a/net/sunrpc/auth_gss/gss_generic_token.c
> > +++ b/net/sunrpc/auth_gss/gss_generic_token.c
> > @@ -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
> 
> 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.
Tom Rix Nov. 29, 2020, 5:07 p.m. UTC | #3
On 11/29/20 8:50 AM, Trond Myklebust wrote:
> On Sun, 2020-11-29 at 16:42 +0000, Trond Myklebust wrote:
>> Hi Tom,
>>
>> On Fri, 2020-11-27 at 11:43 -0800, trix@redhat.com wrote:
>>> From: Tom Rix <trix@redhat.com>
>>>
>>> The macro use will already have a semicolon.
>>>
>>> Signed-off-by: Tom Rix <trix@redhat.com>
>>> ---
>>>  net/sunrpc/auth_gss/gss_generic_token.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/net/sunrpc/auth_gss/gss_generic_token.c
>>> b/net/sunrpc/auth_gss/gss_generic_token.c
>>> index fe97f3106536..9ae22d797390 100644
>>> --- a/net/sunrpc/auth_gss/gss_generic_token.c
>>> +++ b/net/sunrpc/auth_gss/gss_generic_token.c
>>> @@ -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
>> 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.

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.
diff mbox series

Patch

diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c
index fe97f3106536..9ae22d797390 100644
--- a/net/sunrpc/auth_gss/gss_generic_token.c
+++ b/net/sunrpc/auth_gss/gss_generic_token.c
@@ -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