lint: fix emitted type for arrays of unknown size
This commit is contained in:
parent
58c9f35c13
commit
960cfb1b4e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: emit.c,v 1.16 2023/05/22 11:51:46 rillig Exp $ */
|
||||
/* $NetBSD: emit.c,v 1.17 2023/05/22 17:53:27 rillig Exp $ */
|
||||
# 3 "emit.c"
|
||||
|
||||
/*
|
||||
|
@ -309,10 +309,9 @@ struct compound_expression_in_initializer compound = {
|
|||
};
|
||||
|
||||
/*
|
||||
* FIXME: The type that ends up in the .ln file is 'A0cC', which is wrong as it
|
||||
* has array size 0 instead of the correct 8.
|
||||
*
|
||||
* This is caused by cgram_declare being called before processing the
|
||||
* Before decl.c 1.312 and init.c 1.242 from 2023-05-22, the type that ended up
|
||||
* in the .ln file was 'A0cC', which was wrong as it had array size 0 instead
|
||||
* of the correct 8. That type had been taken too early, before looking at the
|
||||
* initializer.
|
||||
*/
|
||||
const char array_of_unknown_size[] = "unknown";
|
||||
|
|
|
@ -82,4 +82,4 @@ Semit.c
|
|||
289u0.289x16defined_used_var
|
||||
286d0.286d8use_varsF0V
|
||||
305d0.305d8compoundsT134compound_expression_in_initializer
|
||||
318d0.318d21array_of_unknown_sizeA0cC
|
||||
317d0.317d21array_of_unknown_sizeA8cC
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: decl.c,v 1.312 2023/05/22 17:47:27 rillig Exp $ */
|
||||
/* $NetBSD: decl.c,v 1.313 2023/05/22 17:53:27 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.312 2023/05/22 17:47:27 rillig Exp $");
|
||||
__RCSID("$NetBSD: decl.c,v 1.313 2023/05/22 17:53:27 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -1992,7 +1992,8 @@ declare_extern(sym_t *dsym, bool has_initializer, sbuf_t *renaming)
|
|||
*/
|
||||
bool rval = dsym->s_type->t_subt->t_tspec != VOID;
|
||||
outfdef(dsym, &dsym->s_def_pos, rval, false, NULL);
|
||||
} else if (!is_compiler_builtin(dsym->s_name)) {
|
||||
} else if (!is_compiler_builtin(dsym->s_name)
|
||||
&& !(has_initializer && dsym->s_type->t_incomplete_array)) {
|
||||
outsym(dsym, dsym->s_scl, dsym->s_def);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: init.c,v 1.241 2023/04/22 17:49:15 rillig Exp $ */
|
||||
/* $NetBSD: init.c,v 1.242 2023/05/22 17:53:27 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID)
|
||||
__RCSID("$NetBSD: init.c,v 1.241 2023/04/22 17:49:15 rillig Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.242 2023/05/22 17:53:27 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -252,6 +252,7 @@ update_type_of_array_of_unknown_size(sym_t *sym, size_t size)
|
|||
tp->t_incomplete_array = false;
|
||||
sym->s_type = tp;
|
||||
debug_step("completed array type is '%s'", type_name(sym->s_type));
|
||||
outsym(sym, sym->s_scl, sym->s_def);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue