aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c114
1 files changed, 55 insertions, 59 deletions
diff --git a/gas/read.c b/gas/read.c
index 0e04fcb..ca76af7 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -764,19 +764,19 @@ assemble_one (char *line)
/* Make sure this hasn't pushed the locked sequence
past the bundle size. */
valueT bundle_size = pending_bundle_size (bundle_lock_frag);
- if (bundle_size > 1U << bundle_align_p2)
+ if (bundle_size > (valueT) 1 << bundle_align_p2)
as_bad (_ (".bundle_lock sequence at %" PRIu64 " bytes, "
- "but .bundle_align_mode limit is %u bytes"),
- (uint64_t) bundle_size, 1U << bundle_align_p2);
+ "but .bundle_align_mode limit is %" PRIu64 " bytes"),
+ (uint64_t) bundle_size, (uint64_t) 1 << bundle_align_p2);
}
else if (bundle_align_p2 > 0)
{
valueT insn_size = pending_bundle_size (insn_start_frag);
- if (insn_size > 1U << bundle_align_p2)
+ if (insn_size > (valueT) 1 << bundle_align_p2)
as_bad (_("single instruction is %" PRIu64 " bytes long, "
- "but .bundle_align_mode limit is %u bytes"),
- (uint64_t) insn_size, 1U << bundle_align_p2);
+ "but .bundle_align_mode limit is %" PRIu64 " bytes"),
+ (uint64_t) insn_size, (uint64_t) 1 << bundle_align_p2);
finish_bundle (insn_start_frag, insn_size);
}
@@ -1235,7 +1235,7 @@ read_a_source_file (const char *name)
|| pop->poc_handler == s_globl
|| pop->poc_handler == s_ignore)))
{
- do_align (1, (char *) NULL, 0, 0);
+ do_align (1, NULL, 0, 0);
mri_pending_align = 0;
if (line_label != NULL)
@@ -1296,7 +1296,7 @@ read_a_source_file (const char *name)
if (mri_pending_align)
{
- do_align (1, (char *) NULL, 0, 0);
+ do_align (1, NULL, 0, 0);
mri_pending_align = 0;
if (line_label != NULL)
{
@@ -1623,7 +1623,7 @@ s_align (signed int arg, int bytes_p)
{
if (arg < 0)
as_warn (_("expected fill pattern missing"));
- do_align (align, (char *) NULL, 0, max);
+ do_align (align, NULL, 0, max);
}
else
{
@@ -1856,7 +1856,7 @@ s_comm_internal (int param,
symbolP = (*comm_parse_extra) (param, symbolP, size);
else
{
- S_SET_VALUE (symbolP, (valueT) size);
+ S_SET_VALUE (symbolP, size);
S_SET_EXTERNAL (symbolP);
S_SET_SEGMENT (symbolP, bfd_com_section_ptr);
}
@@ -1993,7 +1993,7 @@ s_data (int ignore ATTRIBUTE_UNUSED)
else
section = data_section;
- subseg_set (section, (subsegT) temp);
+ subseg_set (section, temp);
demand_empty_rest_of_line ();
}
@@ -2248,7 +2248,7 @@ static struct deferred_diag {
unsigned int lineno;
bool err;
expressionS exp;
-} *deferred_diags, *last_deferred_diag;
+} *deferred_diag_head, **deferred_diag_tail = &deferred_diag_head;
static void
s_errwarn_if (int err)
@@ -2260,17 +2260,15 @@ s_errwarn_if (int err)
if (errcnt != had_errors ())
{
ignore_rest_of_line ();
+ free (diag);
return;
}
diag->err = err;
diag->file = as_where (&diag->lineno);
diag->next = NULL;
- if ( deferred_diags == NULL )
- deferred_diags = diag;
- else
- last_deferred_diag->next = diag;
- last_deferred_diag = diag;
+ *deferred_diag_tail = diag;
+ deferred_diag_tail = &diag->next;
demand_empty_rest_of_line ();
}
@@ -2280,20 +2278,23 @@ evaluate_deferred_diags (void)
{
struct deferred_diag *diag;
- for (diag = deferred_diags; diag != NULL; diag = diag->next)
+ while ((diag = deferred_diag_head) != NULL)
{
if (!resolve_expression (&diag->exp) || diag->exp.X_op != O_constant)
as_warn_where (diag->file, diag->lineno,
_("expression does not evaluate to a constant"));
else if (diag->exp.X_add_number == 0)
- continue;
+ ;
else if (diag->err)
as_bad_where (diag->file, diag->lineno,
_(".errif expression evaluates to true"));
else
as_warn_where (diag->file, diag->lineno,
_(".warnif expression evaluates to true"));
+ deferred_diag_head = diag->next;
+ free (diag);
}
+ deferred_diag_tail = &deferred_diag_head;
}
/* Handle the MRI fail pseudo-op. */
@@ -2395,10 +2396,8 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
if (rep_exp.X_op == O_constant)
{
- p = frag_var (rs_fill, (int) size, (int) size,
- (relax_substateT) 0, (symbolS *) 0,
- (offsetT) rep_exp.X_add_number,
- (char *) 0);
+ p = frag_var (rs_fill, size, size, 0, NULL,
+ rep_exp.X_add_number, NULL);
}
else
{
@@ -2422,11 +2421,10 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
rep_sym = make_expr_symbol (&rep_exp);
}
- p = frag_var (rs_space, (int) size, (int) size,
- (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
+ p = frag_var (rs_space, size, size, 0, rep_sym, 0, NULL);
}
- memset (p, 0, (unsigned int) size);
+ memset (p, 0, size);
/* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
flavoured AS. The following bizarre behaviour is to be
@@ -2437,7 +2435,7 @@ s_fill (int ignore ATTRIBUTE_UNUSED)
md_number_to_chars (p, fill,
(size > BSD_FILL_SIZE_CROCK_4
? BSD_FILL_SIZE_CROCK_4
- : (int) size));
+ : size));
/* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
but emits no error message because it seems a legal thing to do.
It is a degenerate case of .fill but could be emitted by a
@@ -2763,7 +2761,7 @@ s_lsym (int ignore ATTRIBUTE_UNUSED)
(exp.X_op == O_constant
? absolute_section
: reg_section));
- S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
+ S_SET_VALUE (symbolP, exp.X_add_number);
}
else
{
@@ -2972,7 +2970,7 @@ do_org (segT segment, expressionS *exp, int fill)
off = 0;
}
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
+ p = frag_var (rs_org, 1, 1, 0, sym, off, NULL);
*p = fill;
}
}
@@ -3177,7 +3175,7 @@ s_rept (int expand_count)
{
size_t count;
- count = (size_t) get_absolute_expression ();
+ count = get_absolute_expression ();
do_repeat (count, "REPT", "ENDR", expand_count ? "" : NULL);
}
@@ -3485,7 +3483,7 @@ s_space (int mult)
}
else
{
- do_align (1, (char *) NULL, 0, 0);
+ do_align (1, NULL, 0, 0);
if (line_label != NULL)
{
symbol_set_frag (line_label, frag_now);
@@ -3591,8 +3589,7 @@ s_space (int mult)
}
if (!need_pass_2)
- p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
- (offsetT) total, (char *) 0);
+ p = frag_var (rs_fill, 1, 1, 0, NULL, total, NULL);
}
else
{
@@ -3609,8 +3606,7 @@ s_space (int mult)
}
if (!need_pass_2)
- p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
- make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
+ p = frag_var (rs_space, 1, 1, 0, make_expr_symbol (&exp), 0, NULL);
}
if ((val.X_op != O_constant || val.X_add_number != 0) && in_bss ())
@@ -3900,7 +3896,7 @@ s_float_space (int float_type)
char *p;
p = frag_more (flen);
- memcpy (p, temp, (unsigned int) flen);
+ memcpy (p, temp, flen);
}
demand_empty_rest_of_line ();
@@ -3938,7 +3934,7 @@ s_text (int ignore ATTRIBUTE_UNUSED)
int temp;
temp = get_absolute_expression ();
- subseg_set (text_section, (subsegT) temp);
+ subseg_set (text_section, temp);
demand_empty_rest_of_line ();
}
@@ -4336,7 +4332,7 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */
#ifdef TC_M68K
if (flag_m68k_mri)
- parse_mri_cons (&exp, (unsigned int) nbytes);
+ parse_mri_cons (&exp, nbytes);
else
#endif
{
@@ -4348,7 +4344,7 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */
return;
}
#endif
- ret = TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+ ret = TC_PARSE_CONS_EXPRESSION (&exp, nbytes);
}
if (rva)
@@ -4358,7 +4354,7 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */
else
as_fatal (_("rva without symbol"));
}
- emit_expr_with_reloc (&exp, (unsigned int) nbytes, ret);
+ emit_expr_with_reloc (&exp, nbytes, ret);
#ifdef TC_CONS_FIX_CHECK
TC_CONS_FIX_CHECK (&exp, nbytes, *cur_fix);
#endif
@@ -4564,7 +4560,7 @@ emit_expr_with_reloc (expressionS *exp,
&& nbytes == 2
&& exp->X_op == O_constant
&& (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
- listing_source_line ((unsigned int) dwarf_line);
+ listing_source_line (dwarf_line);
else if (nbytes == 4
&& exp->X_op == O_constant
&& exp->X_add_number >= 0)
@@ -4641,7 +4637,7 @@ emit_expr_with_reloc (expressionS *exp,
/* We can ignore any carry out, because it will be handled by
extra_digit if it is needed. */
- extra_digit = (valueT) -1;
+ extra_digit = -1;
op = O_big;
}
@@ -4677,7 +4673,7 @@ emit_expr_with_reloc (expressionS *exp,
as_bad (_("attempt to store non-zero value in section `%s'"),
segment_name (now_seg));
- p = frag_more ((int) nbytes);
+ p = frag_more (nbytes);
if (reloc != TC_PARSE_CONS_RETURN_NONE)
{
@@ -4754,7 +4750,7 @@ emit_expr_with_reloc (expressionS *exp,
(uint64_t) get, (uint64_t) use);
}
/* Put bytes in right order. */
- md_number_to_chars (p, use, (int) nbytes);
+ md_number_to_chars (p, use, nbytes);
}
else if (op == O_big)
{
@@ -4803,7 +4799,7 @@ emit_expr_with_reloc (expressionS *exp,
if (nbytes == 1)
{
- md_number_to_chars (p, (valueT) generic_bignum[0], 1);
+ md_number_to_chars (p, generic_bignum[0], 1);
return;
}
know (nbytes % CHARS_PER_LITTLENUM == 0);
@@ -4821,7 +4817,7 @@ emit_expr_with_reloc (expressionS *exp,
while (size >= CHARS_PER_LITTLENUM)
{
--nums;
- md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
+ md_number_to_chars (p, *nums, CHARS_PER_LITTLENUM);
size -= CHARS_PER_LITTLENUM;
p += CHARS_PER_LITTLENUM;
}
@@ -4831,7 +4827,7 @@ emit_expr_with_reloc (expressionS *exp,
nums = generic_bignum;
while (size >= CHARS_PER_LITTLENUM)
{
- md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
+ md_number_to_chars (p, *nums, CHARS_PER_LITTLENUM);
++nums;
size -= CHARS_PER_LITTLENUM;
p += CHARS_PER_LITTLENUM;
@@ -5163,7 +5159,7 @@ float_cons (/* Clobbers input_line-pointer, checks end-of-line. */
while (--count >= 0)
{
p = frag_more (length);
- memcpy (p, temp, (unsigned int) length);
+ memcpy (p, temp, length);
}
}
SKIP_WHITESPACE ();
@@ -5233,7 +5229,7 @@ unsigned int
sizeof_leb128 (valueT value, int sign)
{
if (sign)
- return sizeof_sleb128 ((offsetT) value);
+ return sizeof_sleb128 (value);
else
return sizeof_uleb128 (value);
}
@@ -5292,7 +5288,7 @@ unsigned int
output_leb128 (char *p, valueT value, int sign)
{
if (sign)
- return output_sleb128 (p, (offsetT) value);
+ return output_sleb128 (p, value);
else
return output_uleb128 (p, value);
}
@@ -5458,7 +5454,7 @@ emit_leb128_expr (expressionS *exp, int sign)
/* Let check_eh_frame know that data is being emitted. nbytes == -1 is
a signal that this is leb128 data. It shouldn't optimize this away. */
- nbytes = (unsigned int) -1;
+ nbytes = -1u;
if (check_eh_frame (exp, &nbytes))
abort ();
@@ -5506,7 +5502,7 @@ emit_leb128_expr (expressionS *exp, int sign)
resolve things later. */
frag_var (rs_leb128, sizeof_uleb128 (~(valueT) 0), 0, sign,
- make_expr_symbol (exp), 0, (char *) NULL);
+ make_expr_symbol (exp), 0, NULL);
}
}
@@ -6298,7 +6294,7 @@ char /* Return terminator. */
get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */)
{
/* FIXME: val_pointer should probably be offsetT *. */
- *val_pointer = (long) get_absolute_expression ();
+ *val_pointer = get_absolute_expression ();
return (*input_line_pointer++);
}
@@ -6353,7 +6349,7 @@ demand_copy_string (int *lenP)
/* JF this next line is so demand_copy_C_string will return a
null terminated string. */
obstack_1grow (&notes, '\0');
- retval = (char *) obstack_finish (&notes);
+ retval = obstack_finish (&notes);
}
else
{
@@ -6362,7 +6358,7 @@ demand_copy_string (int *lenP)
ignore_rest_of_line ();
}
*lenP = len;
- return (retval);
+ return retval;
}
/* In: Input_line_pointer->next character.
@@ -6572,7 +6568,7 @@ s_include (int arg ATTRIBUTE_UNUSED)
}
obstack_1grow (&notes, '\0');
- filename = (char *) obstack_finish (&notes);
+ filename = obstack_finish (&notes);
while (!is_end_of_stmt (*input_line_pointer))
++input_line_pointer;
}
@@ -6790,10 +6786,10 @@ s_bundle_unlock (int arg ATTRIBUTE_UNUSED)
size = pending_bundle_size (bundle_lock_frag);
- if (size > 1U << bundle_align_p2)
+ if (size > (valueT) 1 << bundle_align_p2)
as_bad (_(".bundle_lock sequence is %" PRIu64 " bytes, "
- "but bundle size is only %u bytes"),
- (uint64_t) size, 1u << bundle_align_p2);
+ "but bundle size is only %" PRIu64 " bytes"),
+ (uint64_t) size, (uint64_t) 1 << bundle_align_p2);
else
finish_bundle (bundle_lock_frag, size);