Module Name: src
Committed By: rillig
Date: Sun Jan 17 15:09:56 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l
Log Message:
lint: rename T_AND to T_AMPER
When parsing a text into a C program, the character '&' does not yet
mean 'bitwise and', it could also be the address operator.
To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.119 -r1.120 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.144 src/usr.bin/xlint/lint1/cgram.y:1.145
--- src/usr.bin/xlint/lint1/cgram.y:1.144 Sun Jan 17 15:06:54 2021
+++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 15:09:56 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.144 2021/01/17 15:06:54 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.145 2021/01/17 15:09:56 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.144 2021/01/17 15:06:54 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.145 2021/01/17 15:09:56 rillig Exp $");
#endif
#include <limits.h>
@@ -153,7 +153,7 @@ anonymize(sym_t *s)
%token <y_op> T_SHFTOP
%token <y_op> T_RELOP
%token <y_op> T_EQOP
-%token <y_op> T_AND
+%token <y_op> T_AMPER
%token <y_op> T_XOR
%token <y_op> T_OR
%token <y_op> T_LOGAND
@@ -254,7 +254,7 @@ anonymize(sym_t *s)
%left T_LOGAND
%left T_OR
%left T_XOR
-%left T_AND
+%left T_AMPER
%left T_EQOP
%left T_RELOP
%left T_SHFTOP
@@ -1817,7 +1817,7 @@ expr:
| expr T_EQOP expr {
$$ = build($2, $1, $3);
}
- | expr T_AND expr {
+ | expr T_AMPER expr {
$$ = build(BITAND, $1, $3);
}
| expr T_XOR expr {
@@ -1902,7 +1902,7 @@ term:
| T_ASTERISK term {
$$ = build(INDIR, $2, NULL);
}
- | T_AND term {
+ | T_AMPER term {
$$ = build(ADDR, $2, NULL);
}
| T_UNOP term {
Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.119 src/usr.bin/xlint/lint1/scan.l:1.120
--- src/usr.bin/xlint/lint1/scan.l:1.119 Sun Jan 17 15:06:54 2021
+++ src/usr.bin/xlint/lint1/scan.l Sun Jan 17 15:09:56 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: scan.l,v 1.119 2021/01/17 15:06:54 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 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.119 2021/01/17 15:06:54 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.120 2021/01/17 15:09:56 rillig Exp $");
#endif
#include <ctype.h>
@@ -125,7 +125,7 @@ TL ([fFlL]?[i]?)
"||" return operator(T_LOGOR, LOGOR);
"&&" return operator(T_LOGAND, LOGAND);
"|" return operator(T_OR, BITOR);
-"&" return operator(T_AND, BITAND);
+"&" return operator(T_AMPER, BITAND);
"^" return operator(T_XOR, BITXOR);
"==" return operator(T_EQOP, EQ);
"!=" return operator(T_EQOP, NE);