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: rename decl1ext, reduce visibility



details:   https://anonhg.NetBSD.org/src/rev/d87dbce46d79
branches:  trunk
changeset: 954019:d87dbce46d79
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 27 22:04:39 2021 +0000

description:
lint: rename decl1ext, reduce visibility

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c     |  86 +++++++++++++++++++++---------------------
 usr.bin/xlint/lint1/externs1.h |   3 +-
 2 files changed, 44 insertions(+), 45 deletions(-)

diffs (134 lines):

diff -r 260ca572ed1a -r d87dbce46d79 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Mar 27 21:56:51 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Mar 27 22:04:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.164 2021/03/27 12:42:22 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.165 2021/03/27 22:04:39 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.164 2021/03/27 12:42:22 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.165 2021/03/27 22:04:39 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1891,50 +1891,11 @@
        return sym;
 }
 
-void
-declare(sym_t *decl, bool initflg, sbuf_t *renaming)
-{
-       char *s;
-
-       switch (dcs->d_ctx) {
-       case EXTERN:
-               if (renaming != NULL) {
-                       lint_assert(decl->s_rename == NULL);
-
-                       s = getlblk(1, renaming->sb_len + 1);
-                       (void)memcpy(s, renaming->sb_name, renaming->sb_len + 1);
-                       decl->s_rename = s;
-               }
-               decl1ext(decl, initflg);
-               break;
-       case ARG:
-               if (renaming != NULL) {
-                       /* symbol renaming can't be used on function arguments */
-                       error(310);
-                       break;
-               }
-               (void)declare_argument(decl, initflg);
-               break;
-       default:
-               lint_assert(dcs->d_ctx == AUTO);
-               if (renaming != NULL) {
-                       /* symbol renaming can't be used on automatic variables */
-                       error(311);
-                       break;
-               }
-               declare_local(decl, initflg);
-               break;
-       }
-
-       if (initflg && !*current_initerr())
-               initstack_init();
-}
-
 /*
  * Process a single external declarator.
  */
-void
-decl1ext(sym_t *dsym, bool initflg)
+static void
+declare_extern(sym_t *dsym, bool initflg)
 {
        bool    dowarn, rval, redec;
        sym_t   *rdsym;
@@ -2053,6 +2014,45 @@
 
 }
 
+void
+declare(sym_t *decl, bool initflg, sbuf_t *renaming)
+{
+       char *s;
+
+       switch (dcs->d_ctx) {
+       case EXTERN:
+               if (renaming != NULL) {
+                       lint_assert(decl->s_rename == NULL);
+
+                       s = getlblk(1, renaming->sb_len + 1);
+                       (void)memcpy(s, renaming->sb_name, renaming->sb_len + 1);
+                       decl->s_rename = s;
+               }
+               declare_extern(decl, initflg);
+               break;
+       case ARG:
+               if (renaming != NULL) {
+                       /* symbol renaming can't be used on function arguments */
+                       error(310);
+                       break;
+               }
+               (void)declare_argument(decl, initflg);
+               break;
+       default:
+               lint_assert(dcs->d_ctx == AUTO);
+               if (renaming != NULL) {
+                       /* symbol renaming can't be used on automatic variables */
+                       error(311);
+                       break;
+               }
+               declare_local(decl, initflg);
+               break;
+       }
+
+       if (initflg && !*current_initerr())
+               initstack_init();
+}
+
 /*
  * Copies information about usage into a new symbol table entry of
  * the same symbol.
diff -r 260ca572ed1a -r d87dbce46d79 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sat Mar 27 21:56:51 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sat Mar 27 22:04:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.91 2021/03/27 12:42:22 rillig Exp $     */
+/*     $NetBSD: externs1.h,v 1.92 2021/03/27 22:04:39 rillig Exp $     */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -171,7 +171,6 @@
 extern type_t  *complete_tag_enum(type_t *, sym_t *);
 extern sym_t   *enumeration_constant(sym_t *, int, bool);
 extern void    declare(sym_t *, bool, sbuf_t *);
-extern void    decl1ext(sym_t *, bool);
 extern void    copy_usage_info(sym_t *, sym_t *);
 extern bool    check_redeclaration(sym_t *, bool *);
 extern bool    eqptrtype(const type_t *, const type_t *, bool);



Home | Main Index | Thread Index | Old Index