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: condense code for writing the .ln ...



details:   https://anonhg.NetBSD.org/src/rev/111c1ab70ad4
branches:  trunk
changeset: 1022807:111c1ab70ad4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 08 10:41:34 2021 +0000

description:
lint: condense code for writing the .ln files

No functional change.

diffstat:

 usr.bin/xlint/lint1/emit1.c |  37 ++++++++++++++-----------------------
 1 files changed, 14 insertions(+), 23 deletions(-)

diffs (75 lines):

diff -r a6326f05ba9f -r 111c1ab70ad4 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sun Aug 08 10:32:26 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sun Aug 08 10:41:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.47 2021/07/31 19:52:44 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.48 2021/08/08 10:41:34 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: emit1.c,v 1.47 2021/07/31 19:52:44 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.48 2021/08/08 10:41:34 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -227,26 +227,19 @@
 
        /* flags */
 
-       switch (def) {
-       case DEF:
-               /* defined */
-               outchar('d');
-               break;
-       case TDEF:
-               /* tentative defined */
-               outchar('t');
-               break;
-       case DECL:
-               /* declared */
-               outchar('e');
-               break;
-       default:
-               lint_assert(/*CONSTCOND*/false);
+       if (def == DEF)
+               outchar('d');   /* defined */
+       else if (def == TDEF)
+               outchar('t');   /* tentative defined */
+       else {
+               lint_assert(def == DECL);
+               outchar('e');   /* declared */
        }
+
        if (llibflg && def != DECL) {
                /*
-                * mark it as used so we get no warnings from lint2 about
-                * unused symbols in libraries.
+                * mark it as used so lint2 does not complain about
+                * unused symbols in libraries
                 */
                outchar('u');
        }
@@ -327,8 +320,7 @@
        outchar('d');
 
        if (rval)
-               /* has return value */
-               outchar('r');
+               outchar('r');   /* has return value */
 
        if (llibflg)
                /*
@@ -338,8 +330,7 @@
                outchar('u');
 
        if (osdef)
-               /* old style function definition */
-               outchar('o');
+               outchar('o');   /* old style function definition */
 
        if (fsym->s_inline)
                outchar('i');



Home | Main Index | Thread Index | Old Index