Module Name: src
Committed By: rillig
Date: Sun Feb 28 00:28:47 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: tree.c
Log Message:
lint: skip alignment computation if possible
Testing a global variable is simpler than calling a 20-line function.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 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/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.220 src/usr.bin/xlint/lint1/tree.c:1.221
--- src/usr.bin/xlint/lint1/tree.c:1.220 Sun Feb 28 00:23:55 2021
+++ src/usr.bin/xlint/lint1/tree.c Sun Feb 28 00:28:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.220 2021/02/28 00:23:55 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.221 2021/02/28 00:28:47 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.220 2021/02/28 00:23:55 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.221 2021/02/28 00:28:47 rillig Exp $");
#endif
#include <float.h>
@@ -2243,12 +2243,12 @@ check_pointer_conversion(op_t op, tnode_
return;
}
- if (alignment_in_bits(tp->t_subt) >
- alignment_in_bits(tn->tn_type->t_subt)) {
- if (hflag)
- /* possible pointer alignment problem */
- warning(135);
+ if (hflag && alignment_in_bits(tp->t_subt) >
+ alignment_in_bits(tn->tn_type->t_subt)) {
+ /* possible pointer alignment problem */
+ warning(135);
}
+
if (((nt == STRUCT || nt == UNION) &&
tp->t_subt->t_str != tn->tn_type->t_subt->t_str) ||
psize(nt) != psize(ot)) {