Module Name: src
Committed By: rillig
Date: Sat Jun 24 20:50:54 UTC 2023
Modified Files:
src/usr.bin/xlint/lint1: ckbool.c debug.c emit1.c func.c lint1.h tree.c
Log Message:
lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.530 -r1.531 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/usr.bin/xlint/lint1/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.21 src/usr.bin/xlint/lint1/ckbool.c:1.22
--- src/usr.bin/xlint/lint1/ckbool.c:1.21 Mon May 22 12:55:04 2023
+++ src/usr.bin/xlint/lint1/ckbool.c Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.21 2023/05/22 12:55:04 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.22 2023/06/24 20:50:54 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: ckbool.c,v 1.21 2023/05/22 12:55:04 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.22 2023/06/24 20:50:54 rillig Exp $");
#endif
#include <string.h>
@@ -79,7 +79,7 @@ is_symmetric_bool_or_other(op_t op)
static bool
is_int_constant_zero(const tnode_t *tn, tspec_t t)
{
- return t == INT && tn->tn_op == CON && tn->tn_val->v_quad == 0;
+ return t == INT && tn->tn_op == CON && tn->tn_val.v_quad == 0;
}
static bool
Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.35 src/usr.bin/xlint/lint1/debug.c:1.36
--- src/usr.bin/xlint/lint1/debug.c:1.35 Sat Jun 24 08:11:12 2023
+++ src/usr.bin/xlint/lint1/debug.c Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.35 2023/06/24 08:11:12 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.36 2023/06/24 20:50:54 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.35 2023/06/24 08:11:12 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.36 2023/06/24 20:50:54 rillig Exp $");
#endif
#include <stdlib.h>
@@ -184,21 +184,21 @@ debug_node(const tnode_t *tn) // NOLINT(
break;
case CON:
if (is_floating(tn->tn_type->t_tspec))
- debug_printf(", value %Lg", tn->tn_val->v_ldbl);
+ debug_printf(", value %Lg", tn->tn_val.v_ldbl);
else if (is_uinteger(tn->tn_type->t_tspec))
debug_printf(", value %llu",
- (unsigned long long)tn->tn_val->v_quad);
+ (unsigned long long)tn->tn_val.v_quad);
else if (is_integer(tn->tn_type->t_tspec))
debug_printf(", value %lld",
- (long long)tn->tn_val->v_quad);
+ (long long)tn->tn_val.v_quad);
else {
lint_assert(tn->tn_type->t_tspec == BOOL);
debug_printf(", value %s",
- tn->tn_val->v_quad != 0 ? "true" : "false");
+ tn->tn_val.v_quad != 0 ? "true" : "false");
}
- if (tn->tn_val->v_unsigned_since_c90)
+ if (tn->tn_val.v_unsigned_since_c90)
debug_printf(", unsigned_since_c90");
- if (tn->tn_val->v_char_constant)
+ if (tn->tn_val.v_char_constant)
debug_printf(", char_constant");
debug_printf("\n");
break;
Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.68 src/usr.bin/xlint/lint1/emit1.c:1.69
--- src/usr.bin/xlint/lint1/emit1.c:1.68 Fri Jun 9 15:36:31 2023
+++ src/usr.bin/xlint/lint1/emit1.c Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.68 2023/06/09 15:36:31 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.69 2023/06/24 20:50:54 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: emit1.c,v 1.68 2023/06/09 15:36:31 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.69 2023/06/24 20:50:54 rillig Exp $");
#endif
#include "lint1.h"
@@ -372,7 +372,7 @@ outcall(const tnode_t *tn, bool retval_u
* XXX it would probably be better to
* explicitly test the sign
*/
- if ((q = arg->tn_val->v_quad) == 0) {
+ if ((q = arg->tn_val.v_quad) == 0) {
/* zero constant */
outchar('z');
} else if (!msb(q, t)) {
Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.156 src/usr.bin/xlint/lint1/func.c:1.157
--- src/usr.bin/xlint/lint1/func.c:1.156 Fri Jun 9 15:36:31 2023
+++ src/usr.bin/xlint/lint1/func.c Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.156 2023/06/09 15:36:31 rillig Exp $ */
+/* $NetBSD: func.c,v 1.157 2023/06/24 20:50:54 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.156 2023/06/09 15:36:31 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.157 2023/06/24 20:50:54 rillig Exp $");
#endif
#include <stdlib.h>
@@ -454,8 +454,8 @@ check_case_label_bitand(const tnode_t *c
return;
lint_assert(case_expr->tn_op == CON);
- case_value = case_expr->tn_val->v_quad;
- mask = switch_expr->tn_right->tn_val->v_quad;
+ case_value = case_expr->tn_val.v_quad;
+ mask = switch_expr->tn_right->tn_val.v_quad;
if ((case_value & ~mask) != 0) {
/* statement not reached */
Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.166 src/usr.bin/xlint/lint1/lint1.h:1.167
--- src/usr.bin/xlint/lint1/lint1.h:1.166 Sat Jun 24 08:11:12 2023
+++ src/usr.bin/xlint/lint1/lint1.h Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.166 2023/06/24 08:11:12 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.167 2023/06/24 20:50:54 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -315,7 +315,7 @@ typedef struct tnode {
struct tnode *_tn_right; /* right operand */
} tn_s;
sym_t *_tn_sym; /* symbol if op == NAME */
- val_t *_tn_val; /* value if op == CON */
+ val_t _tn_val; /* value if op == CON */
strg_t *_tn_string; /* string if op == STRING */
} tn_u;
} tnode_t;
@@ -528,20 +528,20 @@ static inline bool
constant_is_nonzero(const tnode_t *tn)
{
lint_assert(tn->tn_op == CON);
- lint_assert(tn->tn_type->t_tspec == tn->tn_val->v_tspec);
- return is_nonzero_val(tn->tn_val);
+ lint_assert(tn->tn_type->t_tspec == tn->tn_val.v_tspec);
+ return is_nonzero_val(&tn->tn_val);
}
static inline bool
is_zero(const tnode_t *tn)
{
- return tn != NULL && tn->tn_op == CON && !is_nonzero_val(tn->tn_val);
+ return tn != NULL && tn->tn_op == CON && !is_nonzero_val(&tn->tn_val);
}
static inline bool
is_nonzero(const tnode_t *tn)
{
- return tn != NULL && tn->tn_op == CON && is_nonzero_val(tn->tn_val);
+ return tn != NULL && tn->tn_op == CON && is_nonzero_val(&tn->tn_val);
}
static inline bool
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.530 src/usr.bin/xlint/lint1/tree.c:1.531
--- src/usr.bin/xlint/lint1/tree.c:1.530 Sat Jun 24 17:50:31 2023
+++ src/usr.bin/xlint/lint1/tree.c Sat Jun 24 20:50:54 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.530 2023/06/24 17:50:31 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.531 2023/06/24 20:50:54 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.530 2023/06/24 17:50:31 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.531 2023/06/24 20:50:54 rillig Exp $");
#endif
#include <float.h>
@@ -276,7 +276,7 @@ ic_expr(const tnode_t *tn)
switch (tn->tn_op) {
case CON:
- return ic_con(tn->tn_type, tn->tn_val);
+ return ic_con(tn->tn_type, &tn->tn_val);
case CVT:
if (!is_integer(tn->tn_left->tn_type->t_tspec))
return ic_any(tn->tn_type);
@@ -373,11 +373,10 @@ build_constant(type_t *tp, val_t *v)
n = expr_alloc_tnode();
n->tn_op = CON;
n->tn_type = tp;
- n->tn_val = expr_zero_alloc(sizeof(*n->tn_val));
- n->tn_val->v_tspec = tp->t_tspec;
- n->tn_val->v_unsigned_since_c90 = v->v_unsigned_since_c90;
- n->tn_val->v_char_constant = v->v_char_constant;
- n->tn_val->v_u = v->v_u;
+ n->tn_val.v_tspec = tp->t_tspec;
+ n->tn_val.v_unsigned_since_c90 = v->v_unsigned_since_c90;
+ n->tn_val.v_char_constant = v->v_char_constant;
+ n->tn_val.v_u = v->v_u;
free(v);
return n;
}
@@ -390,9 +389,10 @@ build_integer_constant(tspec_t t, int64_
n = expr_alloc_tnode();
n->tn_op = CON;
n->tn_type = gettyp(t);
- n->tn_val = expr_zero_alloc(sizeof(*n->tn_val));
- n->tn_val->v_tspec = t;
- n->tn_val->v_quad = q;
+ n->tn_val.v_tspec = t;
+ n->tn_val.v_unsigned_since_c90 = false;
+ n->tn_val.v_char_constant = false;
+ n->tn_val.v_quad = q;
return n;
}
@@ -507,14 +507,16 @@ build_name(sym_t *sym, bool is_funcname)
n->tn_type = sym->s_type;
if (sym->s_scl == BOOL_CONST) {
n->tn_op = CON;
- n->tn_val = expr_zero_alloc(sizeof(*n->tn_val));
- n->tn_val->v_tspec = BOOL;
- n->tn_val->v_quad = sym->u.s_bool_constant ? 1 : 0;
+ n->tn_val.v_tspec = BOOL;
+ n->tn_val.v_unsigned_since_c90 = false;
+ n->tn_val.v_char_constant = false;
+ n->tn_val.v_quad = sym->u.s_bool_constant ? 1 : 0;
} else if (sym->s_scl == ENUM_CONST) {
n->tn_op = CON;
- n->tn_val = expr_zero_alloc(sizeof(*n->tn_val));
- n->tn_val->v_tspec = INT; /* ENUM is in n->tn_type */
- n->tn_val->v_quad = sym->u.s_enum_constant;
+ n->tn_val.v_tspec = INT; /* ENUM is in n->tn_type */
+ n->tn_val.v_unsigned_since_c90 = false;
+ n->tn_val.v_char_constant = false;
+ n->tn_val.v_quad = sym->u.s_enum_constant;
} else {
n->tn_op = NAME;
n->tn_sym = sym;
@@ -580,9 +582,9 @@ static bool
is_out_of_char_range(const tnode_t *tn)
{
return tn->tn_op == CON &&
- !tn->tn_val->v_char_constant &&
- !(0 <= tn->tn_val->v_quad &&
- tn->tn_val->v_quad < 1 << (CHAR_SIZE - 1));
+ !tn->tn_val.v_char_constant &&
+ !(0 <= tn->tn_val.v_quad &&
+ tn->tn_val.v_quad < 1 << (CHAR_SIZE - 1));
}
static void
@@ -601,16 +603,16 @@ check_integer_comparison(op_t op, tnode_
if (any_query_enabled && !in_system_header) {
if (lt == CHAR && rn->tn_op == CON &&
- !rn->tn_val->v_char_constant) {
+ !rn->tn_val.v_char_constant) {
/* comparison '%s' of 'char' with plain integer %d */
query_message(14,
- op_name(op), (int)rn->tn_val->v_quad);
+ op_name(op), (int)rn->tn_val.v_quad);
}
if (rt == CHAR && ln->tn_op == CON &&
- !ln->tn_val->v_char_constant) {
+ !ln->tn_val.v_char_constant) {
/* comparison '%s' of 'char' with plain integer %d */
query_message(14,
- op_name(op), (int)ln->tn_val->v_quad);
+ op_name(op), (int)ln->tn_val.v_quad);
}
}
@@ -618,7 +620,7 @@ check_integer_comparison(op_t op, tnode_
if (lt == CHAR && is_out_of_char_range(rn)) {
char buf[128];
(void)snprintf(buf, sizeof(buf), "%s %d",
- op_name(op), (int)rn->tn_val->v_quad);
+ op_name(op), (int)rn->tn_val.v_quad);
/* nonportable character comparison '%s' */
warning(230, buf);
return;
@@ -626,7 +628,7 @@ check_integer_comparison(op_t op, tnode_
if (rt == CHAR && is_out_of_char_range(ln)) {
char buf[128];
(void)snprintf(buf, sizeof(buf), "%d %s ?",
- (int)ln->tn_val->v_quad, op_name(op));
+ (int)ln->tn_val.v_quad, op_name(op));
/* nonportable character comparison '%s' */
warning(230, buf);
return;
@@ -634,8 +636,8 @@ check_integer_comparison(op_t op, tnode_
}
if (is_uinteger(lt) && !is_uinteger(rt) &&
- rn->tn_op == CON && rn->tn_val->v_quad <= 0) {
- if (rn->tn_val->v_quad < 0) {
+ rn->tn_op == CON && rn->tn_val.v_quad <= 0) {
+ if (rn->tn_val.v_quad < 0) {
/* operator '%s' compares '%s' with '%s' */
warning(162, op_name(op),
type_name(ln->tn_type), "negative constant");
@@ -646,8 +648,8 @@ check_integer_comparison(op_t op, tnode_
return;
}
if (is_uinteger(rt) && !is_uinteger(lt) &&
- ln->tn_op == CON && ln->tn_val->v_quad <= 0) {
- if (ln->tn_val->v_quad < 0) {
+ ln->tn_op == CON && ln->tn_val.v_quad <= 0) {
+ if (ln->tn_val.v_quad < 0) {
/* operator '%s' compares '%s' with '%s' */
warning(162, op_name(op),
"negative constant", type_name(rn->tn_type));
@@ -812,9 +814,9 @@ fold(tnode_t *tn)
t = tn->tn_left->tn_type->t_tspec;
utyp = !is_integer(t) || is_uinteger(t);
- ul = sl = tn->tn_left->tn_val->v_quad;
+ ul = sl = tn->tn_left->tn_val.v_quad;
if (is_binary(tn))
- ur = sr = tn->tn_right->tn_val->v_quad;
+ ur = sr = tn->tn_right->tn_val.v_quad;
mask = (int64_t)value_bits(size_in_bits(t));
ovfl = false;
@@ -1193,7 +1195,7 @@ is_null_pointer(const tnode_t *tn)
return ((t == PTR && tn->tn_type->t_subt->t_tspec == VOID) ||
is_integer(t))
- && (tn->tn_op == CON && tn->tn_val->v_quad == 0);
+ && (tn->tn_op == CON && tn->tn_val.v_quad == 0);
}
/* Return a type based on tp1, with added qualifiers from tp2. */
@@ -1602,9 +1604,9 @@ fold_float(tnode_t *tn)
lint_assert(t == tn->tn_left->tn_type->t_tspec);
lint_assert(!is_binary(tn) || t == tn->tn_right->tn_type->t_tspec);
- lv = tn->tn_left->tn_val->v_ldbl;
+ lv = tn->tn_left->tn_val.v_ldbl;
if (is_binary(tn))
- rv = tn->tn_right->tn_val->v_ldbl;
+ rv = tn->tn_right->tn_val.v_ldbl;
switch (tn->tn_op) {
case UPLUS:
@@ -1729,16 +1731,16 @@ build_binary(tnode_t *ln, op_t op, bool
* ANSI C, print a warning.
*/
if (mp->m_warn_if_left_unsigned_in_c90 &&
- ln->tn_op == CON && ln->tn_val->v_unsigned_since_c90) {
+ ln->tn_op == CON && ln->tn_val.v_unsigned_since_c90) {
/* ANSI C treats constant as unsigned, op '%s' */
warning(218, mp->m_name);
- ln->tn_val->v_unsigned_since_c90 = false;
+ ln->tn_val.v_unsigned_since_c90 = false;
}
if (mp->m_warn_if_right_unsigned_in_c90 &&
- rn->tn_op == CON && rn->tn_val->v_unsigned_since_c90) {
+ rn->tn_op == CON && rn->tn_val.v_unsigned_since_c90) {
/* ANSI C treats constant as unsigned, op '%s' */
warning(218, mp->m_name);
- rn->tn_val->v_unsigned_since_c90 = false;
+ rn->tn_val.v_unsigned_since_c90 = false;
}
/* Make sure both operands are of the same type */
@@ -1851,7 +1853,7 @@ build_binary(tnode_t *ln, op_t op, bool
ntn = fold(ntn);
}
} else if (op == QUEST && ln->tn_op == CON) {
- ntn = ln->tn_val->v_quad != 0
+ ntn = ln->tn_val.v_quad != 0
? rn->tn_left : rn->tn_right;
}
}
@@ -2286,14 +2288,14 @@ typeok_shr(const mod_t *mp,
if (ln->tn_op != CON) {
/* bitwise '%s' on signed value possibly nonportable */
warning(117, mp->m_name);
- } else if (ln->tn_val->v_quad < 0) {
+ } else if (ln->tn_val.v_quad < 0) {
/* bitwise '%s' on signed value nonportable */
warning(120, mp->m_name);
}
} else if (allow_trad && allow_c90 &&
!is_uinteger(olt) && is_uinteger(ort)) {
/* The left operand would become unsigned in traditional C. */
- if (hflag && (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+ if (hflag && (ln->tn_op != CON || ln->tn_val.v_quad < 0)) {
/* semantics of '%s' change in ANSI C; use ... */
warning(118, mp->m_name);
}
@@ -2304,7 +2306,7 @@ typeok_shr(const mod_t *mp,
* In traditional C the left operand would be extended
* (possibly sign-extended) and then shifted.
*/
- if (hflag && (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+ if (hflag && (ln->tn_op != CON || ln->tn_val.v_quad < 0)) {
/* semantics of '%s' change in ANSI C; use ... */
warning(118, mp->m_name);
}
@@ -2340,16 +2342,16 @@ typeok_shift(const type_t *ltp, tspec_t
if (rn->tn_op != CON)
return;
- if (!is_uinteger(rt) && rn->tn_val->v_quad < 0) {
+ if (!is_uinteger(rt) && rn->tn_val.v_quad < 0) {
/* negative shift */
warning(121);
- } else if ((uint64_t)rn->tn_val->v_quad ==
+ } else if ((uint64_t)rn->tn_val.v_quad ==
(uint64_t)size_in_bits(lt)) {
/* shift amount %u equals bit-size of '%s' */
- warning(267, (unsigned)rn->tn_val->v_quad, type_name(ltp));
- } else if ((uint64_t)rn->tn_val->v_quad > (uint64_t)size_in_bits(lt)) {
+ warning(267, (unsigned)rn->tn_val.v_quad, type_name(ltp));
+ } else if ((uint64_t)rn->tn_val.v_quad > (uint64_t)size_in_bits(lt)) {
/* shift amount %llu is greater than bit-size %llu of '%s' */
- warning(122, (unsigned long long)rn->tn_val->v_quad,
+ warning(122, (unsigned long long)rn->tn_val.v_quad,
(unsigned long long)size_in_bits(lt),
tspec_name(lt));
}
@@ -2977,7 +2979,7 @@ is_int_constant_zero(const tnode_t *tn)
return tn->tn_op == CON &&
tn->tn_type->t_tspec == INT &&
- tn->tn_val->v_quad == 0;
+ tn->tn_val.v_quad == 0;
}
static void
@@ -3164,7 +3166,7 @@ check_enum_int_mismatch(op_t op, int arg
*/
if (!rn->tn_type->t_is_enum && rn->tn_op == CON &&
is_integer(rn->tn_type->t_tspec) &&
- rn->tn_val->v_quad == 0) {
+ rn->tn_val.v_quad == 0) {
return;
}
/* initialization of '%s' with '%s' */
@@ -3358,7 +3360,7 @@ should_warn_about_prototype_conversion(t
*/
if (ptn->tn_op == CON && is_integer(nt) &&
signed_type(nt) == signed_type(ot) &&
- !msb(ptn->tn_val->v_quad, ot))
+ !msb(ptn->tn_val.v_quad, ot))
return false;
return true;
@@ -3684,9 +3686,8 @@ convert(op_t op, int arg, type_t *tp, tn
ntn->tn_left = tn;
} else {
ntn->tn_op = CON;
- ntn->tn_val = expr_zero_alloc(sizeof(*ntn->tn_val));
- convert_constant(op, arg, ntn->tn_type, ntn->tn_val,
- tn->tn_val);
+ convert_constant(op, arg, ntn->tn_type, &ntn->tn_val,
+ &tn->tn_val);
}
return ntn;
@@ -4405,14 +4406,14 @@ constant(tnode_t *tn, bool required)
v->v_tspec = tn->tn_type->t_tspec;
if (tn->tn_op == CON) {
- lint_assert(tn->tn_type->t_tspec == tn->tn_val->v_tspec);
- if (is_integer(tn->tn_val->v_tspec)) {
+ lint_assert(tn->tn_type->t_tspec == tn->tn_val.v_tspec);
+ if (is_integer(tn->tn_val.v_tspec)) {
v->v_unsigned_since_c90 =
- tn->tn_val->v_unsigned_since_c90;
- v->v_quad = tn->tn_val->v_quad;
+ tn->tn_val.v_unsigned_since_c90;
+ v->v_quad = tn->tn_val.v_quad;
return v;
}
- v->v_quad = (int64_t)tn->tn_val->v_ldbl;
+ v->v_quad = (int64_t)tn->tn_val.v_ldbl;
} else {
v->v_quad = 1;
}
@@ -4434,7 +4435,7 @@ static bool
is_constcond_false(const tnode_t *tn, tspec_t t)
{
return (t == BOOL || t == INT) &&
- tn->tn_op == CON && tn->tn_val->v_quad == 0;
+ tn->tn_op == CON && tn->tn_val.v_quad == 0;
}
/*
@@ -4514,7 +4515,7 @@ check_array_index(tnode_t *tn, bool ampe
* For incomplete array types, we can print a warning only if
* the index is negative.
*/
- if (is_incomplete(ln->tn_left->tn_type) && rn->tn_val->v_quad >= 0)
+ if (is_incomplete(ln->tn_left->tn_type) && rn->tn_val.v_quad >= 0)
return;
/* Get the size of one array element */
@@ -4525,8 +4526,8 @@ check_array_index(tnode_t *tn, bool ampe
/* Change the unit of the index from bytes to element size. */
int64_t con = is_uinteger(rn->tn_type->t_tspec)
- ? (int64_t)((uint64_t)rn->tn_val->v_quad / elsz)
- : rn->tn_val->v_quad / elsz;
+ ? (int64_t)((uint64_t)rn->tn_val.v_quad / elsz)
+ : rn->tn_val.v_quad / elsz;
int dim = ln->tn_left->tn_type->t_dim + (amper ? 1 : 0);
@@ -4772,11 +4773,11 @@ constant_addr(const tnode_t *tn, const s
case PLUS:
offs1 = offs2 = 0;
if (tn->tn_left->tn_op == CON) {
- offs1 = (ptrdiff_t)tn->tn_left->tn_val->v_quad;
+ offs1 = (ptrdiff_t)tn->tn_left->tn_val.v_quad;
if (!constant_addr(tn->tn_right, &sym, &offs2))
return false;
} else if (tn->tn_right->tn_op == CON) {
- offs2 = (ptrdiff_t)tn->tn_right->tn_val->v_quad;
+ offs2 = (ptrdiff_t)tn->tn_right->tn_val.v_quad;
if (tn->tn_op == MINUS)
offs2 = -offs2;
if (!constant_addr(tn->tn_left, &sym, &offs1))