static void as_internal_value_out_of_range (char * prefix, offsetT val, offsetT min, offsetT max, char * file, unsigned line, int bad) { const char * err; if (prefix == NULL) prefix = ""; #ifdef BFD_ASSEMBLER if ( val < HEX_MAX_THRESHOLD && min < HEX_MAX_THRESHOLD && max < HEX_MAX_THRESHOLD && val > HEX_MIN_THRESHOLD && min > HEX_MIN_THRESHOLD && max > HEX_MIN_THRESHOLD) #endif { /* xgettext:c-format */ err = _("%s out of range (%d is not between %d and %d)"); if (bad) as_bad_where (file, line, err, prefix, (int) val, (int) min, (int) max); else as_warn_where (file, line, err, prefix, (int) val, (int) min, (int) max); } #ifdef BFD_ASSEMBLER else { char val_buf [sizeof (val) * 3 + 2]; char min_buf [sizeof (val) * 3 + 2]; char max_buf [sizeof (val) * 3 + 2]; if (sizeof (val) > sizeof (bfd_vma)) abort (); sprintf_vma (val_buf, val); sprintf_vma (min_buf, min); sprintf_vma (max_buf, max); /* xgettext:c-format. */ err = _("%s out of range (0x%s is not between 0x%s and 0x%s)"); if (bad) as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf); else as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf); } #endif }
static void as_internal_value_out_of_range (char * prefix, offsetT val, offsetT min, offsetT max, char * file, unsigned line, int bad) { const char * err; if (prefix == NULL) prefix = ""; if (val >= min && val <= max) { addressT right = max & -max; if (max <= 1) abort (); /* xgettext:c-format */ err = _("%s out of domain (%d is not a multiple of %d)"); if (bad) as_bad_where (file, line, err, prefix, (int) val, (int) right); else as_warn_where (file, line, err, prefix, (int) val, (int) right); return; } if ( val < HEX_MAX_THRESHOLD && min < HEX_MAX_THRESHOLD && max < HEX_MAX_THRESHOLD && val > HEX_MIN_THRESHOLD && min > HEX_MIN_THRESHOLD && max > HEX_MIN_THRESHOLD) { /* xgettext:c-format */ err = _("%s out of range (%d is not between %d and %d)"); if (bad) as_bad_where (file, line, err, prefix, (int) val, (int) min, (int) max); else as_warn_where (file, line, err, prefix, (int) val, (int) min, (int) max); } else { char val_buf [sizeof (val) * 3 + 2]; char min_buf [sizeof (val) * 3 + 2]; char max_buf [sizeof (val) * 3 + 2]; if (sizeof (val) > sizeof (bfd_vma)) abort (); sprintf_vma (val_buf, (bfd_vma) val); sprintf_vma (min_buf, (bfd_vma) min); sprintf_vma (max_buf, (bfd_vma) max); /* xgettext:c-format. */ err = _("%s out of range (0x%s is not between 0x%s and 0x%s)"); if (bad) as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf); else as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf); } }
static int do_formals (macro_entry *macro, int idx, sb *in) { formal_entry **p = ¯o->formals; const char *name; idx = sb_skip_white (idx, in); while (idx < in->len) { formal_entry *formal = new_formal (); int cidx; idx = get_token (idx, in, &formal->name); if (formal->name.len == 0) { if (macro->formal_count) --idx; break; } idx = sb_skip_white (idx, in); /* This is a formal. */ name = sb_terminate (&formal->name); if (! macro_mri && idx < in->len && in->ptr[idx] == ':' && (! is_name_beginner (':') || idx + 1 >= in->len || ! is_part_of_name (in->ptr[idx + 1]))) { /* Got a qualifier. */ sb qual; sb_new (&qual); idx = get_token (sb_skip_white (idx + 1, in), in, &qual); sb_terminate (&qual); if (qual.len == 0) as_bad_where (macro->file, macro->line, _("Missing parameter qualifier for `%s' in macro `%s'"), name, macro->name); else if (strcmp (qual.ptr, "req") == 0) formal->type = FORMAL_REQUIRED; else if (strcmp (qual.ptr, "vararg") == 0) formal->type = FORMAL_VARARG; else as_bad_where (macro->file, macro->line, _("`%s' is not a valid parameter qualifier for `%s' in macro `%s'"), qual.ptr, name, macro->name); sb_kill (&qual); idx = sb_skip_white (idx, in); } if (idx < in->len && in->ptr[idx] == '=') { /* Got a default. */ idx = get_any_string (idx + 1, in, &formal->def); idx = sb_skip_white (idx, in); if (formal->type == FORMAL_REQUIRED) { sb_reset (&formal->def); as_warn_where (macro->file, macro->line, _("Pointless default value for required parameter `%s' in macro `%s'"), name, macro->name); } } /* Add to macro's hash table. */ if (! hash_find (macro->formal_hash, name)) hash_jam (macro->formal_hash, name, formal); else as_bad_where (macro->file, macro->line, _("A parameter named `%s' already exists for macro `%s'"), name, macro->name); formal->index = macro->formal_count++; *p = formal; p = &formal->next; if (formal->type == FORMAL_VARARG) break; cidx = idx; idx = sb_skip_comma (idx, in); if (idx != cidx && idx >= in->len) { idx = cidx; break; } } if (macro_mri) { formal_entry *formal = new_formal (); /* Add a special NARG formal, which macro_expand will set to the number of arguments. */ /* The same MRI assemblers which treat '@' characters also use the name $NARG. At least until we find an exception. */ if (macro_strip_at) name = "$NARG"; else name = "NARG"; sb_add_string (&formal->name, name); /* Add to macro's hash table. */ if (hash_find (macro->formal_hash, name)) as_bad_where (macro->file, macro->line, _("Reserved word `%s' used as parameter in macro `%s'"), name, macro->name); hash_jam (macro->formal_hash, name, formal); formal->index = NARG_INDEX; *p = formal; } return idx; }