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: remove stray warning 2...



details:   https://anonhg.NetBSD.org/src/rev/643b329dcd6c
branches:  trunk
changeset: 959861:643b329dcd6c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 27 15:29:15 2021 +0000

description:
tests/lint: remove stray warning 278 from test for warning 241

diffstat:

 tests/usr.bin/xlint/lint1/msg_241.c   |  82 +++++++++++++++++-----------------
 tests/usr.bin/xlint/lint1/msg_241.exp |  76 +++++++++++++-------------------
 2 files changed, 73 insertions(+), 85 deletions(-)

diffs (187 lines):

diff -r f9e7fd72316a -r 643b329dcd6c tests/usr.bin/xlint/lint1/msg_241.c
--- a/tests/usr.bin/xlint/lint1/msg_241.c       Sat Feb 27 15:26:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_241.c       Sat Feb 27 15:29:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_241.c,v 1.3 2021/02/27 14:54:55 rillig Exp $       */
+/*     $NetBSD: msg_241.c,v 1.4 2021/02/27 15:29:15 rillig Exp $       */
 # 3 "msg_241.c"
 
 // Test for message: dubious operation on enum, op %s [241]
@@ -18,56 +18,58 @@
        BLUE    = 1 << 2
 };
 
-extern void sink(int);
+extern void sink_bool(_Bool);
+extern void sink_int(int);
+extern void sink_color(enum color);
 
 void
 example(void)
 {
        enum color c = RED;
 
-       sink(!c);                       /* expect: 241 */
-       sink(~c);                       /* expect: 241, 278 */
-       ++c;                            /* expect: 241 */
-       --c;                            /* expect: 241 */
-       c++;                            /* expect: 241 */
-       c--;                            /* expect: 241 */
-       sink(+c);                       /* expect: 241, 278 */
-       sink(-c);                       /* expect: 241, 278 */
-       sink(c * c);                    /* expect: 241, 278 */
-       sink(c / c);                    /* expect: 241, 278 */
-       sink(c % c);                    /* expect: 241, 278 */
-       sink(c + c);                    /* expect: 241, 278 */
-       sink(c - c);                    /* expect: 241, 278 */
-       sink(c << c);                   /* expect: 241, 278 */
-       sink(c >> c);                   /* expect: 241, 278 */
+       sink_bool(!c);          /* expect: 241 */
+       sink_color(~c);         /* expect: 241 */
+       ++c;                    /* expect: 241 */
+       --c;                    /* expect: 241 */
+       c++;                    /* expect: 241 */
+       c--;                    /* expect: 241 */
+       sink_color(+c);         /* expect: 241 */
+       sink_color(-c);         /* expect: 241 */
+       sink_color(c * c);      /* expect: 241 */
+       sink_color(c / c);      /* expect: 241 */
+       sink_color(c % c);      /* expect: 241 */
+       sink_color(c + c);      /* expect: 241 */
+       sink_color(c - c);      /* expect: 241 */
+       sink_color(c << c);     /* expect: 241 */
+       sink_color(c >> c);     /* expect: 241 */
 
-       sink(c < c);
-       sink(c <= c);
-       sink(c > c);
-       sink(c >= c);
-       sink(c == c);
-       sink(c != c);
+       sink_bool(c < c);
+       sink_bool(c <= c);
+       sink_bool(c > c);
+       sink_bool(c >= c);
+       sink_bool(c == c);
+       sink_bool(c != c);
 
-       sink(c & c);                    /* expect: 241, 278 */
-       sink(c ^ c);                    /* expect: 241, 278 */
-       sink(c | c);                    /* expect: 241, 278 */
+       sink_color(c & c);      /* expect: 241 */
+       sink_color(c ^ c);      /* expect: 241 */
+       sink_color(c | c);      /* expect: 241 */
 
-       sink(c && c);                   /* expect: 241 */
-       sink(c || c);                   /* expect: 241 */
-       sink(c ? c : BLUE);             /* expect: 278 */
+       sink_bool(c && c);      /* expect: 241 */
+       sink_bool(c || c);      /* expect: 241 */
+       sink_color(c ? c : BLUE);
 
        c = GREEN;
-       c *= c;                         /* expect: 241 */
-       c /= c;                         /* expect: 241 */
-       c %= c;                         /* expect: 241 */
-       c += c;                         /* expect: 241 */
-       c -= c;                         /* expect: 241 */
-       c <<= c;                        /* expect: 241 */
-       c >>= c;                        /* expect: 241 */
-       c &= c;                         /* expect: 241 */
-       c ^= c;                         /* expect: 241 */
-       c |= c;                         /* expect: 241 */
+       c *= c;                 /* expect: 241 */
+       c /= c;                 /* expect: 241 */
+       c %= c;                 /* expect: 241 */
+       c += c;                 /* expect: 241 */
+       c -= c;                 /* expect: 241 */
+       c <<= c;                /* expect: 241 */
+       c >>= c;                /* expect: 241 */
+       c &= c;                 /* expect: 241 */
+       c ^= c;                 /* expect: 241 */
+       c |= c;                 /* expect: 241 */
 
        /* The cast to unsigned is required by GCC at WARNS=6. */
-       c &= ~(unsigned)GREEN;          /* expect: 241 */
+       c &= ~(unsigned)GREEN;  /* expect: 241 */
 }
