Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: rename T_MULT to T_ASTERISK



details:   https://anonhg.NetBSD.org/src/rev/90eaa4955686
branches:  trunk
changeset: 979729:90eaa4955686
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 09 02:38:27 2021 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  15 ++++++++-------
 usr.bin/xlint/lint1/scan.l  |   6 +++---
 2 files changed, 11 insertions(+), 10 deletions(-)

diffs (100 lines):

diff -r df59292b13c0 -r 90eaa4955686 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Jan 08 21:46:50 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sat Jan 09 02:38:27 2021 +0000
@@ -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 @@
 #include "lint1.h"
 
 extern char *yytext;
+
 /*
  * Contains the level of current declaration. 0 is extern.
  * Used for symbol table entries.
@@ -146,7 +147,7 @@
 %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 @@
 %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 @@
        ;
 
 asterisk:
-         T_MULT {
+         T_ASTERISK {
                $$ = xcalloc(1, sizeof (pqinf_t));
                $$->p_pcnt = 1;
          }
@@ -1797,7 +1798,7 @@
        ;
 
 expr:
-         expr T_MULT expr {
+         expr T_ASTERISK expr {
                $$ = build(MULT, $1, $3);
          }
        | expr T_DIVOP expr {
@@ -1896,7 +1897,7 @@
        | T_INCDEC term {
                $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
          }
-       | T_MULT term {
+       | T_ASTERISK term {
                $$ = build(STAR, $2, NULL);
          }
        | T_AND term {
diff -r df59292b13c0 -r 90eaa4955686 usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Fri Jan 08 21:46:50 2021 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Sat Jan 09 02:38:27 2021 +0000
@@ -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 @@
 "."                            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);



Home | Main Index | Thread Index | Old Index