parent
5eadae9e5a
commit
6aee6dcfa0
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: decl.c,v 1.331 2023/07/01 09:31:55 rillig Exp $ */
|
/* $NetBSD: decl.c,v 1.332 2023/07/01 10:04:27 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID)
|
#if defined(__RCSID)
|
||||||
__RCSID("$NetBSD: decl.c,v 1.331 2023/07/01 09:31:55 rillig Exp $");
|
__RCSID("$NetBSD: decl.c,v 1.332 2023/07/01 10:04:27 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -424,7 +424,7 @@ set_first_typedef(type_t *tp, sym_t *sym)
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
bit_fields_width(sym_t **mem, bool *named)
|
bit_fields_width(const sym_t **mem, bool *named)
|
||||||
{
|
{
|
||||||
unsigned int width = 0;
|
unsigned int width = 0;
|
||||||
unsigned int align = 0;
|
unsigned int align = 0;
|
||||||
|
@ -452,7 +452,7 @@ pack_struct_or_union(type_t *tp)
|
||||||
|
|
||||||
unsigned int bits = 0;
|
unsigned int bits = 0;
|
||||||
bool named = false;
|
bool named = false;
|
||||||
for (sym_t *mem = tp->t_sou->sou_first_member;
|
for (const sym_t *mem = tp->t_sou->sou_first_member;
|
||||||
mem != NULL; mem = mem->s_next) {
|
mem != NULL; mem = mem->s_next) {
|
||||||
// TODO: Maybe update mem->u.s_member.sm_offset_in_bits.
|
// TODO: Maybe update mem->u.s_member.sm_offset_in_bits.
|
||||||
if (mem->s_type->t_bitfield) {
|
if (mem->s_type->t_bitfield) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: tree.c,v 1.541 2023/07/01 09:31:55 rillig Exp $ */
|
/* $NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID)
|
#if defined(__RCSID)
|
||||||
__RCSID("$NetBSD: tree.c,v 1.541 2023/07/01 09:31:55 rillig Exp $");
|
__RCSID("$NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
@ -4014,6 +4014,11 @@ type_size_in_bits(const type_t *tp)
|
||||||
|
|
||||||
unsigned int elsz;
|
unsigned int elsz;
|
||||||
switch (tp->t_tspec) {
|
switch (tp->t_tspec) {
|
||||||
|
case VOID:
|
||||||
|
/* cannot take size/alignment of void */
|
||||||
|
error(146);
|
||||||
|
elsz = 1;
|
||||||
|
break;
|
||||||
case FUNC:
|
case FUNC:
|
||||||
/* cannot take size/alignment of function type '%s' */
|
/* cannot take size/alignment of function type '%s' */
|
||||||
error(144, type_name(tp));
|
error(144, type_name(tp));
|
||||||
|
@ -4040,14 +4045,8 @@ type_size_in_bits(const type_t *tp)
|
||||||
/* cannot take size/alignment of bit-field */
|
/* cannot take size/alignment of bit-field */
|
||||||
error(145);
|
error(145);
|
||||||
}
|
}
|
||||||
if (tp->t_tspec == VOID) {
|
elsz = size_in_bits(tp->t_tspec);
|
||||||
/* cannot take size/alignment of void */
|
lint_assert(elsz > 0);
|
||||||
error(146);
|
|
||||||
elsz = 1;
|
|
||||||
} else {
|
|
||||||
elsz = size_in_bits(tp->t_tspec);
|
|
||||||
lint_assert(elsz > 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue