Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/xlint lint: merge duplicate code for passing f...



details:   https://anonhg.NetBSD.org/src/rev/9885e9e1cac8
branches:  trunk
changeset: 985334:9885e9e1cac8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Aug 19 16:05:56 2021 +0000

description:
lint: merge duplicate code for passing flags to subprocesses

No functional change.

diffstat:

 usr.bin/xlint/xlint/xlint.c |  34 ++++++++++------------------------
 1 files changed, 10 insertions(+), 24 deletions(-)

diffs (118 lines):

diff -r 7c313528e002 -r 9885e9e1cac8 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Thu Aug 19 15:55:23 2021 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Thu Aug 19 16:05:56 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.73 2021/08/19 15:55:23 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.74 2021/08/19 16:05:56 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: xlint.c,v 1.73 2021/08/19 15:55:23 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.74 2021/08/19 16:05:56 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -394,10 +394,13 @@
                case 'v':
                case 'w':
                case 'z':
+               case 'P':
                        pass_flag_to_lint1(c);
                        break;
 
                case 'A':
+               case 'R':
+               case 'X':
                        pass_flag_to_lint1(c);
                        pass_to_lint1(optarg);
                        break;
@@ -411,11 +414,6 @@
                        pass_flag_to_lint2(c);
                        break;
 
-               case 'X':
-                       pass_flag_to_lint1(c);
-                       pass_to_lint1(optarg);
-                       break;
-
                case 'i':
                        if (Cflag)
                                usage();
@@ -427,21 +425,12 @@
                        break;
 
                case 'p':
-                       pass_flag_to_lint1(c);
-                       pass_flag_to_lint2(c);
                        if (*deflibs != NULL) {
                                list_clear(&deflibs);
                                list_add_copy(&deflibs, "c");
                        }
-                       break;
-
-               case 'P':
                        pass_flag_to_lint1(c);
-                       break;
-
-               case 'R':
-                       pass_flag_to_lint1(c);
-                       pass_to_lint1(optarg);
+                       pass_flag_to_lint2(c);
                        break;
 
                case 's':
@@ -452,16 +441,16 @@
                        list_add_copy(&cpp.lcflags, "-Wtrigraphs");
                        list_add_copy(&cpp.lcflags, "-pedantic");
                        list_add_copy(&cpp.lcflags, "-D__STRICT_ANSI__");
+                       sflag = true;
                        pass_flag_to_lint1(c);
                        pass_flag_to_lint2(c);
-                       sflag = true;
                        break;
 
                case 'S':
                        if (tflag)
                                usage();
+                       Sflag = true;
                        pass_flag_to_lint1(c);
-                       Sflag = true;
                        break;
 
                case 'T':
@@ -474,6 +463,7 @@
                case 't':
                        if (sflag)
                                usage();
+                       tflag = true;
                        list_clear(&cpp.lcflags);
                        list_add_copy(&cpp.lcflags, "-traditional");
                        list_add_copy(&cpp.lcflags, "-Wtraditional");
@@ -481,11 +471,11 @@
                        list_add_copy(&cpp.lcflags, "-D" MACHINE_ARCH);
                        pass_flag_to_lint1(c);
                        pass_flag_to_lint2(c);
-                       tflag = true;
                        break;
 #endif
 
                case 'x':
+               case 'H':
                        pass_flag_to_lint2(c);
                        break;
 
@@ -530,10 +520,6 @@
                        list_add_copy(&libsrchpath, optarg);
                        break;
 
-               case 'H':
-                       pass_flag_to_lint2(c);
-                       break;
-
                case 'B':
                        Bflag = true;
                        libexec_path = xstrdup(optarg);



Home | Main Index | Thread Index | Old Index