Module Name: src Committed By: rillig Date: Sat Sep 4 12:37:46 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: decl.c func.c Log Message: lint: remove redundant and duplicate code To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/func.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.230 src/usr.bin/xlint/lint1/decl.c:1.231 --- src/usr.bin/xlint/lint1/decl.c:1.230 Sat Sep 4 12:30:46 2021 +++ src/usr.bin/xlint/lint1/decl.c Sat Sep 4 12:37:46 2021 @@ -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 @@ newtag(sym_t *tag, scl_t scl, bool decl, 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)); Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.123 src/usr.bin/xlint/lint1/func.c:1.124 --- src/usr.bin/xlint/lint1/func.c:1.123 Sat Sep 4 12:30:46 2021 +++ src/usr.bin/xlint/lint1/func.c Sat Sep 4 12:37:46 2021 @@ -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 @@ static tnode_t * check_controlling_expression(tnode_t *tn) { - if (tn != NULL) - tn = cconv(tn); + tn = cconv(tn); if (tn != NULL) tn = promote(NOOP, false, tn);