Module Name:    src
Committed By:   rillig
Date:           Sun Feb 27 01:47:28 UTC 2022

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h

Log Message:
lint: rename ARG to OLD_STYLE_ARG

Pre-C90 argument declarations have been old for more than 30 years now,
so mention that fact in the constant name.  This reduces potential
confusion with other occurrences of the words 'arg' or 'argument'.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.244 -r1.245 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/xlint/lint1/lint1.h

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.381 src/usr.bin/xlint/lint1/cgram.y:1.382
--- src/usr.bin/xlint/lint1/cgram.y:1.381	Sat Feb 26 20:36:11 2022
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Feb 27 01:47:28 2022
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.381 2022/02/26 20:36:11 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.382 2022/02/27 01:47:28 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.381 2022/02/26 20:36:11 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.382 2022/02/27 01:47:28 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1970,7 +1970,7 @@ function_definition:		/* C99 6.9.1 */
 		}
 		funcdef($1);
 		block_level++;
-		begin_declaration_level(ARG);
+		begin_declaration_level(OLD_STYLE_ARG);
 		if (lwarn == LWARN_NONE)
 			$1->s_used = true;
 	  } arg_declaration_list_opt {

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.244 src/usr.bin/xlint/lint1/decl.c:1.245
--- src/usr.bin/xlint/lint1/decl.c:1.244	Mon Feb  7 02:44:49 2022
+++ src/usr.bin/xlint/lint1/decl.c	Sun Feb 27 01:47:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.244 2022/02/07 02:44:49 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.245 2022/02/27 01:47:28 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.244 2022/02/07 02:44:49 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.245 2022/02/27 01:47:28 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -148,8 +148,8 @@ scl_name(scl_t scl)
 	static const char *const names[] = {
 	    "none", "extern", "static", "auto", "register", "typedef",
 	    "struct", "union", "enum", "member of struct", "member of union",
-	    "compile-time constant", "abstract", "argument",
-	    "prototype argument", "inline"
+	    "compile-time constant", "abstract",
+	    "old-style function argument", "prototype argument", "inline"
 	};
 
 	return names[scl];
@@ -498,7 +498,7 @@ tdeferr(type_t *td, tspec_t t)
  * Remember the symbol of a typedef name (2nd arg) in a struct, union
  * or enum tag if the typedef name is the first defined for this tag.
  *
- * If the tag is unnamed, the typdef name is used for identification
+ * If the tag is unnamed, the typedef name is used for identification
  * of this tag in lint2. Although it's possible that more than one typedef
  * name is defined for one tag, the first name defined should be unique
  * if the tag is unnamed.
@@ -651,7 +651,7 @@ end_declaration_level(void)
 		if ((*dcs->d_ldlsym = di->d_dlsyms) != NULL)
 			dcs->d_ldlsym = di->d_ldlsym;
 		break;
-	case ARG:
+	case OLD_STYLE_ARG:
 		/*
 		 * All symbols in dcs->d_dlsyms are introduced in old style
 		 * argument declarations (it's not clean, but possible).
@@ -751,7 +751,7 @@ dcs_adjust_storage_class(void)
 			error(8);
 			dcs->d_scl = NOSCL;
 		}
-	} else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
+	} else if (dcs->d_ctx == OLD_STYLE_ARG || dcs->d_ctx == PROTO_ARG) {
 		if (dcs->d_scl != NOSCL && dcs->d_scl != REG) {
 			/* only register valid as formal parameter storage... */
 			error(9);
@@ -1565,7 +1565,7 @@ declarator_name(sym_t *sym)
 	case PROTO_ARG:
 		sym->s_arg = true;
 		/* FALLTHROUGH */
-	case ARG:
+	case OLD_STYLE_ARG:
 		if ((sc = dcs->d_scl) == NOSCL) {
 			sc = AUTO;
 		} else {
@@ -2027,7 +2027,7 @@ declare(sym_t *decl, bool initflg, sbuf_
 
 	if (dcs->d_ctx == EXTERN) {
 		declare_extern(decl, initflg, renaming);
-	} else if (dcs->d_ctx == ARG || dcs->d_ctx == PROTO_ARG) {
+	} else if (dcs->d_ctx == OLD_STYLE_ARG || dcs->d_ctx == PROTO_ARG) {
 		if (renaming != NULL) {
 			/* symbol renaming can't be used on function arguments */
 			error(310);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.135 src/usr.bin/xlint/lint1/lint1.h:1.136
--- src/usr.bin/xlint/lint1/lint1.h:1.135	Mon Feb  7 21:57:47 2022
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Feb 27 01:47:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.135 2022/02/07 21:57:47 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.136 2022/02/27 01:47:28 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -226,7 +226,7 @@ typedef enum {
 	MOU,		/* member of union */
 	CTCONST,	/* enumerator, enum constant or bool constant */
 	ABSTRACT,	/* abstract symbol (sizeof, casts, unnamed argument) */
-	ARG,		/* argument */
+	OLD_STYLE_ARG,	/* old-style function argument declarations */
 	PROTO_ARG,	/* used in declaration stack during prototype
 			   declaration */
 	INLINE		/* only used by the parser */
@@ -342,7 +342,7 @@ struct array_size {
 };
 
 /*
- * For nested declarations a stack exists, which holds all information
+ * For nested declarations there is a stack that holds all information
  * needed for the current level. dcs points to the innermost element of this
  * stack.
  *
@@ -351,7 +351,7 @@ struct array_size {
  *	EXTERN		global declarations
  *	MOS or MOU	declarations of struct or union members
  *	CTCONST		declarations of enums or boolean constants
- *	ARG		declaration of arguments in old-style function
+ *	OLD_STYLE_ARG	declaration of arguments in old-style function
  *			definitions
  *	PROTO_ARG	declaration of arguments in function prototypes
  *	AUTO		declaration of local symbols

Reply via email to