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: warn about conversion from 128-bit...
details: https://anonhg.NetBSD.org/src/rev/9d0b30bbe378
branches: trunk
changeset: 377352:9d0b30bbe378
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 08 12:45:43 2023 +0000
description:
lint: warn about conversion from 128-bit to smaller integer types
diffstat:
tests/usr.bin/xlint/lint1/platform_lp64.c | 5 +++--
usr.bin/xlint/lint1/tree.c | 7 +++----
2 files changed, 6 insertions(+), 6 deletions(-)
diffs (47 lines):
diff -r 58e32fe724a4 -r 9d0b30bbe378 tests/usr.bin/xlint/lint1/platform_lp64.c
--- a/tests/usr.bin/xlint/lint1/platform_lp64.c Sat Jul 08 12:42:11 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/platform_lp64.c Sat Jul 08 12:45:43 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: platform_lp64.c,v 1.6 2023/07/08 12:42:11 rillig Exp $ */
+/* $NetBSD: platform_lp64.c,v 1.7 2023/07/08 12:45:43 rillig Exp $ */
# 3 "platform_lp64.c"
/*
@@ -39,7 +39,8 @@ convert_unsigned_char_to_size_t(unsigned
void
convert_128(void)
{
- /* TODO: Warn about 128-bit types as well. */
+ /* expect+1: warning: conversion from '__int128_t' to 'int' may lose accuracy [132] */
s32 = s128;
+ /* expect+1: warning: conversion from '__uint128_t' to 'unsigned int' may lose accuracy [132] */
u32 = u128;
}
diff -r 58e32fe724a4 -r 9d0b30bbe378 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Jul 08 12:42:11 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Jul 08 12:45:43 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.551 2023/07/08 12:07:21 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.552 2023/07/08 12:45:43 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.551 2023/07/08 12:07:21 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.552 2023/07/08 12:45:43 rillig Exp $");
#endif
#include <float.h>
@@ -3447,8 +3447,7 @@ convert_integer_from_integer(op_t op, in
if (aflag > 0 &&
portable_rank_cmp(nt, ot) < 0 &&
- (ot == LONG || ot == ULONG || ot == LLONG || ot == ULLONG ||
- aflag > 1) &&
+ (portable_rank_cmp(ot, LONG) >= 0 || aflag > 1) &&
// XXX: The portable_rank_cmp above aims at portable mode,
// independent of the current platform, while can_represent acts
// on the actual types from the current platform. This mix is
Home |
Main Index |
Thread Index |
Old Index