Module Name:    src
Committed By:   rillig
Date:           Thu Mar 25 21:51:56 UTC 2021

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

Log Message:
lint: fix names of functions dealing with designations

These functions modify the whole designation, not only a single
designator.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/xlint/lint1/init.c

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.199 src/usr.bin/xlint/lint1/cgram.y:1.200
--- src/usr.bin/xlint/lint1/cgram.y:1.199	Tue Mar 23 20:57:40 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Mar 25 21:51:55 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.199 2021/03/23 20:57:40 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.200 2021/03/25 21:51:55 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.199 2021/03/23 20:57:40 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.200 2021/03/25 21:51:55 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1379,7 +1379,7 @@ range:
 
 designator:			/* C99 6.7.8 "Initialization" */
 	  T_LBRACK range T_RBRACK {
-		designator_push_subscript($2);
+		designation_add_subscript($2);
 		if (!Sflag)
 			/* array initializer with des.s is a C9X feature */
 			warning(321);
@@ -1388,7 +1388,7 @@ designator:			/* C99 6.7.8 "Initializati
 		if (!Sflag)
 			/* struct or union member name in initializer is ... */
 			warning(313);
-		designator_push_name($2);
+		designation_add_name($2);
 	  }
 	;
 
@@ -1402,7 +1402,7 @@ designation:			/* C99 6.7.8 "Initializat
 	| identifier T_COLON {
 		/* GCC style struct or union member name in initializer */
 		gnuism(315);
-		designator_push_name($1);
+		designation_add_name($1);
 	  }
 	;
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.84 src/usr.bin/xlint/lint1/externs1.h:1.85
--- src/usr.bin/xlint/lint1/externs1.h:1.84	Tue Mar 23 18:40:50 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Thu Mar 25 21:51:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.84 2021/03/23 18:40:50 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.85 2021/03/25 21:51:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -301,8 +301,8 @@ extern	void	initstack_init(void);
 extern	void	init_rbrace(void);
 extern	void	init_lbrace(void);
 extern	void	init_using_expr(tnode_t *);
-extern	void	designator_push_name(sbuf_t *);
-extern	void	designator_push_subscript(range_t);
+extern	void	designation_add_name(sbuf_t *);
+extern	void	designation_add_subscript(range_t);
 
 /*
  * emit.c

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.130 src/usr.bin/xlint/lint1/init.c:1.131
--- src/usr.bin/xlint/lint1/init.c:1.130	Thu Mar 25 21:45:10 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 21:51:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -72,8 +72,8 @@ __RCSID("$NetBSD: init.c,v 1.130 2021/03
  *
  *	begin_initialization
  *		init_lbrace			for each '{'
- *		designator_push_name		for each '.member' before '='
- *		designator_push_subscript	for each '[123]' before '='
+ *		designation_add_name		for each '.member' before '='
+ *		designation_add_subscript	for each '[123]' before '='
  *		init_using_expr			for each expression
  *		init_rbrace			for each '}'
  *	end_initialization
@@ -479,7 +479,7 @@ end_initialization(void)
 }
 
 void
-designator_push_name(sbuf_t *sb)
+designation_add_name(sbuf_t *sb)
 {
 	designation *dd = current_designation_mod();
 
@@ -515,7 +515,7 @@ designator_push_name(sbuf_t *sb)
  * }
  */
 void
-designator_push_subscript(range_t range)
+designation_add_subscript(range_t range)
 {
 	debug_enter();
 	debug_step("subscript range is %zu ... %zu", range.lo, range.hi);
@@ -525,7 +525,7 @@ designator_push_subscript(range_t range)
 
 /* TODO: add support for array subscripts, not only named members */
 static void
-designator_shift_name(void)
+designation_shift_level(void)
 {
 	/* TODO: remove direct access to 'init' */
 	lint_assert(init != NULL);
@@ -609,7 +609,7 @@ initstack_pop_item_named_member(void)
 			/* XXX: why ++? */
 			istk->i_remaining++;
 			/* XXX: why is i_seen_named_member not set? */
-			designator_shift_name();
+			designation_shift_level();
 			return;
 		}
 	}
@@ -617,7 +617,7 @@ initstack_pop_item_named_member(void)
 	/* undefined struct/union member: %s */
 	error(101, current_designation().head->name);
 
-	designator_shift_name();
+	designation_shift_level();
 	istk->i_seen_named_member = true;
 }
 
@@ -835,7 +835,7 @@ initstack_push_struct_or_union(void)
 		istk->i_seen_named_member = true;
 		debug_step("named member '%s'",
 		    current_designation().head->name);
-		designator_shift_name();
+		designation_shift_level();
 		cnt = istk->i_type->t_tspec == STRUCT ? 2 : 1;
 	}
 	istk->i_brace = true;
@@ -1202,7 +1202,7 @@ done_initstack:
 
 done:
 	while (current_designation().head != NULL)
-		designator_shift_name();
+		designation_shift_level();
 
 	debug_leave();
 }

Reply via email to