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: cover code in ckctype.c



details:   https://anonhg.NetBSD.org/src/rev/7dbac30da2f0
branches:  trunk
changeset: 984860:7dbac30da2f0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 25 22:31:22 2021 +0000

description:
tests/lint: cover code in ckctype.c

diffstat:

 tests/usr.bin/xlint/lint1/msg_342.c   |  48 ++++++++++++++++++++++++++++++++++-
 tests/usr.bin/xlint/lint1/msg_342.exp |  26 ++++++++++++++----
 2 files changed, 67 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r 35a4f609c32d -r 7dbac30da2f0 tests/usr.bin/xlint/lint1/msg_342.c
--- a/tests/usr.bin/xlint/lint1/msg_342.c       Sun Jul 25 22:14:36 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_342.c       Sun Jul 25 22:31:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_342.c,v 1.1 2021/04/05 02:05:47 rillig Exp $       */
+/*     $NetBSD: msg_342.c,v 1.2 2021/07/25 22:31:22 rillig Exp $       */
 # 3 "msg_341.c"
 
 // Test for message: argument to '%s' must be cast to 'unsigned char', not to '%s' [342]
@@ -12,11 +12,57 @@
 extern const unsigned short *_ctype_tab_;
 extern const short *_tolower_tab_;
 extern const short *_toupper_tab_;
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
 int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
 
 void sink(int);
 
 void
+cover_is_ctype_function(char c)
+{
+       /* expect+1: warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341] */
+       isalnum(c);
+       /* expect+1: warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341] */
+       isalpha(c);
+       /* expect+1: warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341] */
+       isblank(c);
+       /* expect+1: warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341] */
+       iscntrl(c);
+       /* expect+1: warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341] */
+       isdigit(c);
+       /* expect+1: warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341] */
+       isgraph(c);
+       /* expect+1: warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341] */
+       islower(c);
+       /* expect+1: warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341] */
+       isprint(c);
+       /* expect+1: warning: argument to 'ispunct' must be 'unsigned char' or EOF, not 'char' [341] */
+       ispunct(c);
+       /* expect+1: warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] */
+       isspace(c);
+       /* expect+1: warning: argument to 'isupper' must be 'unsigned char' or EOF, not 'char' [341] */
+       isupper(c);
+       /* expect+1: warning: argument to 'isxdigit' must be 'unsigned char' or EOF, not 'char' [341] */
+       isxdigit(c);
+       /* expect+1: warning: argument to 'tolower' must be 'unsigned char' or EOF, not 'char' [341] */
+       tolower(c);
+       /* expect+1: warning: argument to 'toupper' must be 'unsigned char' or EOF, not 'char' [341] */
+       toupper(c);
+}
+
+void
 function_call_char(char c)
 {
 
diff -r 35a4f609c32d -r 7dbac30da2f0 tests/usr.bin/xlint/lint1/msg_342.exp
--- a/tests/usr.bin/xlint/lint1/msg_342.exp     Sun Jul 25 22:14:36 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_342.exp     Sun Jul 25 22:31:22 2021 +0000
@@ -1,6 +1,20 @@
-msg_341.c(24): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341]
-msg_341.c(33): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'int' [342]
-msg_341.c(36): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'unsigned int' [342]
-msg_341.c(67): warning: argument to 'function from <ctype.h>' must be 'unsigned char' or EOF, not 'char' [341]
-msg_341.c(73): warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'int' [342]
-msg_341.c(76): warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'unsigned int' [342]
+msg_341.c(36): warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(38): warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(40): warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(42): warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(44): warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(46): warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(48): warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(50): warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(52): warning: argument to 'ispunct' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(54): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(56): warning: argument to 'isupper' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(58): warning: argument to 'isxdigit' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(60): warning: argument to 'tolower' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(62): warning: argument to 'toupper' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(70): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(79): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'int' [342]
+msg_341.c(82): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'unsigned int' [342]
+msg_341.c(113): warning: argument to 'function from <ctype.h>' must be 'unsigned char' or EOF, not 'char' [341]
+msg_341.c(119): warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'int' [342]
+msg_341.c(122): warning: argument to 'function from <ctype.h>' must be cast to 'unsigned char', not to 'unsigned int' [342]



Home | Main Index | Thread Index | Old Index