Module Name:    src
Committed By:   rillig
Date:           Sat Jul 10 17:35:54 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: decl_struct_member.c msg_247.c msg_249.c
        src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h lint1.h

Log Message:
lint: rename clrtyp/deftyp to begin_type/end_type

The abbreviations clr/def did not make it obvious that these two
functions or grammar rules form pairs.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_249.c
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.115 -r1.116 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.113 -r1.114 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/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.2 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.3
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.2	Sun Jun 20 11:24:32 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_member.c,v 1.2 2021/06/20 11:24:32 rillig Exp $	*/
+/*	$NetBSD: decl_struct_member.c,v 1.3 2021/07/10 17:35:54 rillig Exp $	*/
 # 3 "decl_struct_member.c"
 
 /*
@@ -20,6 +20,6 @@ struct {
 /*
  * FIXME: adding a semicolon here triggers another assertion:
  *
- * assertion "t == NOTSPEC" failed in deftyp at decl.c:774
+ * assertion "t == NOTSPEC" failed in end_type at decl.c:774
  */
 /* expect+1: cannot recover from previous errors */

Index: src/tests/usr.bin/xlint/lint1/msg_247.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.13 src/tests/usr.bin/xlint/lint1/msg_247.c:1.14
--- src/tests/usr.bin/xlint/lint1/msg_247.c:1.13	Fri Apr  9 20:00:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_247.c	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_247.c,v 1.13 2021/04/09 20:00:07 rillig Exp $	*/
+/*	$NetBSD: msg_247.c,v 1.14 2021/07/10 17:35:54 rillig Exp $	*/
 # 3 "msg_247.c"
 
 // Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -23,7 +23,7 @@ example(struct Other *arg)
 	 * XXX: The target type is reported as 'struct <unnamed>'.  In cases
 	 *  like these, it would be helpful to print at least the type name
 	 *  of the pointer.  This type name though is discarded immediately
-	 *  when the parser reduces 'T_TYPENAME clrtyp' to 'clrtyp_typespec'.
+	 *  in the grammar rule 'typespec: T_TYPENAME'.
 	 *  After that, the target type of the cast is just an unnamed struct,
 	 *  with no hint at all that there is a typedef for a pointer to the
 	 *  struct.

Index: src/tests/usr.bin/xlint/lint1/msg_249.c
diff -u src/tests/usr.bin/xlint/lint1/msg_249.c:1.7 src/tests/usr.bin/xlint/lint1/msg_249.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_249.c:1.7	Sat Jul 10 11:22:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_249.c	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_249.c,v 1.7 2021/07/10 11:22:19 rillig Exp $	*/
+/*	$NetBSD: msg_249.c,v 1.8 2021/07/10 17:35:54 rillig Exp $	*/
 # 3 "msg_249.c"
 
 // Test for message: syntax error '%s' [249]
@@ -53,7 +53,7 @@ struct cover_member_declaration {
 	/* cover 'noclass_declspecs ...' */
 	const int noclass_declspecs;
 
-	/* cover 'noclass_declmods deftyp ...' */
+	/* cover 'add_type_qualifier_list end_type' */
 	/* expect+1: error: syntax error 'member without type' [249] */
 	const;
 };

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.295 src/usr.bin/xlint/lint1/cgram.y:1.296
--- src/usr.bin/xlint/lint1/cgram.y:1.295	Sat Jul 10 17:17:05 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Jul 10 17:35:54 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.295 2021/07/10 17:17:05 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.296 2021/07/10 17:35:54 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.295 2021/07/10 17:17:05 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.296 2021/07/10 17:35:54 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -393,7 +393,7 @@ top_level_declaration:		/* C99 6.9 calls
 			warning(0);
 		}
 	  }
-	| clrtyp deftyp notype_init_decls T_SEMI {
+	| begin_type end_type notype_init_decls T_SEMI {
 		if (sflag) {
 			/* old style declaration; add 'int' */
 			error(1);
@@ -441,13 +441,13 @@ function_definition:		/* C99 6.9.1 */
 	;
 
 func_decl:
