Module Name: src
Committed By: rillig
Date: Mon Jan 18 16:41:57 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h scan.l
Log Message:
lint: expand abbreviations in function names
To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/scan.l
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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.147 src/usr.bin/xlint/lint1/cgram.y:1.148
--- src/usr.bin/xlint/lint1/cgram.y:1.147 Mon Jan 18 16:34:08 2021
+++ src/usr.bin/xlint/lint1/cgram.y Mon Jan 18 16:41:57 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.147 2021/01/18 16:34:08 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.148 2021/01/18 16:41:57 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.147 2021/01/18 16:34:08 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.148 2021/01/18 16:41:57 rillig Exp $");
#endif
#include <limits.h>
@@ -47,8 +47,8 @@ __RCSID("$NetBSD: cgram.y,v 1.147 2021/0
extern char *yytext;
/*
- * Contains the level of current declaration. 0 is extern.
- * Used for symbol table entries.
+ * Contains the level of current declaration, used for symbol table entries.
+ * 0 is the top-level, > 0 is inside a function body.
*/
int blklev;
@@ -68,22 +68,22 @@ static int olwarn = LWARN_BAD;
static int toicon(tnode_t *, int);
static void idecl(sym_t *, int, sbuf_t *);
-static void ignuptorp(void);
+static void ignore_up_to_rparen(void);
static sym_t *symbolrename(sym_t *, sbuf_t *);
#ifdef DEBUG
-static inline void CLRWFLGS(const char *file, size_t line);
-static inline void CLRWFLGS(const char *file, size_t line)
+static void
+CLEAR_WARN_FLAGS(const char *file, size_t line)
{
printf("%s, %d: clear flags %s %zu\n", curr_pos.p_file,
curr_pos.p_line, file, line);
- clrwflgs();
+ clear_warn_flags();
olwarn = LWARN_BAD;
}
-static inline void SAVE(const char *file, size_t line);
-static inline void SAVE(const char *file, size_t line)
+static void
+SAVE_WARN_FLAGS(const char *file, size_t line)
{
if (olwarn != LWARN_BAD)
abort();
@@ -92,8 +92,8 @@ static inline void SAVE(const char *file
olwarn = lwarn;
}
-static inline void RESTORE(const char *file, size_t line);
-static inline void RESTORE(const char *file, size_t line)
+static void
+RESTORE_WARN_FLAGS(const char *file, size_t line)
{
if (olwarn != LWARN_BAD) {
lwarn = olwarn;
@@ -101,13 +101,14 @@ static inline void RESTORE(const char *f
curr_pos.p_line, file, line, lwarn);
olwarn = LWARN_BAD;
} else
- CLRWFLGS(file, line);
+ CLEAR_WARN_FLAGS(file, line);
}
#define cgram_debug(fmt, args...) printf("cgram_debug: " fmt "\n", ##args)
#else
-#define CLRWFLGS(f, l) clrwflgs(), olwarn = LWARN_BAD
-#define SAVE(f, l) olwarn = lwarn
-#define RESTORE(f, l) (void)(olwarn == LWARN_BAD ? (clrwflgs(), 0) : (lwarn = olwarn))
+#define CLEAR_WARN_FLAGS(f, l) clear_warn_flags(), olwarn = LWARN_BAD
+#define SAVE_WARN_FLAGS(f, l) olwarn = lwarn
+#define RESTORE_WARN_FLAGS(f, l) \
+ (void)(olwarn == LWARN_BAD ? (clear_warn_flags(), 0) : (lwarn = olwarn))
#define cgram_debug(fmt, args...) (void)0
#endif
@@ -355,11 +356,11 @@ external_declaration: /* C99 6.9 */
asm_statement
| function_definition {
global_clean_up_decl(0);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
| data_def {
global_clean_up_decl(0);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
@@ -1551,7 +1552,7 @@ compound_statement_rbrace:
statement_list:
statement
| statement_list statement {
- RESTORE(__FILE__, __LINE__);
+ RESTORE_WARN_FLAGS(__FILE__, __LINE__);
}
| statement_list error T_SEMI
;
@@ -1595,27 +1596,27 @@ expr_statement_list:
selection_statement: /* C99 6.8.4 */
if_without_else {
- SAVE(__FILE__, __LINE__);
+ SAVE_WARN_FLAGS(__FILE__, __LINE__);
if2();
if3(0);
}
| if_without_else T_ELSE {
- SAVE(__FILE__, __LINE__);
+ SAVE_WARN_FLAGS(__FILE__, __LINE__);
if2();
} statement {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
if3(1);
}
| if_without_else T_ELSE error {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
if3(0);
}
| switch_expr statement {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
switch2();
}
| switch_expr error {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
switch2();
}
;
@@ -1628,14 +1629,14 @@ if_without_else:
if_expr:
T_IF T_LPAREN expr T_RPAREN {
if1($3);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
switch_expr:
T_SWITCH T_LPAREN expr T_RPAREN {
switch1($3);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
@@ -1657,17 +1658,17 @@ generic_expr:
do_statement:
do statement {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
iteration_statement: /* C99 6.8.5 */
while_expr statement {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
while2();
}
| while_expr error {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
while2();
}
| do_statement do_while_expr {
@@ -1675,17 +1676,17 @@ iteration_statement: /* C99 6.8.5 */
ftflg = false;
}
| do error {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
do2(NULL);
}
| for_exprs statement {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
for2();
popdecl();
blklev--;
}
| for_exprs error {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
for2();
popdecl();
blklev--;
@@ -1695,7 +1696,7 @@ iteration_statement: /* C99 6.8.5 */
while_expr:
T_WHILE T_LPAREN expr T_RPAREN {
while1($3);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
@@ -1723,11 +1724,11 @@ for_exprs:
/* variable declaration in for loop */
c99ism(325);
for1(NULL, $6, $8);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
| for_start opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPAREN {
for1($2, $4, $6);
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
@@ -1779,16 +1780,16 @@ asm_statement:
read_until_rparn:
/* empty */ {
- ignuptorp();
+ ignore_up_to_rparen();
}
;
declaration_list:
declaration {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
| declaration_list declaration {
- CLRWFLGS(__FILE__, __LINE__);
+ CLEAR_WARN_FLAGS(__FILE__, __LINE__);
}
;
@@ -2188,7 +2189,7 @@ idecl(sym_t *decl, int initflg, sbuf_t *
* unmatched right paren
*/
static void
-ignuptorp(void)
+ignore_up_to_rparen(void)
{
int level;
Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.58 src/usr.bin/xlint/lint1/externs1.h:1.59
--- src/usr.bin/xlint/lint1/externs1.h:1.58 Sun Jan 17 23:04:09 2021
+++ src/usr.bin/xlint/lint1/externs1.h Mon Jan 18 16:41:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.58 2021/01/17 23:04:09 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.59 2021/01/18 16:41:57 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -80,7 +80,7 @@ extern void initscan(void);
extern int sign(int64_t, tspec_t, int);
extern int msb(int64_t, tspec_t, int);
extern int64_t xsign(int64_t, tspec_t, int);
-extern void clrwflgs(void);
+extern void clear_warn_flags(void);
extern sym_t *getsym(sbuf_t *);
extern void cleanup(void);
extern sym_t *pushdown(sym_t *);
Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.123 src/usr.bin/xlint/lint1/scan.l:1.124
--- src/usr.bin/xlint/lint1/scan.l:1.123 Mon Jan 18 16:34:08 2021
+++ src/usr.bin/xlint/lint1/scan.l Mon Jan 18 16:41:57 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: scan.l,v 1.123 2021/01/18 16:34:08 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.124 2021/01/18 16:41:57 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: scan.l,v 1.123 2021/01/18 16:34:08 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.124 2021/01/18 16:41:57 rillig Exp $");
#endif
#include <ctype.h>
@@ -1347,13 +1347,13 @@ slashslashcomment(void)
/*
* Clear flags for lint comments LINTED, LONGLONG and CONSTCOND.
- * clrwflgs() is called after function definitions and global and
+ * clear_warn_flags() is called after function definitions and global and
* local declarations and definitions. It is also called between
* the controlling expression and the body of control statements
* (if, switch, for, while).
*/
void
-clrwflgs(void)
+clear_warn_flags(void)
{
lwarn = LWARN_ALL;