Module Name: src Committed By: rillig Date: Sun Feb 28 00:40:22 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_135.c msg_135.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add type information to 'possible pointer alignment problem [135]' This warning occurs more than 7400 times in a regular NetBSD build, and without giving any type information, leaves the reader clueless about what the underlying issue might be. Add type information since that is a no-brainer to implement. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_135.c cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_135.exp cvs rdiff -u -r1.81 -r1.82 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_135.c diff -u src/tests/usr.bin/xlint/lint1/msg_135.c:1.3 src/tests/usr.bin/xlint/lint1/msg_135.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_135.c:1.3 Sun Feb 28 00:20:19 2021 +++ src/tests/usr.bin/xlint/lint1/msg_135.c Sun Feb 28 00:40:22 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_135.c,v 1.3 2021/02/28 00:20:19 rillig Exp $ */ +/* $NetBSD: msg_135.c,v 1.4 2021/02/28 00:40:22 rillig Exp $ */ # 3 "msg_135.c" -// Test for message: possible pointer alignment problem [135] +// Test for message: converting '%s' to '%s' may cause alignment problem [135] /* lint1-extra-flags: -h */ Index: src/tests/usr.bin/xlint/lint1/msg_135.exp diff -u src/tests/usr.bin/xlint/lint1/msg_135.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_135.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_135.exp:1.2 Sun Feb 28 00:20:19 2021 +++ src/tests/usr.bin/xlint/lint1/msg_135.exp Sun Feb 28 00:40:22 2021 @@ -1 +1 @@ -msg_135.c(13): warning: possible pointer alignment problem [135] +msg_135.c(13): warning: converting 'pointer to const unsigned char' to 'pointer to const unsigned int' may cause alignment problem [135] Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.81 src/usr.bin/xlint/lint1/err.c:1.82 --- src/usr.bin/xlint/lint1/err.c:1.81 Mon Feb 22 15:09:50 2021 +++ src/usr.bin/xlint/lint1/err.c Sun Feb 28 00:40:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.81 2021/02/22 15:09:50 rillig Exp $ */ +/* $NetBSD: err.c,v 1.82 2021/02/28 00:40:22 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.81 2021/02/22 15:09:50 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.82 2021/02/28 00:40:22 rillig Exp $"); #endif #include <sys/types.h> @@ -194,7 +194,7 @@ const char *msgs[] = { "conversion from '%s' to '%s' may lose accuracy", /* 132 */ "conversion of pointer to '%s' loses bits", /* 133 */ "conversion of pointer to '%s' may lose bits", /* 134 */ - "possible pointer alignment problem", /* 135 */ + "converting '%s' to '%s' may cause alignment problem", /* 135 */ "cannot do pointer arithmetic on operand of unknown size", /* 136 */ "use of incomplete enum type, op %s", /* 137 */ "unknown operand size, op %s", /* 138 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.221 src/usr.bin/xlint/lint1/tree.c:1.222 --- src/usr.bin/xlint/lint1/tree.c:1.221 Sun Feb 28 00:28:47 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 00:40:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.221 2021/02/28 00:28:47 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.222 2021/02/28 00:40:22 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.221 2021/02/28 00:28:47 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.222 2021/02/28 00:40:22 rillig Exp $"); #endif #include <float.h> @@ -2245,8 +2245,8 @@ check_pointer_conversion(op_t op, tnode_ if (hflag && alignment_in_bits(tp->t_subt) > alignment_in_bits(tn->tn_type->t_subt)) { - /* possible pointer alignment problem */ - warning(135); + /* converting '%s' to '%s' may cause alignment problem */ + warning(135, type_name(tn->tn_type), type_name(tp)); } if (((nt == STRUCT || nt == UNION) &&