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: fix wrong warning about 'extern' t...



details:   https://anonhg.NetBSD.org/src/rev/659b3f2023d2
branches:  trunk
changeset: 374438:659b3f2023d2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Apr 22 20:27:09 2023 +0000

description:
lint: fix wrong warning about 'extern' temporary identifier

diffstat:

 tests/usr.bin/xlint/lint1/msg_351.c |  6 ++----
 usr.bin/xlint/lint1/decl.c          |  7 ++++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 2ea4ac293b0f -r 659b3f2023d2 tests/usr.bin/xlint/lint1/msg_351.c
--- a/tests/usr.bin/xlint/lint1/msg_351.c       Sat Apr 22 20:21:13 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_351.c       Sat Apr 22 20:27:09 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_351.c,v 1.2 2023/04/22 20:21:13 rillig Exp $       */
+/*     $NetBSD: msg_351.c,v 1.3 2023/04/22 20:27:09 rillig Exp $       */
 # 3 "msg_351.c"
 
 // Test for message 351: 'extern' declaration of '%s' outside a header [351]
@@ -36,7 +36,5 @@ static int static_func_def(void);
 int extern_func_decl(void);
 extern int extern_func_decl_verbose(void);
 
-/* FIXME: Don't warn about the identifier starting with '00000'. */
-/* expect+2: warning: 'extern' declaration of 'dbl_ptr' outside a header [351] */
-/* expect+1: warning: 'extern' declaration of '00000000_tmp' outside a header [351] */
+/* expect+1: warning: 'extern' declaration of 'dbl_ptr' outside a header [351] */
 double *dbl_ptr = &(double) { 0.0 };
diff -r 2ea4ac293b0f -r 659b3f2023d2 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Apr 22 20:21:13 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Apr 22 20:27:09 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.308 2023/04/22 17:49:15 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.309 2023/04/22 20:27:09 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.308 2023/04/22 17:49:15 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.309 2023/04/22 20:27:09 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1936,7 +1936,8 @@ check_extern_declaration(const sym_t *sy
 
        if (sym->s_scl == EXTERN &&
            dcs->d_redeclared_symbol == NULL &&
-           ends_with(curr_pos.p_file, ".c")) {
+           ends_with(curr_pos.p_file, ".c") &&
+           !ch_isdigit(sym->s_name[0])) {      /* see mktempsym */
                /* 'extern' declaration of '%s' outside a header */
                warning(351, sym->s_name);
        }



Home | Main Index | Thread Index | Old Index