lint: fix definition of __func__

This commit is contained in:
rillig 2023-01-29 18:16:48 +00:00
parent 7dd63c1c67
commit b5b35fa5a0
2 changed files with 6 additions and 6 deletions

View File

@ -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__;
}

View File

@ -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;
}