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: clean up comments and variable nam...



details:   https://anonhg.NetBSD.org/src/rev/b0cb5f9ce527
branches:  trunk
changeset: 950264:b0cb5f9ce527
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 23 18:30:29 2021 +0000

description:
lint: clean up comments and variable names in lex.c

diffstat:

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

diffs (120 lines):

diff -r f65d8cd0c349 -r b0cb5f9ce527 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Jan 23 17:58:03 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Jan 23 18:30:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.1 2021/01/23 17:58:03 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.2 2021/01/23 18:30:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.1 2021/01/23 17:58:03 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.2 2021/01/23 18:30:29 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -885,14 +885,14 @@
  * Read a character which is part of a character constant or of a string
  * and handle escapes.
  *
- * The Argument is the character which delimits the character constant or
+ * The argument is the character which delimits the character constant or
  * string.
  *
  * Returns -1 if the end of the character constant or string is reached,
  * -2 if the EOF is reached, and the character otherwise.
  */
 static int
-getescc(int d)
+getescc(int delim)
 {
        static  int pbc = -1;
        int     n, c, v;
@@ -903,7 +903,7 @@
                c = pbc;
                pbc = -1;
        }
-       if (c == d)
+       if (c == delim)
                return -1;
        switch (c) {
        case '\n':
@@ -918,7 +918,7 @@
        case '\\':
                switch (c = inpc()) {
                case '"':
-                       if (tflag && d == '\'')
+                       if (tflag && delim == '\'')
                                /* \" inside character constants undef... */
                                warning(262);
                        return '"';
@@ -1002,7 +1002,7 @@
                        }
                        return v;
                case '\n':
-                       return getescc(d);
+                       return getescc(delim);
                case EOF:
                        return -2;
                default:
@@ -1045,6 +1045,7 @@
  * Called for preprocessor directives. Currently implemented are:
  *     # lineno
  *     # lineno "filename"
+ *     # lineno "filename" GCC-flag...
  */
 void
 lex_directive(const char *yytext)
@@ -1113,19 +1114,8 @@
 }
 
 /*
- * Handle lint comments. Following comments are currently understood:
- *     ARGSUSEDn
- *     BITFIELDTYPE
- *     CONSTCOND CONSTANTCOND CONSTANTCONDITION
- *     FALLTHRU FALLTHROUGH
- *     LINTLIBRARY
- *     LINTEDn NOSTRICTn
- *     LONGLONG
- *     NOTREACHED
- *     PRINTFLIKEn
- *     PROTOLIB
- *     SCANFLIKEn
- *     VARARGSn
+ * Handle lint comments such as ARGSUSED.
+ *
  * If one of these comments is recognized, the argument, if any, is
  * parsed and a function which handles this comment is called.
  */
@@ -1367,7 +1357,7 @@
  * declared due to syntax errors. To avoid too many problems in this
  * case, symbols get type int in getsym().
  *
- * XXX calls to getsym() should be delayed until decl1*() is called
+ * XXX calls to getsym() should be delayed until decl1*() is called.
  */
 sym_t *
 getsym(sbuf_t *sb)
@@ -1504,7 +1494,7 @@
 }
 
 /*
- * Put a symbol into the symbol table
+ * Put a symbol into the symbol table.
  */
 void
 inssym(int bl, sym_t *sym)
@@ -1522,7 +1512,8 @@
 }
 
 /*
- * Called at level 0 after syntax errors
+ * Called at level 0 after syntax errors.
+ *
  * Removes all symbols which are not declared at level 0 from the
  * symbol table. Also frees all memory which is not associated with
  * level 0.



Home | Main Index | Thread Index | Old Index