Source-Changes-HG archive

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

[src/trunk]: src tests/lint: make expectation lines in the tests more detailed



details:   https://anonhg.NetBSD.org/src/rev/7ea9a21fff74
branches:  trunk
changeset: 366808:7ea9a21fff74
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jun 16 16:58:35 2022 +0000

description:
tests/lint: make expectation lines in the tests more detailed

This commit migrates msg_100 until msg_199.

diffstat:

 distrib/sets/lists/tests/mi           |    4 +-
 tests/usr.bin/xlint/check-expect.lua  |    4 +-
 tests/usr.bin/xlint/lint1/Makefile    |    3 +-
 tests/usr.bin/xlint/lint1/msg_107.c   |   11 +-
 tests/usr.bin/xlint/lint1/msg_107.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_108.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_108.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_109.c   |    9 +-
 tests/usr.bin/xlint/lint1/msg_109.exp |    5 +-
 tests/usr.bin/xlint/lint1/msg_111.c   |   19 ++-
 tests/usr.bin/xlint/lint1/msg_111.exp |    3 +-
 tests/usr.bin/xlint/lint1/msg_112.c   |   10 +-
 tests/usr.bin/xlint/lint1/msg_112.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_113.c   |   11 +-
 tests/usr.bin/xlint/lint1/msg_113.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_114.c   |   14 +-
 tests/usr.bin/xlint/lint1/msg_114.exp |    7 +-
 tests/usr.bin/xlint/lint1/msg_115.c   |   23 ++-
 tests/usr.bin/xlint/lint1/msg_115.exp |   16 +-
 tests/usr.bin/xlint/lint1/msg_116.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_116.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_117.c   |   16 ++-
 tests/usr.bin/xlint/lint1/msg_117.exp |   24 ++--
 tests/usr.bin/xlint/lint1/msg_119.c   |   10 +-
 tests/usr.bin/xlint/lint1/msg_119.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_120.c   |   16 ++-
 tests/usr.bin/xlint/lint1/msg_120.exp |   12 +-
 tests/usr.bin/xlint/lint1/msg_121.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_121.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_122.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_122.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_123.c   |   20 ++-
 tests/usr.bin/xlint/lint1/msg_123.exp |   16 +-
 tests/usr.bin/xlint/lint1/msg_124.c   |   20 ++-
 tests/usr.bin/xlint/lint1/msg_124.exp |   12 +-
 tests/usr.bin/xlint/lint1/msg_125.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_125.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_126.c   |    9 +-
 tests/usr.bin/xlint/lint1/msg_126.exp |    7 +-
 tests/usr.bin/xlint/lint1/msg_127.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_127.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_128.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_128.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_129.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_129.exp |    8 +-
 tests/usr.bin/xlint/lint1/msg_130.c   |   22 ++-
 tests/usr.bin/xlint/lint1/msg_130.exp |   12 +-
 tests/usr.bin/xlint/lint1/msg_131.c   |    6 +-
 tests/usr.bin/xlint/lint1/msg_131.exp |    1 -
 tests/usr.bin/xlint/lint1/msg_132.c   |   74 +++++++++----
 tests/usr.bin/xlint/lint1/msg_132.exp |   62 +++++-----
 tests/usr.bin/xlint/lint1/msg_133.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_133.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_134.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_134.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_136.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_136.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_137.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_137.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_138.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_138.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_139.c   |   14 +-
 tests/usr.bin/xlint/lint1/msg_139.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_140.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_140.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_143.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_143.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_145.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_145.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_146.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_146.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_148.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_148.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_150.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_150.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_151.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_151.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_152.c   |   14 +-
 tests/usr.bin/xlint/lint1/msg_152.exp |    8 +-
 tests/usr.bin/xlint/lint1/msg_153.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_153.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_154.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_154.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_156.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_156.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_158.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_158.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_159.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_159.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_160.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_160.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_161.c   |   16 +-
 tests/usr.bin/xlint/lint1/msg_161.exp |   20 +-
 tests/usr.bin/xlint/lint1/msg_164.c   |   11 +-
 tests/usr.bin/xlint/lint1/msg_164.exp |    6 +-
 tests/usr.bin/xlint/lint1/msg_165.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_165.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_166.c   |   41 +++++--
 tests/usr.bin/xlint/lint1/msg_166.exp |   16 +-
 tests/usr.bin/xlint/lint1/msg_167.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_167.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_168.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_168.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_169.c   |   80 ++++++++++-----
 tests/usr.bin/xlint/lint1/msg_169.exp |   44 ++++----
 tests/usr.bin/xlint/lint1/msg_170.c   |    9 +-
 tests/usr.bin/xlint/lint1/msg_170.exp |    6 +-
 tests/usr.bin/xlint/lint1/msg_171.c   |   14 +-
 tests/usr.bin/xlint/lint1/msg_171.exp |    8 +-
 tests/usr.bin/xlint/lint1/msg_172.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_172.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_173.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_173.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_174.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_174.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_175.c   |   11 +-
 tests/usr.bin/xlint/lint1/msg_175.exp |    6 +-
 tests/usr.bin/xlint/lint1/msg_177.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_177.exp |    4 +-
 tests/usr.bin/xlint/lint1/msg_178.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_178.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_180.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_180.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_181.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_181.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_185.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_185.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_186.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_186.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_188.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_188.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_191.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_191.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_192.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_192.exp |    3 +-
 tests/usr.bin/xlint/lint1/msg_193.c   |  177 +++++++++++++++++----------------
 tests/usr.bin/xlint/lint1/msg_193.exp |   10 +-
 tests/usr.bin/xlint/lint1/msg_194.c   |    8 +-
 tests/usr.bin/xlint/lint1/msg_194.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_195.c   |   13 +-
 tests/usr.bin/xlint/lint1/msg_195.exp |    3 +-
 tests/usr.bin/xlint/lint1/msg_196.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_196.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_197.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_197.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_198.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_198.exp |    2 +-
 tests/usr.bin/xlint/lint1/msg_199.c   |    5 +-
 tests/usr.bin/xlint/lint1/msg_199.exp |    2 +-
 149 files changed, 815 insertions(+), 588 deletions(-)

