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: flatten check_global_variable_size



details:   https://anonhg.NetBSD.org/src/rev/567b6be2dfbe
branches:  trunk
changeset: 950164:567b6be2dfbe
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jan 18 19:21:52 2021 +0000

description:
lint: flatten check_global_variable_size

diffstat:

 usr.bin/xlint/lint1/decl.c |  39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diffs (60 lines):

diff -r 02d0ab1f3022 -r 567b6be2dfbe usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon Jan 18 18:53:28 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon Jan 18 19:21:52 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -3194,23 +3194,24 @@
 check_global_variable_size(const sym_t *sym)
 {
 
-       if (sym->s_def == TDEF) {
-               if (sym->s_type->t_tspec == FUNC)
-                       /*
-                        * this can happen if an syntax error occurred
-                        * after a function declaration
-                        */
-                       return;
-               curr_pos = sym->s_def_pos;
-               if (length(sym->s_type, sym->s_name) == 0 &&
-                   sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
-                       if (tflag || (sym->s_scl == EXTERN && !sflag)) {
-                               /* empty array declaration: %s */
-                               warning(190, sym->s_name);
-                       } else {
-                               /* empty array declaration: %s */
-                               error(190, sym->s_name);
-                       }
+       if (sym->s_def != TDEF)
+               return;
+       if (sym->s_type->t_tspec == FUNC)
+               /*
+                * this can happen if a syntax error occurred after a
+                * function declaration
+                */
+               return;
+
+       curr_pos = sym->s_def_pos;
+       if (length(sym->s_type, sym->s_name) == 0 &&
+           sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
+               if (tflag || (sym->s_scl == EXTERN && !sflag)) {
+                       /* empty array declaration: %s */
+                       warning(190, sym->s_name);
+               } else {
+                       /* empty array declaration: %s */
+                       error(190, sym->s_name);
                }
        }
 }



Home | Main Index | Thread Index | Old Index