Module Name: src
Committed By: rillig
Date: Sun Jan 29 18:16:48 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_func.c
src/usr.bin/xlint/lint1: tree.c
Log Message:
lint: fix definition of __func__
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_c99_func.c
cvs rdiff -u -r1.503 -r1.504 src/usr.bin/xlint/lint1/tree.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/d_c99_func.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_func.c:1.4 src/tests/usr.bin/xlint/lint1/d_c99_func.c:1.5
--- src/tests/usr.bin/xlint/lint1/d_c99_func.c:1.4 Sun Jan 29 17:36:26 2023
+++ src/tests/usr.bin/xlint/lint1/d_c99_func.c Sun Jan 29 18:16:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_func.c,v 1.4 2023/01/29 17:36:26 rillig Exp $ */
+/* $NetBSD: d_c99_func.c,v 1.5 2023/01/29 18:16:48 rillig Exp $ */
# 3 "d_c99_func.c"
/* C99 __func__ */
@@ -8,8 +8,7 @@ const char *str;
const char *
function_name(void)
{
- /* FIXME: -14 for the array, not -8 for a pointer. */
- /* expect+1: error: negative array dimension (-8) [20] */
+ /* expect+1: error: negative array dimension (-14) [20] */
typedef int reveal_size[-(int)sizeof(__func__)];
return __func__;
}
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.503 src/usr.bin/xlint/lint1/tree.c:1.504
--- src/usr.bin/xlint/lint1/tree.c:1.503 Sun Jan 29 17:36:26 2023
+++ src/usr.bin/xlint/lint1/tree.c Sun Jan 29 18:16:48 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.503 2023/01/29 17:36:26 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.504 2023/01/29 18:16:48 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.503 2023/01/29 17:36:26 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.504 2023/01/29 18:16:48 rillig Exp $");
#endif
#include <float.h>
@@ -405,8 +405,9 @@ fallback_symbol(sym_t *sym)
/* __func__ is a C99 feature */
warning(317);
/* C11 6.4.2.2 */
- sym->s_type = block_derive_type(gettyp(CHAR), PTR);
+ sym->s_type = block_derive_type(gettyp(CHAR), ARRAY);
sym->s_type->t_const = true;
+ sym->s_type->t_dim = (int)strlen(funcsym->s_name) + 1;
return;
}