Module Name: src
Committed By: rillig
Date: Sat Jan 2 18:26:44 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: decl.c emit1.c lint1.h tree.c
Log Message:
lint: fix lint warning 161 "constant in conditional context"
To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.115 -r1.116 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/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.101 src/usr.bin/xlint/lint1/decl.c:1.102
--- src/usr.bin/xlint/lint1/decl.c:1.101 Sat Jan 2 18:06:01 2021
+++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 18:26:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.101 2021/01/02 18:06:01 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 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.101 2021/01/02 18:06:01 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.102 2021/01/02 18:26:44 rillig Exp $");
#endif
#include <sys/param.h>
@@ -661,7 +661,7 @@ popdecl(void)
/* there is nothing after external declarations */
/* FALLTHROUGH */
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
free(di);
}
@@ -1566,7 +1566,7 @@ declarator_name(sym_t *sym)
}
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
sym->s_scl = sc;
@@ -1749,7 +1749,7 @@ storage_class_name(scl_t sc)
case STRTAG: s = "struct"; break;
case UNIONTAG: s = "union"; break;
case ENUMTAG: s = "enum"; break;
- default: lint_assert(0);
+ default: lint_assert(/*CONSTCOND*/0);
}
return s;
}
@@ -2629,7 +2629,7 @@ decl1loc(sym_t *dsym, int initflg)
*/
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
} else if (dcs->d_rdcsym->s_blklev == blklev) {
@@ -3074,7 +3074,7 @@ check_tag_usage(sym_t *sym)
warning(235, sym->s_name);
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
}
Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.31 src/usr.bin/xlint/lint1/emit1.c:1.32
--- src/usr.bin/xlint/lint1/emit1.c:1.31 Fri Jan 1 09:28:22 2021
+++ src/usr.bin/xlint/lint1/emit1.c Sat Jan 2 18:26:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.31 2021/01/01 09:28:22 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.32 2021/01/02 18:26:44 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: emit1.c,v 1.31 2021/01/01 09:28:22 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.32 2021/01/02 18:26:44 rillig Exp $");
#endif
#include <ctype.h>
@@ -128,7 +128,7 @@ outtype(type_t *tp)
case DCOMPLEX: t = 'X'; s = '\0'; break;
case LCOMPLEX: t = 'X'; s = 'l'; break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
if (tp->t_const)
outchar('c');
@@ -268,7 +268,7 @@ outsym(sym_t *sym, scl_t sc, def_t def)
outchar('e');
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
if (llibflg && def != DECL) {
/*
Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.47 src/usr.bin/xlint/lint1/lint1.h:1.48
--- src/usr.bin/xlint/lint1/lint1.h:1.47 Sat Jan 2 01:06:15 2021
+++ src/usr.bin/xlint/lint1/lint1.h Sat Jan 2 18:26:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.47 2021/01/02 01:06:15 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.48 2021/01/02 18:26:44 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -70,7 +70,7 @@ typedef struct {
curr_pos.p_uniq++; \
if (curr_pos.p_file == csrc_pos.p_file) \
csrc_pos.p_uniq++; \
- } while (0)
+ } while (/*CONSTCOND*/0)
/*
* Strings cannot be referenced to simply by a pointer to its first
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.115 src/usr.bin/xlint/lint1/tree.c:1.116
--- src/usr.bin/xlint/lint1/tree.c:1.115 Sat Jan 2 03:49:25 2021
+++ src/usr.bin/xlint/lint1/tree.c Sat Jan 2 18:26:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.115 2021/01/02 03:49:25 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.116 2021/01/02 18:26:44 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.115 2021/01/02 03:49:25 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.116 2021/01/02 18:26:44 rillig Exp $");
#endif
#include <float.h>
@@ -1968,7 +1968,7 @@ cvtcon(op_t op, int arg, type_t *tp, val
case LCOMPLEX:
max = LDBL_MAX; min = -LDBL_MAX; break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
if (v->v_ldbl > max || v->v_ldbl < min) {
lint_assert(nt != LDOUBLE);
@@ -2805,7 +2805,7 @@ fold(tnode_t *tn)
q = utyp ? (int64_t)(ul | ur) : sl | sr;
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
/* XXX does not work for quads. */
@@ -2864,7 +2864,7 @@ fold_test(tnode_t *tn)
v->v_quad = l || r;
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
return getcnode(tn->tn_type, v);
@@ -2943,7 +2943,7 @@ fold_float(tnode_t *tn)
v->v_quad = l != r;
break;
default:
- lint_assert(0);
+ lint_assert(/*CONSTCOND*/0);
}
lint_assert(fpe || !isnan((double)v->v_ldbl));