}
else {
- error("Something is wrong!\n");
+ ERROR("Something is wrong!\n");
}
}
{
if (function->fields[function_type] == NULL
|| function->fields[function_type][0] == '\0') {
- error("Model function type not specified for %s", function->fields[function_name]);
+ ERROR("Model function type not specified for %s", function->fields[function_name]);
}
lf_printf(file, "\n");
lf_print_function_type(file, function->fields[function_type], prefix, " ");
{
if (function->fields[function_type] == NULL
|| function->fields[function_type][0] == '\0') {
- error("Model function return type not specified for %s", function->fields[function_name]);
+ ERROR("Model function return type not specified for %s", function->fields[function_name]);
}
else {
lf_printf(file, "\n");
code &= ~generate_with_icache;
break;
default:
- error ("Expecting -Ggen-icache or -Ggen-icache=<N>\n");
+ ERROR ("Expecting -Ggen-icache or -Ggen-icache=<N>\n");
}
}
break;
real_file_name = NULL;
break;
default:
- error("unknown option\n");
+ ERROR("unknown option\n");
}
}
return 0;
{
cache_table *rules;
if (argc != 3)
- error("Usage: cache <cache-file> <hi-bit-nr>\n");
+ ERROR("Usage: cache <cache-file> <hi-bit-nr>\n");
rules = load_cache_table(argv[1], a2i(argv[2]));
dump_cache_rules(rules, 0);
return 0;
{
decode_table *rules;
if (argc != 3)
- error("Usage: decode <decode-file> <hi-bit-nr>\n");
+ ERROR("Usage: decode <decode-file> <hi-bit-nr>\n");
rules = load_decode_table(argv[1], a2i(argv[2]));
dump_decode_rules(rules, 0);
return 0;
/* sanity check */
if (!isdigit(*chp)) {
- error("%s:%d: missing position field at `%s'\n",
+ ERROR("%s:%d: missing position field at `%s'\n",
entry->file_name, entry->line_nr, chp);
}
if (*chp == '.' && strlen_pos > 0)
chp++;
else {
- error("%s:%d: missing field value at %s\n",
+ ERROR("%s:%d: missing field value at %s\n",
entry->file_name, entry->line_nr, chp);
break;
}
if (*chp == ',')
chp++;
else if (*chp != '\0' || strlen_val == 0) {
- error("%s:%d: missing field terminator at %s\n",
+ ERROR("%s:%d: missing field terminator at %s\n",
entry->file_name, entry->line_nr, chp);
break;
}
{
/* parse the include file_entry */
if (file_entry->nr_fields < 4)
- error ("Incorrect nr fields for include record\n");
+ ERROR ("Incorrect nr fields for include record\n");
/* process it */
if (!is_filtered_out(file_entry->fields[include_flags], filters))
{
}
if (!model_ptr)
- error("%s:%d: machine model `%s' was not known about\n",
+ ERROR("%s:%d: machine model `%s' was not known about\n",
file_entry->file_name, file_entry->line_nr, name);
}
curr_opcode->boolean_constant = rule->special_constant;
break;
default:
- error("Something is going wrong\n");
+ ERROR("Something is going wrong\n");
}
return curr_opcode;
cache_table *cache_rules = NULL;
if (argc != 5)
- error("Usage: insn <filter> <hi-bit-nr> <decode-table> <insn-table>\n");
+ ERROR("Usage: insn <filter> <hi-bit-nr> <decode-table> <insn-table>\n");
filters = new_filter(argv[1], filters);
hi_bit_nr = a2i(argv[2]);
chp++;
}
if (in_bit_field)
- error("bit field paren miss match some where\n");
+ ERROR("bit field paren miss match some where\n");
if (*chp == '\n') {
nr += lf_putchr(file, '\n');
chp++;
#include <string.h>
void
-error (const char *msg, ...)
+error (const void *line, const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
{
void *memory = malloc(size);
if (memory == NULL)
- error("zalloc failed\n");
+ ERROR("zalloc failed\n");
memset(memory, 0, size);
return memory;
}
if (curr->i >= 0)
return curr->i;
else
- error("%s contains no valid names\n", names);
+ ERROR("%s contains no valid names\n", names);
return 0;
}
return map->name;
map++;
}
- error("map lookup failed for %d\n", i);
+ ERROR("map lookup failed for %d\n", i);
return NULL;
}
#include "ansidecl.h"
#include "filter_host.h"
-extern void error (const char *msg, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+extern void error (const void *line, const char *msg, ...)
+ ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
+
+#define ERROR(EXPRESSION, args...) \
+ error (NULL, EXPRESSION, ## args)
#define ASSERT(EXPRESSION) \
do { \
/* free (dup_name); */
if (include->next == NULL)
{
- error ("Problem opening file `%s'\n", file_name);
+ ERROR ("Problem opening file `%s'\n", file_name);
perror (file_name);
exit (1);
}