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 type of pqinf.p_pcnt



details:   https://anonhg.NetBSD.org/src/rev/e2be2e1c3e76
branches:  trunk
changeset: 379912:e2be2e1c3e76
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 27 08:20:50 2021 +0000

description:
lint: fix type of pqinf.p_pcnt

A counter that can either be 0 or 1 and is never incremented is not
really a counter, it's a flag.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  6 +++---
 usr.bin/xlint/lint1/decl.c  |  6 +++---
 usr.bin/xlint/lint1/lint1.h |  8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (77 lines):

diff -r 7a1095910330 -r e2be2e1c3e76 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jun 27 08:10:36 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jun 27 08:20:50 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.230 2021/06/20 18:15:12 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 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.230 2021/06/20 18:15:12 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1234,7 +1234,7 @@ pointer:
 asterisk:
          T_ASTERISK {
                $$ = xcalloc(1, sizeof(*$$));
-               $$->p_pcnt = 1;
+               $$->p_pointer = true;
          }
        ;
 
diff -r 7a1095910330 -r e2be2e1c3e76 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sun Jun 27 08:10:36 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sun Jun 27 08:20:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.188 2021/06/20 11:24:32 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.189 2021/06/27 08:20:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.188 2021/06/20 11:24:32 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.189 2021/06/27 08:20:50 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1296,7 +1296,7 @@ merge_pointers_and_qualifiers(pqinf_t *p
 {
        pqinf_t *p;
 
-       if (p2->p_pcnt != 0) {
+       if (p2->p_pointer) {
                /* left '*' at the end of the list */
                for (p = p2; p->p_next != NULL; p = p->p_next)
                        continue;
diff -r 7a1095910330 -r e2be2e1c3e76 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Jun 27 08:10:36 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Jun 27 08:20:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.105 2021/06/20 20:32:42 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.106 2021/06/27 08:20:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -373,9 +373,9 @@ typedef     struct dinfo {
  * declarators.
  */
 typedef        struct pqinf {
-       int     p_pcnt;                 /* number of asterisks */
-       bool    p_const : 1;
-       bool    p_volatile : 1;
+       bool    p_pointer: 1;
+       bool    p_const: 1;
+       bool    p_volatile: 1;
        struct  pqinf *p_next;
 } pqinf_t;
 



Home | Main Index | Thread Index | Old Index