diffs (truncated from 3224 to 300 lines):

diff -r f0bf2dd119f1 -r 7ea9a21fff74 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Jun 16 16:27:30 2022 +0000
+++ b/distrib/sets/lists/tests/mi       Thu Jun 16 16:58:35 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1212 2022/06/10 18:29:01 rillig Exp $
+# $NetBSD: mi,v 1.1213 2022/06/16 16:58:35 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6836,7 +6836,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_130.c                      tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_130.exp                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_131.c                      tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/msg_131.exp                    tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_131.exp                    tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_132.c                      tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_132.exp                    tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_132_ilp32.c                        tests-usr.bin-tests     compattestfile,atf
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/check-expect.lua
--- a/tests/usr.bin/xlint/check-expect.lua      Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/check-expect.lua      Thu Jun 16 16:58:35 2022 +0000
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.15 2022/06/15 20:18:31 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.16 2022/06/16 16:58:36 rillig Exp $
 
 --[[
 
@@ -64,7 +64,7 @@
     -- only the raw message ID, without the actual message text,
     -- which makes them harder to understand without looking up more context.
     for comment in line:gmatch("/%* expect: (.-) %*/") do
-      if not (fname:match("^msg_[0]")) then
+      if not fname:match("^msg_[01]") then
         add_expectation(0, comment)
       end
     end
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Thu Jun 16 16:58:35 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.124 2022/06/10 18:29:01 rillig Exp $
+# $NetBSD: Makefile,v 1.125 2022/06/16 16:58:36 rillig Exp $
 
 NOMAN=         # defined
 MAX_MESSAGE=   349             # see lint1/err.c
@@ -274,6 +274,7 @@
 MSG_FILES=     ${MSG_IDS:@id@msg_${id}.c ${MSG_NO_EXP.${id}:D:Umsg_${id}.exp}@}
 MSG_NO_EXP.040=        yes
 MSG_NO_EXP.070=        yes
+MSG_NO_EXP.131=        yes
 MSG_NO_EXP.176=        yes
 
 # Note: only works for adding tests.
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_107.c
--- a/tests/usr.bin/xlint/lint1/msg_107.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_107.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,7 +1,12 @@
-/*     $NetBSD: msg_107.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_107.c,v 1.3 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_107.c"
 
 // Test for message: operands of '%s' have incompatible types (%s != %s) [107]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* ARGSUSED */
+void
+compare(double d, void *ptr)
+{
+       /* expect+1: error: operands of '==' have incompatible types (double != pointer) [107] */
+       return d == ptr;
+}
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_107.exp
--- a/tests/usr.bin/xlint/lint1/msg_107.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_107.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,1 +1,1 @@
-msg_107.c(6): error: syntax error ':' [249]
+msg_107.c(11): error: operands of '==' have incompatible types (double != pointer) [107]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_108.c
--- a/tests/usr.bin/xlint/lint1/msg_108.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_108.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_108.c,v 1.5 2021/02/28 12:40:00 rillig Exp $       */
+/*     $NetBSD: msg_108.c,v 1.6 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_108.c"
 
 // Test for message: operand of '%s' has invalid type (%s) [108]
@@ -21,5 +21,6 @@
            0
        };
 
-       s = ~s;                 /* expect: 108 */
+       /* expect+1: error: operand of '~' has invalid type (struct) [108] */
+       s = ~s;
 }
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_108.exp
--- a/tests/usr.bin/xlint/lint1/msg_108.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_108.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,1 +1,1 @@
-msg_108.c(24): error: operand of '~' has invalid type (struct) [108]
+msg_108.c(25): error: operand of '~' has invalid type (struct) [108]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_109.c
--- a/tests/usr.bin/xlint/lint1/msg_109.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_109.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,10 +1,13 @@
-/*     $NetBSD: msg_109.c,v 1.4 2021/04/05 01:35:34 rillig Exp $       */
+/*     $NetBSD: msg_109.c,v 1.5 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_109.c"
 
 // Test for message: void type illegal in expression [109]
 
+/* ARGSUSED */
 int
-example(int arg)                       /* expect: 231 */
+example(int arg)
 {
-       return arg + (void)4;           /* expect: 109 *//* expect: 214 */
+       /* expect+2: error: void type illegal in expression [109] */
+       /* expect+1: warning: function 'example' expects to return value [214] */
+       return arg + (void)4;
 }
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_109.exp
--- a/tests/usr.bin/xlint/lint1/msg_109.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_109.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,3 +1,2 @@
-msg_109.c(9): error: void type illegal in expression [109]
-msg_109.c(9): warning: function 'example' expects to return value [214]
-msg_109.c(7): warning: argument 'arg' unused in function 'example' [231]
+msg_109.c(12): error: void type illegal in expression [109]
+msg_109.c(12): warning: function 'example' expects to return value [214]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_111.c
--- a/tests/usr.bin/xlint/lint1/msg_111.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_111.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,7 +1,18 @@
-/*     $NetBSD: msg_111.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_111.c,v 1.3 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_111.c"
 
-// Test for message: unacceptable operand of '%s' [111]
+/* Test for message: unacceptable operand of '%s' [111] */
+
+/* lint1-flags: -tw -aa -chapbrzgF */
+
+struct s {
+       int member;
+};
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+void
+illegal_member_access()
+{
+       /* expect+2: warning: left operand of '.' must be struct or union, not 'function() returning void' [103] */
+       /* expect+1: error: unacceptable operand of '.' [111] */
+       return illegal_member_access.member;
+}
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_111.exp
--- a/tests/usr.bin/xlint/lint1/msg_111.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_111.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,1 +1,2 @@
-msg_111.c(6): error: syntax error ':' [249]
+msg_111.c(17): warning: left operand of '.' must be struct or union, not 'function() returning void' [103]
+msg_111.c(17): error: unacceptable operand of '.' [111]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_112.c
--- a/tests/usr.bin/xlint/lint1/msg_112.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_112.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,7 +1,11 @@
-/*     $NetBSD: msg_112.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_112.c,v 1.3 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_112.c"
 
 // Test for message: cannot take address of bit-field [112]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct {
+       int bit_field:1;
+} s;
+
+/* expect+1: error: cannot take address of bit-field [112] */
+void *ptr = &s.bit_field;
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_112.exp
--- a/tests/usr.bin/xlint/lint1/msg_112.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_112.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,1 +1,1 @@
-msg_112.c(6): error: syntax error ':' [249]
+msg_112.c(11): error: cannot take address of bit-field [112]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_113.c
--- a/tests/usr.bin/xlint/lint1/msg_113.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_113.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,7 +1,12 @@
-/*     $NetBSD: msg_113.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_113.c,v 1.3 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_113.c"
 
 // Test for message: cannot take address of register %s [113]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* ARGSUSED */
+void
+example(register int arg)
+{
+       /* expect+1: error: cannot take address of register arg [113] */
+       return &arg;
+}
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_113.exp
--- a/tests/usr.bin/xlint/lint1/msg_113.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_113.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,1 +1,1 @@
-msg_113.c(6): error: syntax error ':' [249]
+msg_113.c(11): error: cannot take address of register arg [113]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_114.c
--- a/tests/usr.bin/xlint/lint1/msg_114.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_114.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,12 +1,14 @@
-/*     $NetBSD: msg_114.c,v 1.4 2021/01/31 16:00:05 rillig Exp $       */
+/*     $NetBSD: msg_114.c,v 1.5 2022/06/16 16:58:36 rillig Exp $       */
 # 3 "msg_114.c"
 
 // Test for message: %soperand of '%s' must be lvalue [114]
 
+/* ARGSUSED */
 void
-example(int a)                 /* expect: 231 */
+example(int a)
 {
-       3++;                    /* expect: 114 */
+       /* expect+1: error: operand of 'x++' must be lvalue [114] */
+       3++;
 
        /*
         * Before tree.c 1.137 from 2021-01-09, trying to increment an array
@@ -14,7 +16,9 @@
         *
         * See msg_108.c for more details.
         */
-       "string"++;             /* expect: 108 */
+       /* expect+1: error: operand of 'x++' has invalid type (array) [108] */
+       "string"++;
 
-       (a + a)++;              /* expect: 114 */
+       /* expect+1: error: operand of 'x++' must be lvalue [114] */
+       (a + a)++;
 }
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_114.exp
--- a/tests/usr.bin/xlint/lint1/msg_114.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_114.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,4 +1,3 @@
-msg_114.c(9): error: operand of 'x++' must be lvalue [114]
-msg_114.c(17): error: operand of 'x++' has invalid type (array) [108]
-msg_114.c(19): error: operand of 'x++' must be lvalue [114]
-msg_114.c(7): warning: argument 'a' unused in function 'example' [231]
+msg_114.c(11): error: operand of 'x++' must be lvalue [114]
+msg_114.c(20): error: operand of 'x++' has invalid type (array) [108]
+msg_114.c(23): error: operand of 'x++' must be lvalue [114]
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_115.c
--- a/tests/usr.bin/xlint/lint1/msg_115.c       Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_115.c       Thu Jun 16 16:58:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_115.c,v 1.9 2021/08/16 16:19:47 rillig Exp $       */
+/*     $NetBSD: msg_115.c,v 1.10 2022/06/16 16:58:36 rillig Exp $      */
 # 3 "msg_115.c"
 
 // Test for message: %soperand of '%s' must be modifiable lvalue [115]
@@ -7,13 +7,20 @@
 example(const int *const_ptr)
 {
 
-       *const_ptr = 3;         /* expect: 115 */
-       *const_ptr += 1;        /* expect: 115 */
-       *const_ptr -= 4;        /* expect: 115 */
-       *const_ptr *= 1;        /* expect: 115 */
-       *const_ptr /= 5;        /* expect: 115 */
-       *const_ptr %= 9;        /* expect: 115 */
-       (*const_ptr)++;         /* expect: 115 */
+       /* expect+1: warning: left operand of '=' must be modifiable lvalue [115] */
+       *const_ptr = 3;
+       /* expect+1: warning: left operand of '+=' must be modifiable lvalue [115] */
+       *const_ptr += 1;
+       /* expect+1: warning: left operand of '-=' must be modifiable lvalue [115] */
+       *const_ptr -= 4;
+       /* expect+1: warning: left operand of '*=' must be modifiable lvalue [115] */
+       *const_ptr *= 1;
+       /* expect+1: warning: left operand of '/=' must be modifiable lvalue [115] */
+       *const_ptr /= 5;
+       /* expect+1: warning: left operand of '%=' must be modifiable lvalue [115] */
+       *const_ptr %= 9;
+       /* expect+1: warning: operand of 'x++' must be modifiable lvalue [115] */
+       (*const_ptr)++;
 
        /* In the next example, the left operand is not an lvalue at all. */
        /* expect+1: error: left operand of '=' must be lvalue [114] */
diff -r f0bf2dd119f1 -r 7ea9a21fff74 tests/usr.bin/xlint/lint1/msg_115.exp
--- a/tests/usr.bin/xlint/lint1/msg_115.exp     Thu Jun 16 16:27:30 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_115.exp     Thu Jun 16 16:58:35 2022 +0000
@@ -1,8 +1,8 @@
-msg_115.c(10): warning: left operand of '=' must be modifiable lvalue [115]
-msg_115.c(11): warning: left operand of '+=' must be modifiable lvalue [115]



Home | Main Index | Thread Index | Old Index