Module Name:    src
Committed By:   rillig
Date:           Sun Jun 27 08:20:50 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/xlint/lint1/lint1.h

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.230 src/usr.bin/xlint/lint1/cgram.y:1.231
--- src/usr.bin/xlint/lint1/cgram.y:1.230	Sun Jun 20 18:15:12 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Jun 27 08:20:50 2021
@@ -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;
 	  }
 	;
 

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.188 src/usr.bin/xlint/lint1/decl.c:1.189
--- src/usr.bin/xlint/lint1/decl.c:1.188	Sun Jun 20 11:24:32 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sun Jun 27 08:20:50 2021
@@ -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;

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.105 src/usr.bin/xlint/lint1/lint1.h:1.106
--- src/usr.bin/xlint/lint1/lint1.h:1.105	Sun Jun 20 20:32:42 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Jun 27 08:20:50 2021
@@ -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;
 

Reply via email to