Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: remove redundant and duplicate code



details:   https://anonhg.NetBSD.org/src/rev/2b95f53bb108
branches:  trunk
changeset: 985684:2b95f53bb108
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 04 12:37:46 2021 +0000

description:
lint: remove redundant and duplicate code

diffstat:

 usr.bin/xlint/lint1/decl.c |  14 ++++----------
 usr.bin/xlint/lint1/func.c |   7 +++----
 2 files changed, 7 insertions(+), 14 deletions(-)

diffs (63 lines):

diff -r ab88daab2ee4 -r 2b95f53bb108 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Sep 04 12:35:31 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Sep 04 12:37:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.230 2021/09/04 12:30:46 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.231 2021/09/04 12:37:46 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: decl.c,v 1.230 2021/09/04 12:30:46 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.231 2021/09/04 12:37:46 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1771,14 +1771,8 @@
                        dcs->d_next->d_nonempty_decl = true;
                }
        } else {
-               if (tag->s_scl != scl) {
-                       /* %s tag '%s' redeclared as %s */
-                       error(46, storage_class_name(tag->s_scl),
-                           tag->s_name, storage_class_name(scl));
-                       print_previous_declaration(-1, tag);
-                       tag = pushdown(tag);
-                       dcs->d_next->d_nonempty_decl = true;
-               } else if (decl && !is_incomplete(tag->s_type)) {
+               if (tag->s_scl != scl ||
+                   (decl && !is_incomplete(tag->s_type))) {
                        /* %s tag '%s' redeclared as %s */
                        error(46, storage_class_name(tag->s_scl),
                            tag->s_name, storage_class_name(scl));
diff -r ab88daab2ee4 -r 2b95f53bb108 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sat Sep 04 12:35:31 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sat Sep 04 12:37:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.123 2021/09/04 12:30:46 rillig Exp $        */
+/*     $NetBSD: func.c,v 1.124 2021/09/04 12:37:46 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.123 2021/09/04 12:30:46 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.124 2021/09/04 12:37:46 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -603,8 +603,7 @@
 check_controlling_expression(tnode_t *tn)
 {
 
-       if (tn != NULL)
-               tn = cconv(tn);
+       tn = cconv(tn);
        if (tn != NULL)
                tn = promote(NOOP, false, tn);
 



Home | Main Index | Thread Index | Old Index