lint: fix lint warning 161 "constant in conditional context"

This commit is contained in:
rillig 2021-01-02 18:26:44 +00:00
parent ad4fbc2570
commit 1046aa5d34
4 changed files with 19 additions and 19 deletions

View File

@ -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);
}
}

View File

@ -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) {
/*

View File

@ -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

View File

@ -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_t *nv, val_t *v)
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));