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: add test for 'possible...



details:   https://anonhg.NetBSD.org/src/rev/33590168cd0d
branches:  trunk
changeset: 959872:33590168cd0d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 28 00:20:19 2021 +0000

description:
tests/lint: add test for 'possible pointer alignment problem [135]'

diffstat:

 tests/usr.bin/xlint/lint1/msg_135.c   |  15 ++++++++++++---
 tests/usr.bin/xlint/lint1/msg_135.exp |   2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 20bf46d0fe14 -r 33590168cd0d tests/usr.bin/xlint/lint1/msg_135.c
--- a/tests/usr.bin/xlint/lint1/msg_135.c       Sat Feb 27 22:37:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_135.c       Sun Feb 28 00:20:19 2021 +0000
@@ -1,7 +1,16 @@
-/*     $NetBSD: msg_135.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_135.c,v 1.3 2021/02/28 00:20:19 rillig Exp $       */
 # 3 "msg_135.c"
 
 // Test for message: possible pointer alignment problem [135]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+unsigned
+read_uint(const unsigned char **pp)
+{
+       unsigned val;
+
+       val = *(const unsigned *)(*pp);
+       pp += sizeof(unsigned);
+       return val;
+}
diff -r 20bf46d0fe14 -r 33590168cd0d tests/usr.bin/xlint/lint1/msg_135.exp
--- a/tests/usr.bin/xlint/lint1/msg_135.exp     Sat Feb 27 22:37:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_135.exp     Sun Feb 28 00:20:19 2021 +0000
@@ -1,1 +1,1 @@
-msg_135.c(6): syntax error ':' [249]
+msg_135.c(13): warning: possible pointer alignment problem [135]



Home | Main Index | Thread Index | Old Index