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: simplify typeok_strict_bool_compat...
details: https://anonhg.NetBSD.org/src/rev/c05c2cecea26
branches: trunk
changeset: 949776:c05c2cecea26
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 16 18:58:21 2021 +0000
description:
lint: simplify typeok_strict_bool_compatible
diffstat:
tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp | 2 +-
usr.bin/xlint/lint1/tree.c | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diffs (60 lines):
diff -r f658d2bd81ce -r c05c2cecea26 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sat Jan 16 18:48:52 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Sat Jan 16 18:58:21 2021 +0000
@@ -20,7 +20,7 @@
d_c99_bool_strict.c(252): return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(258): return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(264): return value type mismatch (_Bool) and (int) [211]
-d_c99_bool_strict.c(270): return value type mismatch (_Bool) and (pointer to const void) [211]
+d_c99_bool_strict.c(270): return value type mismatch (_Bool) and (pointer) [211]
d_c99_bool_strict.c(268): warning: argument p unused in function strict_bool_conversion_return_pointer [231]
d_c99_bool_strict.c(276): return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(282): return value type mismatch (char) and (_Bool) [211]
diff -r f658d2bd81ce -r c05c2cecea26 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Jan 16 18:48:52 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Jan 16 18:58:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.160 2021/01/16 18:48:52 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.161 2021/01/16 18:58:21 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.160 2021/01/16 18:48:52 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.161 2021/01/16 18:58:21 rillig Exp $");
#endif
#include <float.h>
@@ -1088,9 +1088,7 @@
* special rule C99 6.3.1.2, without silent change in behavior.
*/
static bool
-typeok_strict_bool_assign(op_t op, int arg,
- const tnode_t *ln, tspec_t lt,
- const tnode_t *rn, tspec_t rt)
+typeok_strict_bool_compatible(op_t op, int arg, tspec_t lt, tspec_t rt)
{
if ((lt == BOOL) == (rt == BOOL))
return true;
@@ -1100,8 +1098,7 @@
error(334, arg, tspec_name(lt), tspec_name(rt));
} else if (op == RETURN) {
/* return value type mismatch (%s) and (%s) */
- error(211, type_name(ln->tn_type), type_name(rn->tn_type));
- return false;
+ error(211, tspec_name(lt), tspec_name(rt));
} else {
/* operands of '%s' have incompatible types (%s != %s) */
error(107, getopname(op), tspec_name(lt), tspec_name(rt));
@@ -1148,7 +1145,7 @@
}
if (needs_compatible_types(op))
- return typeok_strict_bool_assign(op, arg, ln, lt, rn, rt);
+ return typeok_strict_bool_compatible(op, arg, lt, rt);
if (mp->m_takes_only_bool || op == QUEST) {
bool binary = mp->m_binary;
Home |
Main Index |
Thread Index |
Old Index