Module Name: src
Committed By: rillig
Date: Sat Apr 22 20:27:09 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_351.c
src/usr.bin/xlint/lint1: decl.c
Log Message:
lint: fix wrong warning about 'extern' temporary identifier
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_351.c
cvs rdiff -u -r1.308 -r1.309 src/usr.bin/xlint/lint1/decl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/msg_351.c
diff -u src/tests/usr.bin/xlint/lint1/msg_351.c:1.2 src/tests/usr.bin/xlint/lint1/msg_351.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_351.c:1.2 Sat Apr 22 20:21:13 2023
+++ src/tests/usr.bin/xlint/lint1/msg_351.c Sat Apr 22 20:27:09 2023
@@ -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 };
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.308 src/usr.bin/xlint/lint1/decl.c:1.309
--- src/usr.bin/xlint/lint1/decl.c:1.308 Sat Apr 22 17:49:15 2023
+++ src/usr.bin/xlint/lint1/decl.c Sat Apr 22 20:27:09 2023
@@ -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);
}