Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: skip alignment computation if poss...



details:   https://anonhg.NetBSD.org/src/rev/df4a79adef0c
branches:  trunk
changeset: 981098:df4a79adef0c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 28 00:28:47 2021 +0000

description:
lint: skip alignment computation if possible

Testing a global variable is simpler than calling a 20-line function.

No functional change.

diffstat:

 usr.bin/xlint/lint1/tree.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (36 lines):

diff -r fbbe6a079121 -r df4a79adef0c usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Feb 28 00:23:55 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Feb 28 00:28:47 2021 +0000
@@ -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 @@
                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)) {



Home | Main Index | Thread Index | Old Index