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: fix enum type in the lexical analy...



details:   https://anonhg.NetBSD.org/src/rev/6faa799569ec
branches:  trunk
changeset: 958615:6faa799569ec
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jan 14 07:34:48 2021 +0000

description:
lint: fix enum type in the lexical analysis part

Detected by Clang, reported by riastradh:

> scan.l:144:29: error: implicit conversion from enumeration type
>   'tspec_t' to different enumeration type 'op_t'
> return operator(T_ASTERISK, NOTSPEC);
>        ~~~~~~~~             ^~~~~~~

and by lint as well, with a less detailed and less helpful message:

> scan.l(144): warning: enum type mismatch, arg #2 [156]

Since scan.c is generated from scan.l, it is not included in the default
"make lint" though.

The value of these two constants is the same, furthermore that value is
never actually used in the code, therefore no functional change.

diffstat:

 usr.bin/xlint/lint1/scan.l |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 08ee0426a725 -r 6faa799569ec usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Thu Jan 14 05:47:35 2021 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Thu Jan 14 07:34:48 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.116 2021/01/10 00:05:46 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.117 2021/01/14 07:34:48 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.116 2021/01/10 00:05:46 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.117 2021/01/14 07:34:48 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_ASTERISK, NOTSPEC);
+"*"                            return operator(T_ASTERISK, NOOP);
 "/"                            return operator(T_DIVOP, DIV);
 "%"                            return operator(T_DIVOP, MOD);
 "!"                            return operator(T_UNOP, NOT);



Home | Main Index | Thread Index | Old Index