Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: demonstrate wrong warn...



details:   https://anonhg.NetBSD.org/src/rev/4932284af068
branches:  trunk
changeset: 1020299:4932284af068
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Apr 06 21:10:37 2021 +0000

description:
tests/lint: demonstrate wrong warning about losing accuracy

diffstat:

 tests/usr.bin/xlint/lint1/msg_132.c   |  9 ++++++++-
 tests/usr.bin/xlint/lint1/msg_132.exp |  1 +
 2 files changed, 9 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r fe37d7234532 -r 4932284af068 tests/usr.bin/xlint/lint1/msg_132.c
--- a/tests/usr.bin/xlint/lint1/msg_132.c       Tue Apr 06 20:13:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.c       Tue Apr 06 21:10:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_132.c,v 1.3 2021/02/28 21:39:17 rillig Exp $       */
+/*     $NetBSD: msg_132.c,v 1.4 2021/04/06 21:10:37 rillig Exp $       */
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -62,3 +62,10 @@
        v64 = v16;
        v64 = v32;
 }
+
+_Bool
+to_bool(long a, long b)
+{
+       /* seen in fp_lib.h, function wideRightShiftWithSticky */
+       return a | b;           /* expect: 132 *//*FIXME*/
+}
diff -r fe37d7234532 -r 4932284af068 tests/usr.bin/xlint/lint1/msg_132.exp
--- a/tests/usr.bin/xlint/lint1/msg_132.exp     Tue Apr 06 20:13:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.exp     Tue Apr 06 21:10:37 2021 +0000
@@ -10,3 +10,4 @@
 msg_132.c(54): warning: conversion from 'int' to 'short' may lose accuracy [132]
 msg_132.c(55): warning: conversion from 'long long' to 'short' may lose accuracy [132]
 msg_132.c(59): warning: conversion from 'long long' to 'int' may lose accuracy [132]
+msg_132.c(70): warning: conversion from 'long' to '_Bool' may lose accuracy [132]



Home | Main Index | Thread Index | Old Index