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 definition of __func__



details:   https://anonhg.NetBSD.org/src/rev/b8347f866824
branches:  trunk
changeset: 373288:b8347f866824
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 29 18:16:48 2023 +0000

description:
lint: fix definition of __func__

diffstat:

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

diffs (48 lines):

diff -r 75e93250fcdd -r b8347f866824 tests/usr.bin/xlint/lint1/d_c99_func.c
--- a/tests/usr.bin/xlint/lint1/d_c99_func.c    Sun Jan 29 18:13:56 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_func.c    Sun Jan 29 18:16:48 2023 +0000
@@ -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 *
 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__;
 }
diff -r 75e93250fcdd -r b8347f866824 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 29 18:13:56 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 29 18:16:48 2023 +0000
@@ -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 @@
                        /* __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;
        }
 



Home | Main Index | Thread Index | Old Index