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: do not export unnamed objects to t...



details:   https://anonhg.NetBSD.org/src/rev/4a3ece3caf08
branches:  trunk
changeset: 1026543:4a3ece3caf08
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 28 10:01:36 2021 +0000

description:
lint: do not export unnamed objects to the .ln file

Since these objects are unnamed, they cannot be referenced by other
files or even create name clashes.

Seen in usr.sbin/cpuctl/aarch64.c, reported by Christos.

diffstat:

 tests/usr.bin/xlint/lint1/emit.exp-ln |  2 --
 usr.bin/xlint/lint1/emit1.c           |  9 +++++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 9fb195256234 -r 4a3ece3caf08 tests/usr.bin/xlint/lint1/emit.exp-ln
--- a/tests/usr.bin/xlint/lint1/emit.exp-ln     Sun Nov 28 09:59:59 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/emit.exp-ln     Sun Nov 28 10:01:36 2021 +0000
@@ -82,5 +82,3 @@
 286u0.286x16defined_used_var
 283d0.283d8use_varsF0V
 302d0.302d8compoundsT134compound_expression_in_initializer
-303d-1.0d1200000000_tmpA16PcC
-305u0.305x1200000000_tmp
diff -r 9fb195256234 -r 4a3ece3caf08 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sun Nov 28 09:59:59 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sun Nov 28 10:01:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.59 2021/09/12 10:06:03 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.60 2021/11/28 10:01:36 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: emit1.c,v 1.59 2021/09/12 10:06:03 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.60 2021/11/28 10:01:36 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -187,6 +187,8 @@
         */
        if (sc != EXTERN && !(sc == STATIC && sym->s_type->t_tspec == FUNC))
                return;
+       if (ch_isdigit(sym->s_name[0])) /* 00000000_tmp */
+               return;
 
        /* reset buffer */
        outclr();
@@ -586,6 +588,9 @@
 void
 outusg(const sym_t *sym)
 {
+       if (ch_isdigit(sym->s_name[0])) /* 00000000_tmp */
+               return;
+
        /* reset buffer */
        outclr();
 



Home | Main Index | Thread Index | Old Index