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: clean up symbolic operator names t...
details: https://anonhg.NetBSD.org/src/rev/d2f709aa091a
branches: trunk
changeset: 958460:d2f709aa091a
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jan 05 23:07:49 2021 +0000
description:
lint: clean up symbolic operator names that are used in the messages
Including the "p" in the symbolic operator names was questionable, for
several reasons:
1. The "p" could be taken to mean an actual variable name, which is
confusing if the function doesn't have such a variable, or even more
so if the line contains an unrelated variable called "p".
2. For the binary operators, having the "p" mentioned on both sides of
the operator (such as in "p + p") wrongly suggested that both
operands of the expression were the same.
3. The name "p" often stands for a pointer. Most of the operators
don't accept pointers, therefore the name was misleading.
For these reasons, the "p" was removed from the symbolic name of all
operators. This makes several pairs of operators indistinguishable:
INCBEF == INCAFT
DECBEF == DECAFT
UPLUS == PLUS
UMINUS == MINUS
STAR == MULT
AMPER == AND
This is not expected to create any confusion since C programmers are
expected to know these double meanings.
The symbolic names for SHLASS and SHRASS were missing the '=' before.
This was added since omitting it was probably an oversight.
diffstat:
tests/usr.bin/xlint/lint1/d_long_double_int.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_124.exp | 6 +-
tests/usr.bin/xlint/lint1/msg_230.exp | 6 +-
usr.bin/xlint/lint1/ops.def | 94 ++++++++++++------------
4 files changed, 54 insertions(+), 54 deletions(-)
diffs (137 lines):
diff -r fdc6819c99a2 -r d2f709aa091a tests/usr.bin/xlint/lint1/d_long_double_int.exp
--- a/tests/usr.bin/xlint/lint1/d_long_double_int.exp Tue Jan 05 22:38:51 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_long_double_int.exp Tue Jan 05 23:07:49 2021 +0000
@@ -1,1 +1,1 @@
-(9): warning: illegal pointer combination (pointer to long double) and (pointer to long), op p == p [124]
+(9): warning: illegal pointer combination (pointer to long double) and (pointer to long), op == [124]
diff -r fdc6819c99a2 -r d2f709aa091a tests/usr.bin/xlint/lint1/msg_124.exp
--- a/tests/usr.bin/xlint/lint1/msg_124.exp Tue Jan 05 22:38:51 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_124.exp Tue Jan 05 23:07:49 2021 +0000
@@ -1,3 +1,3 @@
-msg_124.c(16): warning: illegal pointer combination (pointer to function(int) returning void) and (pointer to int), op p = p [124]
-msg_124.c(17): warning: illegal pointer combination (pointer to function(pointer to function(int) returning void) returning pointer to function(int) returning void) and (pointer to int), op p = p
[124]
-msg_124.c(18): warning: illegal pointer combination (pointer to function(pointer to const char, ...) returning int) and (pointer to int), op p = p [124]
+msg_124.c(16): warning: illegal pointer combination (pointer to function(int) returning void) and (pointer to int), op = [124]
+msg_124.c(17): warning: illegal pointer combination (pointer to function(pointer to function(int) returning void) returning pointer to function(int) returning void) and (pointer to int), op = [124]
+msg_124.c(18): warning: illegal pointer combination (pointer to function(pointer to const char, ...) returning int) and (pointer to int), op = [124]
diff -r fdc6819c99a2 -r d2f709aa091a tests/usr.bin/xlint/lint1/msg_230.exp
--- a/tests/usr.bin/xlint/lint1/msg_230.exp Tue Jan 05 22:38:51 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230.exp Tue Jan 05 23:07:49 2021 +0000
@@ -1,3 +1,3 @@
-msg_230.c(11): warning: comparison of unsigned char with 0, op p < p [162]
-msg_230.c(22): warning: nonportable character comparison, op p <= p [230]
-msg_230.c(23): warning: comparison of unsigned char with negative constant, op p <= p [162]
+msg_230.c(11): warning: comparison of unsigned char with 0, op < [162]
+msg_230.c(22): warning: nonportable character comparison, op <= [230]
+msg_230.c(23): warning: comparison of unsigned char with negative constant, op <= [162]
diff -r fdc6819c99a2 -r d2f709aa091a usr.bin/xlint/lint1/ops.def
--- a/usr.bin/xlint/lint1/ops.def Tue Jan 05 22:38:51 2021 +0000
+++ b/usr.bin/xlint/lint1/ops.def Tue Jan 05 23:07:49 2021 +0000
@@ -3,60 +3,60 @@
POINT . 1,0,0,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0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 1
+CALL call 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 1
COMMA , 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 1
-CVT (cast)p 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 1
+CVT convert 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 1
ICALL icall 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 1
LOAD load 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1
PUSH push 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 1
RETURN return 1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0 1
-REAL p.re 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
-IMAG p.im 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
-INIT p = {} 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 1 pseudo
+REAL real 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
+IMAG imag 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0
+INIT init 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 1 pseudo
CASE case 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0 pseudo
-FARG f(p) 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 1 pseudo
+FARG farg 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 1 pseudo
Home |
Main Index |
Thread Index |
Old Index