Module Name:    src
Committed By:   rillig
Date:           Sun Jan 21 14:21:34 UTC 2024

Modified Files:
        src/usr.bin/xlint: Makefile.inc
        src/usr.bin/xlint/lint1: decl.c tree.c

Log Message:
lint: clean up redundant const from parameters and local variables

These were leftovers from splitting large functions into smaller
functions, to ensure that variables were not unintentionally reassigned.
Those refactorings are finished, and the extra help from the compiler is
no longer necessary.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/Makefile.inc
cvs rdiff -u -r1.387 -r1.388 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.595 -r1.596 src/usr.bin/xlint/lint1/tree.c

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/Makefile.inc
diff -u src/usr.bin/xlint/Makefile.inc:1.25 src/usr.bin/xlint/Makefile.inc:1.26
--- src/usr.bin/xlint/Makefile.inc:1.25	Thu Jan 11 04:45:20 2024
+++ src/usr.bin/xlint/Makefile.inc	Sun Jan 21 14:21:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.25 2024/01/11 04:45:20 rillig Exp $
+#	$NetBSD: Makefile.inc,v 1.26 2024/01/21 14:21:34 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -31,3 +31,4 @@ LINTFLAGS+=	-aa	# warn about all lossy c
 LINTFLAGS+=	-e	# strict enum mode
 LINTFLAGS+=	-T	# strict bool mode
 LINTFLAGS+=	-w	# treat warnings as errors
+LINTFLAGS+=	-q18	# list const parameters and local variables

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.387 src/usr.bin/xlint/lint1/decl.c:1.388
--- src/usr.bin/xlint/lint1/decl.c:1.387	Sat Jan 20 10:02:31 2024
+++ src/usr.bin/xlint/lint1/decl.c	Sun Jan 21 14:21:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.387 2024/01/20 10:02:31 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.388 2024/01/21 14:21:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.387 2024/01/20 10:02:31 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.388 2024/01/21 14:21:34 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -932,7 +932,7 @@ check_type(sym_t *sym)
  * implementation-defined type".
  */
 static void
-check_bit_field_type(sym_t *dsym, type_t **const inout_tp, tspec_t *inout_t)
+check_bit_field_type(sym_t *dsym, type_t **inout_tp, tspec_t *inout_t)
 {
 	type_t *tp = *inout_tp;
 	tspec_t t = *inout_t;
@@ -976,7 +976,7 @@ check_bit_field_type(sym_t *dsym, type_t
 }
 
 static void
-check_bit_field(sym_t *dsym, tspec_t *inout_t, type_t **const inout_tp)
+check_bit_field(sym_t *dsym, tspec_t *inout_t, type_t **inout_tp)
 {
 
 	check_bit_field_type(dsym, inout_tp, inout_t);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.595 src/usr.bin/xlint/lint1/tree.c:1.596
--- src/usr.bin/xlint/lint1/tree.c:1.595	Thu Jan 11 23:26:39 2024
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jan 21 14:21:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.595 2024/01/11 23:26:39 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.596 2024/01/21 14:21:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.595 2024/01/11 23:26:39 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.596 2024/01/21 14:21:34 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2670,11 +2670,11 @@ check_unconst_function(const type_t *lst
 
 static bool
 check_assign_void_pointer_compat(op_t op, int arg,
-				 const type_t *const ltp, tspec_t const lt,
-				 const type_t *const lstp, tspec_t const lst,
-				 const tnode_t *const rn,
-				 const type_t *const rtp, tspec_t const rt,
-				 const type_t *const rstp, tspec_t const rst)
+				 const type_t *ltp, tspec_t lt,
+				 const type_t *lstp, tspec_t lst,
+				 const tnode_t *rn,
+				 const type_t *rtp, tspec_t rt,
+				 const type_t *rstp, tspec_t rst)
 {
 	if (!(lt == PTR && rt == PTR && (lst == VOID || rst == VOID ||
 					 types_compatible(lstp, rstp,
@@ -2713,8 +2713,8 @@ check_assign_void_pointer_compat(op_t op
 
 static bool
 check_assign_pointer_integer(op_t op, int arg,
-			     const type_t *const ltp, tspec_t const lt,
-			     const type_t *const rtp, tspec_t const rt)
+			     const type_t *ltp, tspec_t lt,
+			     const type_t *rtp, tspec_t rt)
 {
 
 	if (!((lt == PTR && is_integer(rt)) || (is_integer(lt) && rt == PTR)))

Reply via email to