bc_reserve_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc)
{
bytecode_reserve *reserve = (bytecode_reserve *)bc->contents;
- yasm_value val;
-
- if (yasm_value_finalize_expr(&val, reserve->numitems, prev_bc, 0))
- yasm_error_set(YASM_ERROR_TOO_COMPLEX,
- N_("reserve expression too complex"));
- else if (val.rel)
- yasm_error_set(YASM_ERROR_NOT_ABSOLUTE,
- N_("reserve expression not absolute"));
- else if (val.abs && yasm_expr__contains(val.abs, YASM_EXPR_FLOAT))
- yasm_error_set(YASM_ERROR_VALUE,
- N_("expression must not contain floating point value"));
- reserve->numitems = val.abs;
+ /* multiply reserve expression into multiple */
+ if (!bc->multiple)
+ bc->multiple = reserve->numitems;
+ else
+ bc->multiple = yasm_expr_create_tree(bc->multiple, YASM_EXPR_MUL,
+ reserve->numitems, bc->line);
+ reserve->numitems = NULL;
}
static int
void *add_span_data)
{
bytecode_reserve *reserve = (bytecode_reserve *)bc->contents;
- /*@dependent@*/ /*@null@*/ const yasm_intnum *num;
-
- if (!reserve->numitems)
- return 0;
-
- num = yasm_expr_get_intnum(&reserve->numitems, 0);
- if (!num) {
- /* Check for use of floats first. */
- if (reserve->numitems &&
- yasm_expr__contains(reserve->numitems, YASM_EXPR_FLOAT)) {
- yasm_error_set(YASM_ERROR_VALUE,
- N_("expression must not contain floating point value"));
- return -1;
- }
- /* FIXME: Non-constant currently not allowed. */
- yasm_error_set(YASM_ERROR_NOT_CONSTANT,
- N_("attempt to reserve non-constant quantity of space"));
- return -1;
- }
-
- bc->len += yasm_intnum_get_uint(num)*reserve->itemsize;
+ bc->len += reserve->itemsize;
return 0;
}
EXTRA_DIST += libyasm/tests/opt-oldalign.hex
EXTRA_DIST += libyasm/tests/opt-struc.asm
EXTRA_DIST += libyasm/tests/opt-struc.hex
+EXTRA_DIST += libyasm/tests/reserve-err1.asm
+EXTRA_DIST += libyasm/tests/reserve-err1.errwarn
+EXTRA_DIST += libyasm/tests/reserve-err2.asm
+EXTRA_DIST += libyasm/tests/reserve-err2.errwarn
+EXTRA_DIST += libyasm/tests/strucsize.asm
+EXTRA_DIST += libyasm/tests/strucsize.hex
+EXTRA_DIST += libyasm/tests/times0.asm
+EXTRA_DIST += libyasm/tests/times0.hex
EXTRA_DIST += libyasm/tests/timesover-err.asm
EXTRA_DIST += libyasm/tests/timesover-err.errwarn
EXTRA_DIST += libyasm/tests/timesunder.asm
EXTRA_DIST += libyasm/tests/timesunder.hex
+EXTRA_DIST += libyasm/tests/times-res.asm
+EXTRA_DIST += libyasm/tests/times-res.errwarn
+EXTRA_DIST += libyasm/tests/times-res.hex
EXTRA_DIST += libyasm/tests/unary.asm
EXTRA_DIST += libyasm/tests/unary.hex
EXTRA_DIST += libyasm/tests/value-err.asm
+-:3: multiple is negative
-:4: expression must not contain floating point value
-:5: expression must not contain floating point value
--:7: reserve expression not absolute
+-:10: multiple is negative
-:11: expression must not contain floating point value
-:12: expression must not contain floating point value
--:14: reserve expression not absolute
EXTRA_DIST += modules/objfmts/bin/tests/reserve.asm
EXTRA_DIST += modules/objfmts/bin/tests/reserve.hex
EXTRA_DIST += modules/objfmts/bin/tests/reserve.errwarn
-EXTRA_DIST += modules/objfmts/bin/tests/reserve-err.asm
-EXTRA_DIST += modules/objfmts/bin/tests/reserve-err.errwarn
EXTRA_DIST += modules/objfmts/bin/tests/shr.asm
EXTRA_DIST += modules/objfmts/bin/tests/shr.hex