Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: clean up argument handling



details:   https://anonhg.NetBSD.org/src/rev/49ee52d4c54c
branches:  trunk
changeset: 988652:49ee52d4c54c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 08 20:07:44 2021 +0000

description:
indent: clean up argument handling

Sort the macros, remove redundancy from comment.

Remove redundant lint comment. Lint still does not recognize
__attribute__((__noreturn__)), but it also doesn't perform advanced
control flow analysis, so there is no point in having the comment, as it
doesn't suppress any warnings.

No functional change.

diffstat:

 usr.bin/indent/args.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r f42dafbf1032 -r 49ee52d4c54c usr.bin/indent/args.c
--- a/usr.bin/indent/args.c     Fri Oct 08 20:04:26 2021 +0000
+++ b/usr.bin/indent/args.c     Fri Oct 08 20:07:44 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: args.c,v 1.53 2021/10/08 19:27:20 rillig Exp $ */
+/*     $NetBSD: args.c,v 1.54 2021/10/08 20:07:44 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.53 2021/10/08 19:27:20 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.54 2021/10/08 20:07:44 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -66,12 +66,13 @@
 #else
 #define assert_type(expr, type) (expr)
 #endif
+
 #define bool_option(name, value, var) \
        {name, true, value, false, assert_type(&(opt.var), bool *)}
+#define bool_options(name, var) \
+       {name, true, false, true, assert_type(&(opt.var), bool *)}
 #define int_option(name, var) \
        {name, false, false, false, assert_type(&(opt.var), int *)}
-#define bool_options(name, var) \
-       {name, true, false, true, assert_type(&(opt.var), bool *)}
 
 /*
  * N.B.: an option whose name is a prefix of another option must come earlier;
@@ -80,7 +81,7 @@
  * See set_special_option for special options.
  */
 static const struct pro {
-    const char p_name[5];      /* name, e.g. "bl", "cli" */
+    const char p_name[5];      /* e.g. "bl", "cli" */
     bool p_is_bool;
     bool p_bool_value;
     bool p_may_negate;
@@ -227,7 +228,6 @@
     if (strncmp(arg, "-version", 8) == 0) {
        printf("FreeBSD indent %s\n", INDENT_VERSION);
        exit(0);
-       /* NOTREACHED */
     }
 
     if (arg[0] == 'P' || strncmp(arg, "npro", 4) == 0)



Home | Main Index | Thread Index | Old Index