-	  clrtyp deftyp notype_decl {
+	  begin_type end_type notype_decl {
 		$$ = $3;
 	  }
-	| clrtyp declmods deftyp notype_decl {
+	| begin_type declmods end_type notype_decl {
 		$$ = $4;
 	  }
-	| clrtyp declaration_specifiers deftyp type_decl {
+	| begin_type declaration_specifiers end_type type_decl {
 		$$ = $4;
 	  }
 	;
@@ -469,12 +469,12 @@ arg_declaration_list:		/* C99 6.9.1p13 e
  * needs other error handling.
  */
 arg_declaration:
-	  clrtyp declmods deftyp T_SEMI {
+	  begin_type declmods end_type T_SEMI {
 		/* empty declaration */
 		warning(2);
 	  }
-	| clrtyp declmods deftyp notype_init_decls T_SEMI
-	| clrtyp declaration_specifiers deftyp T_SEMI {
+	| begin_type declmods end_type notype_init_decls T_SEMI
+	| begin_type declaration_specifiers end_type T_SEMI {
 		if (!dcs->d_nonempty_decl) {
 			/* empty declaration */
 			warning(2);
@@ -483,14 +483,14 @@ arg_declaration:
 			warning(3, type_name(dcs->d_type));
 		}
 	  }
-	| clrtyp declaration_specifiers deftyp type_init_decls T_SEMI {
+	| begin_type declaration_specifiers end_type type_init_decls T_SEMI {
 		if (dcs->d_nonempty_decl) {
 			/* '%s' declared in argument declaration list */
 			warning(3, type_name(dcs->d_type));
 		}
 	  }
-	| clrtyp declmods error
-	| clrtyp declaration_specifiers error
+	| begin_type declmods error
+	| begin_type declaration_specifiers error
 	;
 
 declaration:			/* C99 6.7 */
@@ -499,7 +499,7 @@ declaration:			/* C99 6.7 */
 	;
 
 declaration_noerror:		/* see C99 6.7 'declaration' */
-	  clrtyp declmods deftyp T_SEMI {
+	  begin_type declmods end_type T_SEMI {
 		if (dcs->d_scl == TYPEDEF) {
 			/* typedef declares no type name */
 			warning(72);
@@ -508,8 +508,8 @@ declaration_noerror:		/* see C99 6.7 'de
 			warning(2);
 		}
 	  }
-	| clrtyp declmods deftyp notype_init_decls T_SEMI
-	| clrtyp declaration_specifiers deftyp T_SEMI {
+	| begin_type declmods end_type notype_init_decls T_SEMI
+	| begin_type declaration_specifiers end_type T_SEMI {
 		if (dcs->d_scl == TYPEDEF) {
 			/* typedef declares no type name */
 			warning(72);
@@ -518,18 +518,18 @@ declaration_noerror:		/* see C99 6.7 'de
 			warning(2);
 		}
 	  }
-	| clrtyp declaration_specifiers deftyp type_init_decls T_SEMI
+	| begin_type declaration_specifiers end_type type_init_decls T_SEMI
 	;
 
-clrtyp:
+begin_type:
 	  /* empty */ {
-		clrtyp();
+		begin_type();
 	  }
 	;
 
-deftyp:
+end_type:
 	  /* empty */ {
-		deftyp();
+		end_type();
 	  }
 	;
 
@@ -665,25 +665,25 @@ member_declaration_list:
 	;
 
 member_declaration:
-	  clrtyp add_type_qualifier_list deftyp {
+	  begin_type add_type_qualifier_list end_type {
 		/* too late, i know, but getsym() compensates it */
 		symtyp = FMEMBER;
 	  } notype_member_decls type_attribute_opt {
 		symtyp = FVFT;
 		$$ = $5;
 	  }
-	| clrtyp noclass_declspecs deftyp {
+	| begin_type noclass_declspecs end_type {
 		symtyp = FMEMBER;
 	  } type_member_decls type_attribute_opt {
 		symtyp = FVFT;
 		$$ = $5;
 	  }
-	| clrtyp add_type_qualifier_list deftyp type_attribute_opt {
+	| begin_type add_type_qualifier_list end_type type_attribute_opt {
 		/* syntax error '%s' */
 		error(249, "member without type");
 		$$ = NULL;
 	  }
-	| clrtyp noclass_declspecs deftyp type_attribute_opt {
+	| begin_type noclass_declspecs end_type type_attribute_opt {
 		symtyp = FVFT;
 		if (!Sflag)
 			/* anonymous struct/union members is a C9X feature */
@@ -1150,22 +1150,22 @@ parameter_type_list:
 
 /* XXX: C99 6.7.5 defines the same name, but it looks completely different. */
 parameter_declaration:
-	  clrtyp declmods deftyp {
+	  begin_type declmods end_type {
 		$$ = declare_argument(abstract_name(), false);
 	  }
-	| clrtyp declaration_specifiers deftyp {
+	| begin_type declaration_specifiers end_type {
 		$$ = declare_argument(abstract_name(), false);
 	  }
-	| clrtyp declmods deftyp notype_param_decl {
+	| begin_type declmods end_type notype_param_decl {
 		$$ = declare_argument($4, false);
 	  }
-	| clrtyp declaration_specifiers deftyp type_param_decl {
+	| begin_type declaration_specifiers end_type type_param_decl {
 		$$ = declare_argument($4, false);
 	  }
-	| clrtyp declmods deftyp abstract_declarator {
+	| begin_type declmods end_type abstract_declarator {
 		$$ = declare_argument($4, false);
 	  }
-	| clrtyp declaration_specifiers deftyp abstract_declarator {
+	| begin_type declaration_specifiers end_type abstract_declarator {
 		$$ = declare_argument($4, false);
 	  }
 	;
@@ -1268,16 +1268,16 @@ type_name:			/* C99 6.7.6 */
 	;
 
 abstract_declaration:
-	  clrtyp add_type_qualifier_list deftyp {
+	  begin_type add_type_qualifier_list end_type {
 		$$ = declare_1_abstract(abstract_name());
 	  }
-	| clrtyp noclass_declspecs deftyp {
+	| begin_type noclass_declspecs end_type {
 		$$ = declare_1_abstract(abstract_name());
 	  }
-	| clrtyp add_type_qualifier_list deftyp abstract_declarator {
+	| begin_type add_type_qualifier_list end_type abstract_declarator {
 		$$ = declare_1_abstract($4);
 	  }
-	| clrtyp noclass_declspecs deftyp abstract_declarator {
+	| begin_type noclass_declspecs end_type abstract_declarator {
 		$$ = declare_1_abstract($4);
 	  }
 	;
@@ -1540,7 +1540,7 @@ for_start:			/* see C99 6.8.5 */
 
 for_exprs:			/* see C99 6.8.5 */
 	  for_start
-	    clrtyp declaration_specifiers deftyp notype_init_decls T_SEMI
+	    begin_type declaration_specifiers end_type notype_init_decls T_SEMI
 	    expr_opt T_SEMI
 	    expr_opt T_RPAREN {
 		/* variable declaration in for loop */

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.196 src/usr.bin/xlint/lint1/decl.c:1.197
--- src/usr.bin/xlint/lint1/decl.c:1.196	Sat Jul 10 12:10:39 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.196 2021/07/10 12:10:39 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.197 2021/07/10 17:35:54 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.196 2021/07/10 12:10:39 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.197 2021/07/10 17:35:54 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -235,7 +235,7 @@ add_storage_class(scl_t sc)
 	} else {
 		/*
 		 * multiple storage classes. An error will be reported in
-		 * deftyp().
+		 * end_type().
 		 */
 		dcs->d_mscl = true;
 	}
@@ -244,7 +244,7 @@ add_storage_class(scl_t sc)
 /*
  * Remember the type, modifier or typedef name returned by the parser
  * in *dcs (top element of decl stack). This information is used in
- * deftyp() to build the type used for all declarators in this
+ * end_type() to build the type used for all declarators in this
  * declaration.
  *
  * If tp->t_typedef is 1, the type comes from a previously defined typename.
@@ -283,7 +283,7 @@ add_type(type_t *tp)
 		    dcs->d_rank_mod != NOTSPEC || dcs->d_sign_mod != NOTSPEC) {
 			/*
 			 * remember that an error must be reported in
-			 * deftyp().
+			 * end_type().
 			 */
 			dcs->d_terr = true;
 			dcs->d_abstract_type = NOTSPEC;
@@ -340,7 +340,7 @@ add_type(type_t *tp)
 		if (dcs->d_sign_mod != NOTSPEC)
 			/*
 			 * more than one "signed" and/or "unsigned"; print
-			 * an error in deftyp()
+			 * an error in end_type()
 			 */
 			dcs->d_terr = true;
 		dcs->d_sign_mod = t;
@@ -350,7 +350,7 @@ add_type(type_t *tp)
 		 * dcs->d_rank_mod
 		 */
 		if (dcs->d_rank_mod != NOTSPEC)
-			/* more than one, print error in deftyp() */
+			/* more than one, print error in end_type() */
 			dcs->d_terr = true;
 		dcs->d_rank_mod = t;
 	} else if (t == FLOAT || t == DOUBLE) {
@@ -372,7 +372,7 @@ add_type(type_t *tp)
 		 * or "_Complex" in dcs->d_abstract_type
 		 */
 		if (dcs->d_abstract_type != NOTSPEC)
-			/* more than one, print error in deftyp() */
+			/* more than one, print error in end_type() */
 			dcs->d_terr = true;
 		dcs->d_abstract_type = t;
 	}
@@ -561,7 +561,7 @@ add_attr_used(void)
  * (and not the declarator) in the top element of the declaration stack.
  * Also detect multiple qualifiers of the same kind.
 
- * The remembered qualifier is used by deftyp() to construct the type
+ * The remembered qualifier is used by end_type() to construct the type
  * for all declarators.
  */
 void
@@ -687,7 +687,7 @@ end_declaration_level(void)
  * There is no need to clear d_asm in dinfo structs with context AUTO,
  * because these structs are freed at the end of the compound statement.
  * But it must be cleared in the outermost dinfo struct, which has
- * context EXTERN. This could be done in clrtyp() and would work for C90,
+ * context EXTERN. This could be done in begin_type() and would work for C90,
  * but not for C99 or C++ (due to mixed statements and declarations). Thus
  * we clear it in global_clean_up_decl(), which is used to do some cleanup
  * after global declarations/definitions.
@@ -706,7 +706,7 @@ setasm(void)
  * will be used by the next declaration
  */
 void
-clrtyp(void)
+begin_type(void)
 {
 
 	dcs->d_abstract_type = NOTSPEC;
@@ -749,7 +749,7 @@ dcs_adjust_storage_class(void)
  * context.
  */
 void
-deftyp(void)
+end_type(void)
 {
 	tspec_t	t, s, l, c;
 	type_t	*tp;
@@ -826,7 +826,7 @@ deftyp(void)
 		case LCOMPLEX:
 			break;
 		default:
-			INTERNAL_ERROR("deftyp(%s)", tspec_name(t));
+			INTERNAL_ERROR("end_type(%s)", tspec_name(t));
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 			dcs->d_terr = true;
@@ -1330,7 +1330,7 @@ merge_qualified_pointer(qual_ptr *p1, qu
  * 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 end_type() (dcs->d_type) and
  * pointer, function and array types already added for this
  * declarator. The new type extension is inserted between both.
  */

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.115 src/usr.bin/xlint/lint1/externs1.h:1.116
--- src/usr.bin/xlint/lint1/externs1.h:1.115	Tue Jul  6 04:44:20 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.115 2021/07/06 04:44:20 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.116 2021/07/10 17:35:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -155,8 +155,8 @@ extern	void	add_attr_used(void);
 extern	void	begin_declaration_level(scl_t);
 extern	void	end_declaration_level(void);
 extern	void	setasm(void);
-extern	void	clrtyp(void);
-extern	void	deftyp(void);
+extern	void	begin_type(void);
+extern	void	end_type(void);
 extern	int	length(const type_t *, const char *);
 extern	int	alignment_in_bits(const type_t *);
 extern	sym_t	*lnklst(sym_t *, sym_t *);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.113 src/usr.bin/xlint/lint1/lint1.h:1.114
--- src/usr.bin/xlint/lint1/lint1.h:1.113	Thu Jul  8 02:59:22 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sat Jul 10 17:35:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.113 2021/07/08 02:59:22 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.114 2021/07/10 17:35:54 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -357,7 +357,7 @@ typedef	struct dinfo {
 	tspec_t	d_sign_mod;	/* SIGNED or UNSIGN */
 	tspec_t	d_rank_mod;	/* SHORT, LONG or QUAD */
 	scl_t	d_scl;		/* storage class */
-	type_t	*d_type;	/* after deftyp() pointer to the type used
+	type_t	*d_type;	/* after end_type() pointer to the type used
 				   for all declarators */
 	sym_t	*d_redeclared_symbol;
 	int	d_offset;	/* offset of next structure member */

Reply via email to