Skip to contentSkip to conversation

Remove extra token after #endif

PATCH In review Lev Stipakov 4 participants 4 messages Nov 9, 2018 – Nov 23, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove extra token after #endif

Commit ee80ce3d6f2ebc59068338757311e0488ae620fc wrapped code in #ifdef/#endif and added extra token after #endif, which produces compiler warning.

This removes unneeded extra token.

---
 src/openvpn/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/init.c +2 -2
index 586e4ca..1cdef31 100644
@@ -624,7 +624,7 @@ save_ncp_options(struct context *c)
     c->c1.ciphername = c->options.ciphername;
     c->c1.authname = c->options.authname;
     c->c1.keysize = c->options.keysize;
-#endif ENABLE_CRYPTO
+#endif
 }
 
 /* Restores NCP-negotiable options to original values */
@@ -635,7 +635,7 @@ restore_ncp_options(struct context *c)
     c->options.ciphername = c->c1.ciphername;
     c->options.authname = c->c1.authname;
     c->options.keysize = c->c1.keysize;
-#endif ENABLE_CRYPTO
+#endif
 }
 
 void
Signature · 1 line
2.7.4
#1 lore raw

Lev Stipakov <[email protected]...> on Fri, 2018/11/09 11:59:

Quoted 16 lines

Commit ee80ce3d6f2ebc59068338757311e0488ae620fc wrapped code in #ifdef/#endif and added extra token after #endif, which produces compiler warning.

This removes unneeded extra token.

---
 src/openvpn/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/init.c +0 -0
index 586e4ca..1cdef31 100644

src/openvpn/init.c save_ncp_options(struct context *c) · line 627

Quoted 5 lines
src/openvpn/init.c +1 -1
@@ -624,7 +624,7 @@ save_ncp_options(struct context *c)
     c->c1.ciphername = c->options.ciphername;
     c->c1.authname = c->options.authname;
     c->c1.keysize = c->options.keysize;
-#endif ENABLE_CRYPTO
+#endif

Perhaps this should go into comment:

#endif /* ENABLE_CRYPTO */

Signature · 3 lines
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
Acked-by on v1 1/1
#2 lore raw
In reply to Lev Stipakov

Thanks.

Regarding Christian's comment about "#endif" vs. "#endif /* ENABLE_CRYPTO /*"
- well, we have both in our tree, so neither is "correct" or "wrong".

For such a short #ifdef/#endif span, I'd see it as optional because the corresponding #ifdef is easily spotted. For something spanning more code, possibly nested #ifdef, a comment after the #endif would definitely be better, though.

Your patch has been applied to the release/2.4 branch.

commit ca962f3837ab05b0e8a4382960391f289497eaa2

Author: Lev Stipakov
Date:   Fri Nov 9 11:59:33 2018 +0200
     Remove extra token after #endif

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg17883.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#3 lore raw
Quoted 8 lines · Gert Doering

Regarding Christian's comment about "#endif" vs. "#endif /* ENABLE_CRYPTO /*"
- well, we have both in our tree, so neither is "correct" or "wrong".

For such a short #ifdef/#endif span, I'd see it as optional because the corresponding #ifdef is easily spotted. For something spanning more code, possibly nested #ifdef, a comment after the #endif would definitely be better, though.

Just FTR; I share this point of view. We've not been too picky about these #endif remarks in the past but something we saw more of after the big reformatting commit right before the v2.4.0 release.

We used these uncrustify settings for the great reformatting patch:

-------------------
# Annotate #else and #endif statements
mod_add_long_ifdef_endif_comment=20
mod_add_long_ifdef_else_comment=5
-------------------

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc