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 member names of control_s...
details: https://anonhg.NetBSD.org/src/rev/a96a82f31383
branches: trunk
changeset: 950165:a96a82f31383
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Jan 18 19:24:09 2021 +0000
description:
lint: clean up member names of control_structure and comments
diffstat:
usr.bin/xlint/lint1/cgram.y | 7 ++++---
usr.bin/xlint/lint1/decl.c | 18 +++++++++---------
usr.bin/xlint/lint1/func.c | 34 +++++++++++++++-------------------
usr.bin/xlint/lint1/lint1.h | 6 +++---
4 files changed, 31 insertions(+), 34 deletions(-)
diffs (240 lines):
diff -r 567b6be2dfbe -r a96a82f31383 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Mon Jan 18 19:21:52 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Mon Jan 18 19:24:09 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.156 2021/01/18 18:53:28 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.157 2021/01/18 19:24:09 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.156 2021/01/18 18:53:28 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.157 2021/01/18 19:24:09 rillig Exp $");
#endif
#include <limits.h>
@@ -2085,7 +2085,8 @@
/*
* Gets a node for a constant and returns the value of this constant
* as integer.
- * Is the node not constant or too large for int or of type float,
+ *
+ * If the node is not constant or too large for int or of type float,
* a warning will be printed.
*
* toicon() should be used only inside declarations. If it is used in
diff -r 567b6be2dfbe -r a96a82f31383 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Mon Jan 18 19:21:52 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Mon Jan 18 19:24:09 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.130 2021/01/18 19:24:09 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.129 2021/01/18 19:21:52 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.130 2021/01/18 19:24:09 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1287,7 +1287,7 @@
* The following 3 functions extend the type of a declarator with
* pointer, function and array types.
*
- * The current type is the Type built by deftyp() (dcs->d_type) and
+ * The current type is the type built by deftyp() (dcs->d_type) and
* pointer, function and array types already added for this
* declarator. The new type extension is inserted between both.
*/
@@ -1464,8 +1464,8 @@
}
/*
- * Lists of Identifiers in functions declarations are allowed only if
- * it's also a function definition. If this is not the case, print a
+ * Lists of identifiers in functions declarations are allowed only if
+ * it's also a function definition. If this is not the case, print an
* error message.
*/
void
@@ -1580,7 +1580,7 @@
}
/*
- * Process a name in the list of formal params in an old style function
+ * Process a name in the list of formal parameters in an old style function
* definition.
*/
sym_t *
@@ -1614,7 +1614,7 @@
type_t *
mktag(sym_t *tag, tspec_t kind, bool decl, bool semi)
{
- scl_t scl = NOSCL;
+ scl_t scl;
type_t *tp;
if (kind == STRUCT) {
@@ -2200,10 +2200,10 @@
/*
* mnoarg() (matches functions with no argument type information)
- * returns 1 if all parameters of a prototype are compatible with
+ * returns whether all parameters of a prototype are compatible with
* an old style function declaration.
* This is the case if the following conditions are met:
- * 1. the prototype must have a fixed number of parameters
+ * 1. the prototype has a fixed number of parameters
* 2. no parameter is of type float
* 3. no parameter is converted to another type if integer promotion
* is applied on it
diff -r 567b6be2dfbe -r a96a82f31383 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c Mon Jan 18 19:21:52 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c Mon Jan 18 19:24:09 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $ */
+/* $NetBSD: func.c,v 1.63 2021/01/18 19:24:09 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.62 2021/01/17 14:50:11 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.63 2021/01/18 19:24:09 rillig Exp $");
#endif
#include <stdlib.h>
@@ -62,7 +62,7 @@
bool rchflg;
/*
- * In conjunction with reached, controls printing of "fallthrough on ..."
+ * In conjunction with 'reached', controls printing of "fallthrough on ..."
* warnings.
* Reset by each statement and set by FALLTHROUGH, switch (switch1())
* and case (label()).
@@ -170,21 +170,20 @@
popctrl(int env)
{
cstk_t *ci;
- clst_t *cl;
+ clst_t *cl, *next;
lint_assert(cstmt != NULL);
lint_assert(cstmt->c_env == env);
- cstmt = (ci = cstmt)->c_surrounding;
+ ci = cstmt;
+ cstmt = ci->c_surrounding;
- while ((cl = ci->c_clst) != NULL) {
- ci->c_clst = cl->cl_next;
+ for (cl = ci->c_clst; cl != NULL; cl = next) {
+ next = cl->cl_next;
free(cl);
}
- if (ci->c_swtype != NULL)
- free(ci->c_swtype);
-
+ free(ci->c_swtype);
free(ci);
}
@@ -304,7 +303,6 @@
print_previous_declaration(-1, rdsym);
}
- /* copy usage information */
copy_usage_info(fsym, rdsym);
/*
@@ -315,10 +313,8 @@
if (fsym->s_osdef && rdsym->s_type->t_proto)
fsym->s_def_pos = rdsym->s_def_pos;
- /* complete the type */
complete_type(fsym, rdsym);
- /* once a function is inline it remains inline */
if (rdsym->s_inline)
fsym->s_inline = true;
@@ -352,7 +348,7 @@
int n;
if (reached) {
- cstmt->c_noretval = true;
+ cstmt->c_had_return_noval = true;
if (funcsym->s_type->t_subt->t_tspec != VOID &&
!funcsym->s_rimpl) {
/* func. %s falls off bottom without returning value */
@@ -365,7 +361,8 @@
* declared to be int. Otherwise the wrong return statement
* has already printed a warning.
*/
- if (cstmt->c_noretval && cstmt->c_retval && funcsym->s_rimpl)
+ if (cstmt->c_had_return_noval && cstmt->c_had_return_value &&
+ funcsym->s_rimpl)
/* function %s has return (e); and return; */
warning(216, funcsym->s_name);
@@ -388,7 +385,7 @@
if (dcs->d_scl == EXTERN && funcsym->s_inline) {
outsym(funcsym, funcsym->s_scl, DECL);
} else {
- outfdef(funcsym, &dcs->d_fdpos, cstmt->c_retval,
+ outfdef(funcsym, &dcs->d_fdpos, cstmt->c_had_return_value,
funcsym->s_osdef, dcs->d_fargs);
}
@@ -897,7 +894,6 @@
/*
* T_GOTO identifier T_SEMI
- * T_GOTO error T_SEMI
*/
void
dogoto(sym_t *lab)
@@ -974,9 +970,9 @@
continue;
if (tn != NULL) {
- ci->c_retval = true;
+ ci->c_had_return_value = true;
} else {
- ci->c_noretval = true;
+ ci->c_had_return_noval = true;
}
if (tn != NULL && funcsym->s_type->t_subt->t_tspec == VOID) {
diff -r 567b6be2dfbe -r a96a82f31383 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h Mon Jan 18 19:21:52 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h Mon Jan 18 19:24:09 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.58 2021/01/17 16:25:30 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.59 2021/01/18 19:24:09 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -387,8 +387,8 @@
bool c_infinite : 1; /* break condition always false
(for (;;), while (1)) */
bool c_rchif : 1; /* end of if-branch reached */
- bool c_noretval : 1; /* had "return;" */
- bool c_retval : 1; /* had "return (e);" */
+ bool c_had_return_noval : 1; /* had "return;" */
+ bool c_had_return_value : 1; /* had "return (e);" */
type_t *c_swtype; /* type of switch expression */
clst_t *c_clst; /* list of case values */
struct mbl *c_fexprm; /* saved memory for end of loop
Home |
Main Index |
Thread Index |
Old Index