Module Name:    src
Committed By:   rillig
Date:           Sat Jan  9 02:38:27 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: rename T_MULT to T_ASTERISK

In the early phase of lexical analysis, the '*' does not mean
multiplication, therefore its name should not suggest that.  It is only
an asterisk, and depending on the surrounding context, it will only
later turn into a pointer dereference or a multiplication.

The call operator(T_MULT, MULT) was misleading since the MULT was not
used at all.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.113 -r1.114 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.131 src/usr.bin/xlint/lint1/cgram.y:1.132
--- src/usr.bin/xlint/lint1/cgram.y:1.131	Tue Jan  5 00:02:52 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Jan  9 02:38:27 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.131 2021/01/05 00:02:52 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.132 2021/01/09 02:38:27 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.131 2021/01/05 00:02:52 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.132 2021/01/09 02:38:27 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -45,6 +45,7 @@ __RCSID("$NetBSD: cgram.y,v 1.131 2021/0
 #include "lint1.h"
 
 extern char *yytext;
+
 /*
  * Contains the level of current declaration. 0 is extern.
  * Used for symbol table entries.
@@ -146,7 +147,7 @@ anonymize(sym_t *s)
 %token			T_TYPEOF
 %token			T_EXTENSION
 %token			T_ALIGNOF
-%token	<y_op>		T_MULT
+%token	<y_op>		T_ASTERISK
 %token	<y_op>		T_DIVOP
 %token	<y_op>		T_ADDOP
 %token	<y_op>		T_SHFTOP
@@ -258,7 +259,7 @@ anonymize(sym_t *s)
 %left	T_RELOP
 %left	T_SHFTOP
 %left	T_ADDOP
-%left	T_MULT T_DIVOP
+%left	T_ASTERISK T_DIVOP
 %right	T_UNOP T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
 %left	T_LPAREN T_LBRACK T_STROP
 
@@ -1174,7 +1175,7 @@ pointer:
 	;
 
 asterisk:
-	  T_MULT {
+	  T_ASTERISK {
 		$$ = xcalloc(1, sizeof (pqinf_t));
 		$$->p_pcnt = 1;
 	  }
@@ -1797,7 +1798,7 @@ constant:
 	;
 
 expr:
-	  expr T_MULT expr {
+	  expr T_ASTERISK expr {
 		$$ = build(MULT, $1, $3);
 	  }
 	| expr T_DIVOP expr {
@@ -1896,7 +1897,7 @@ term:
 	| T_INCDEC term {
 		$$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
 	  }
-	| T_MULT term {
+	| T_ASTERISK term {
 		$$ = build(STAR, $2, NULL);
 	  }
 	| T_AND term {

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.113 src/usr.bin/xlint/lint1/scan.l:1.114
--- src/usr.bin/xlint/lint1/scan.l:1.113	Tue Jan  5 17:13:44 2021
+++ src/usr.bin/xlint/lint1/scan.l	Sat Jan  9 02:38:27 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.113 2021/01/05 17:13:44 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.114 2021/01/09 02:38:27 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.113 2021/01/05 17:13:44 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.114 2021/01/09 02:38:27 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -141,7 +141,7 @@ TL	([fFlL]?[i]?)
 "."				return operator(T_STROP, POINT);
 "+"				return operator(T_ADDOP, PLUS);
 "-"				return operator(T_ADDOP, MINUS);
-"*"				return operator(T_MULT, MULT);
+"*"				return operator(T_ASTERISK, NOTSPEC);
 "/"				return operator(T_DIVOP, DIV);
 "%"				return operator(T_DIVOP, MOD);
 "!"				return operator(T_UNOP, NOT);

Reply via email to