diff -r f9e7fd72316a -r 643b329dcd6c tests/usr.bin/xlint/lint1/msg_241.exp
--- a/tests/usr.bin/xlint/lint1/msg_241.exp     Sat Feb 27 15:26:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_241.exp     Sat Feb 27 15:29:15 2021 +0000
@@ -1,45 +1,31 @@
-msg_241.c(28): warning: dubious operation on enum, op ! [241]
-msg_241.c(29): warning: dubious operation on enum, op ~ [241]
-msg_241.c(29): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(30): warning: dubious operation on enum, op ++x [241]
-msg_241.c(31): warning: dubious operation on enum, op --x [241]
-msg_241.c(32): warning: dubious operation on enum, op x++ [241]
-msg_241.c(33): warning: dubious operation on enum, op x-- [241]
-msg_241.c(34): warning: dubious operation on enum, op + [241]
-msg_241.c(34): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(35): warning: dubious operation on enum, op - [241]
-msg_241.c(35): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(36): warning: dubious operation on enum, op * [241]
-msg_241.c(36): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(37): warning: dubious operation on enum, op / [241]
-msg_241.c(37): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(38): warning: dubious operation on enum, op % [241]
-msg_241.c(38): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(39): warning: dubious operation on enum, op + [241]
-msg_241.c(39): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(40): warning: dubious operation on enum, op - [241]
-msg_241.c(40): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(41): warning: dubious operation on enum, op << [241]
-msg_241.c(41): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(42): warning: dubious operation on enum, op >> [241]
-msg_241.c(42): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(51): warning: dubious operation on enum, op & [241]
-msg_241.c(51): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(52): warning: dubious operation on enum, op ^ [241]
-msg_241.c(52): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(53): warning: dubious operation on enum, op | [241]
-msg_241.c(53): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(55): warning: dubious operation on enum, op && [241]
-msg_241.c(56): warning: dubious operation on enum, op || [241]
-msg_241.c(57): warning: combination of 'int' and 'enum color', arg #1 [278]
-msg_241.c(60): warning: dubious operation on enum, op *= [241]
-msg_241.c(61): warning: dubious operation on enum, op /= [241]
-msg_241.c(62): warning: dubious operation on enum, op %= [241]
-msg_241.c(63): warning: dubious operation on enum, op += [241]
-msg_241.c(64): warning: dubious operation on enum, op -= [241]
-msg_241.c(65): warning: dubious operation on enum, op <<= [241]
-msg_241.c(66): warning: dubious operation on enum, op >>= [241]
-msg_241.c(67): warning: dubious operation on enum, op &= [241]
-msg_241.c(68): warning: dubious operation on enum, op ^= [241]
-msg_241.c(69): warning: dubious operation on enum, op |= [241]
-msg_241.c(72): warning: dubious operation on enum, op &= [241]
+msg_241.c(30): warning: dubious operation on enum, op ! [241]
+msg_241.c(31): warning: dubious operation on enum, op ~ [241]
+msg_241.c(32): warning: dubious operation on enum, op ++x [241]
+msg_241.c(33): warning: dubious operation on enum, op --x [241]
+msg_241.c(34): warning: dubious operation on enum, op x++ [241]
+msg_241.c(35): warning: dubious operation on enum, op x-- [241]
+msg_241.c(36): warning: dubious operation on enum, op + [241]
+msg_241.c(37): warning: dubious operation on enum, op - [241]
+msg_241.c(38): warning: dubious operation on enum, op * [241]
+msg_241.c(39): warning: dubious operation on enum, op / [241]
+msg_241.c(40): warning: dubious operation on enum, op % [241]
+msg_241.c(41): warning: dubious operation on enum, op + [241]
+msg_241.c(42): warning: dubious operation on enum, op - [241]
+msg_241.c(43): warning: dubious operation on enum, op << [241]
+msg_241.c(44): warning: dubious operation on enum, op >> [241]
+msg_241.c(53): warning: dubious operation on enum, op & [241]
+msg_241.c(54): warning: dubious operation on enum, op ^ [241]
+msg_241.c(55): warning: dubious operation on enum, op | [241]
+msg_241.c(57): warning: dubious operation on enum, op && [241]
+msg_241.c(58): warning: dubious operation on enum, op || [241]
+msg_241.c(62): warning: dubious operation on enum, op *= [241]
+msg_241.c(63): warning: dubious operation on enum, op /= [241]
+msg_241.c(64): warning: dubious operation on enum, op %= [241]
+msg_241.c(65): warning: dubious operation on enum, op += [241]
+msg_241.c(66): warning: dubious operation on enum, op -= [241]
+msg_241.c(67): warning: dubious operation on enum, op <<= [241]
+msg_241.c(68): warning: dubious operation on enum, op >>= [241]
+msg_241.c(69): warning: dubious operation on enum, op &= [241]
+msg_241.c(70): warning: dubious operation on enum, op ^= [241]
+msg_241.c(71): warning: dubious operation on enum, op |= [241]
+msg_241.c(74): warning: dubious operation on enum, op &= [241]



Home | Main Index | Thread Index | Old Index