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: document where to fix the wrong wa...



details:   https://anonhg.NetBSD.org/src/rev/11f13f85941e
branches:  trunk
changeset: 984253:11f13f85941e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jun 29 14:19:51 2021 +0000

description:
lint: document where to fix the wrong warning for '\xff'

diffstat:

 tests/usr.bin/xlint/lint1/lex_char_uchar.c   |  3 ++-
 tests/usr.bin/xlint/lint1/lex_char_uchar.exp |  2 +-
 usr.bin/xlint/lint1/tree.c                   |  9 +++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r a8683c2092b2 -r 11f13f85941e tests/usr.bin/xlint/lint1/lex_char_uchar.c
--- a/tests/usr.bin/xlint/lint1/lex_char_uchar.c        Tue Jun 29 13:58:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_char_uchar.c        Tue Jun 29 14:19:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex_char_uchar.c,v 1.1 2021/06/29 13:58:13 rillig Exp $        */
+/*     $NetBSD: lex_char_uchar.c,v 1.2 2021/06/29 14:19:51 rillig Exp $        */
 # 3 "lex_char_uchar.c"
 
 /*
@@ -11,6 +11,7 @@
 /*
  * FIXME: The warning is bogus; it must be possible to initialize a char
  *  variable with a character constant.
+ * See tree.c, function convert_constant.
  */
 /* expect+1: conversion of 'int' to 'char' is out of range [119] */
 char ch = '\xff';
diff -r a8683c2092b2 -r 11f13f85941e tests/usr.bin/xlint/lint1/lex_char_uchar.exp
--- a/tests/usr.bin/xlint/lint1/lex_char_uchar.exp      Tue Jun 29 13:58:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_char_uchar.exp      Tue Jun 29 14:19:51 2021 +0000
@@ -1,1 +1,1 @@
-lex_char_uchar.c(16): warning: conversion of 'int' to 'char' is out of range [119]
+lex_char_uchar.c(17): warning: conversion of 'int' to 'char' is out of range [119]
diff -r a8683c2092b2 -r 11f13f85941e usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Jun 29 13:58:13 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Jun 29 14:19:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.295 2021/06/29 10:12:35 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 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.295 2021/06/29 10:12:35 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2410,6 +2410,11 @@
        case LCOMPLEX:
                break;
        default:
+               /*
+                * FIXME: There must be no sign extension when converting
+                *  from int to char on a platform where char == unsigned
+                *  char.  See test lex_char_uchar.c.
+                */
                sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt);
                nv->v_quad = xsign(nv->v_quad, nt, sz);
                break;



Home | Main Index | Thread Index | Old Index