Browse Source

ERROR messages should be printed to stderr.

pre-master-46
Brian Taylor 3 years ago
committed by Holger Vogt
parent
commit
dcfe4e7134
  1. 28
      src/frontend/logicexp.c
  2. 12
      src/frontend/udevices.c

28
src/frontend/logicexp.c

@ -643,7 +643,7 @@ static char *get_inverter_output_name(char *input)
// FIX ME keep this name in the symbol table to ensure uniqueness // FIX ME keep this name in the symbol table to ensure uniqueness
(void) sprintf(buf, "inv_out__%s", input); (void) sprintf(buf, "inv_out__%s", input);
if (member_sym_tab(buf, lx->lexer_sym_tab)) if (member_sym_tab(buf, lx->lexer_sym_tab))
printf("ERROR %s is already in use\n", buf);
fprintf(stderr, "ERROR %s is already in use\n", buf);
return buf; return buf;
} }
@ -1465,7 +1465,7 @@ static BOOL bparse(char *line, BOOL new_lexer)
if (last_count == 1) { if (last_count == 1) {
ret_val = gen_gates(gen_tab, parse_lexer->lexer_sym_tab); ret_val = gen_gates(gen_tab, parse_lexer->lexer_sym_tab);
if (!ret_val) { if (!ret_val) {
printf("ERROR generating gates for logicexp\n");
fprintf(stderr, "ERROR generating gates for logicexp\n");
} }
} else if (last_count > 1) { } else if (last_count > 1) {
opt_tab1 = optimize_gen_tab(gen_tab); opt_tab1 = optimize_gen_tab(gen_tab);
@ -1494,7 +1494,7 @@ static BOOL bparse(char *line, BOOL new_lexer)
if (opt_tab2) { if (opt_tab2) {
ret_val = gen_gates(opt_tab2, parse_lexer->lexer_sym_tab); ret_val = gen_gates(opt_tab2, parse_lexer->lexer_sym_tab);
if (!ret_val) { if (!ret_val) {
printf(
fprintf(stderr,
"ERROR generating gates for logicexp\n"); "ERROR generating gates for logicexp\n");
} }
delete_parse_table(opt_tab2); delete_parse_table(opt_tab2);
@ -1541,7 +1541,7 @@ static BOOL expect_token(
{ {
if (tok != expected_tok) { if (tok != expected_tok) {
if (msg) { if (msg) {
printf(
fprintf(stderr,
"ERROR expect_token failed tok %d expected_tok %d loc %d\n", "ERROR expect_token failed tok %d expected_tok %d loc %d\n",
tok, expected_tok, loc); tok, expected_tok, loc);
} }
@ -1554,7 +1554,7 @@ static BOOL expect_token(
return TRUE; return TRUE;
else { else {
if (msg) { if (msg) {
printf(
fprintf(stderr,
"ERROR expect_token failed lexer_buf %s expected_str %s loc %d\n", "ERROR expect_token failed lexer_buf %s expected_str %s loc %d\n",
lx->lexer_buf, expected_str, loc); lx->lexer_buf, expected_str, loc);
} }
@ -1589,7 +1589,7 @@ BOOL f_logicexp(char *line)
if (lex_all_digits(parse_lexer->lexer_buf)) { if (lex_all_digits(parse_lexer->lexer_buf)) {
num_ins = (int) strtol(parse_lexer->lexer_buf, &endp, 10); num_ins = (int) strtol(parse_lexer->lexer_buf, &endp, 10);
} else { } else {
printf("ERROR logicexp input count is not an integer\n");
fprintf(stderr, "ERROR logicexp input count is not an integer\n");
goto error_return; goto error_return;
} }
t = lex_scan(); t = lex_scan();
@ -1599,7 +1599,7 @@ BOOL f_logicexp(char *line)
if (lex_all_digits(parse_lexer->lexer_buf)) { if (lex_all_digits(parse_lexer->lexer_buf)) {
num_outs = (int) strtol(parse_lexer->lexer_buf, &endp, 10); num_outs = (int) strtol(parse_lexer->lexer_buf, &endp, 10);
} else { } else {
printf("ERROR logicexp output count is not an integer\n");
fprintf(stderr, "ERROR logicexp output count is not an integer\n");
goto error_return; goto error_return;
} }
t = lex_scan(); t = lex_scan();
@ -1648,8 +1648,8 @@ BOOL f_logicexp(char *line)
current_lexer = NULL; current_lexer = NULL;
if (!ret_val) { if (!ret_val) {
printf("ERROR parsing logicexp\n");
printf("ERROR in \"%s\"\n", line);
fprintf(stderr, "ERROR parsing logicexp\n");
fprintf(stderr, "ERROR in \"%s\"\n", line);
cleanup_parser(); cleanup_parser();
} }
return ret_val; return ret_val;
@ -2205,7 +2205,7 @@ BOOL f_pindly(char *line)
if (lex_all_digits(lxr->lexer_buf)) { if (lex_all_digits(lxr->lexer_buf)) {
num_ios = (int) strtol(lxr->lexer_buf, &endp, 10); num_ios = (int) strtol(lxr->lexer_buf, &endp, 10);
} else { } else {
printf("ERROR pindly io count is not an integer\n");
fprintf(stderr, "ERROR pindly io count is not an integer\n");
goto error_return; goto error_return;
} }
@ -2217,7 +2217,7 @@ BOOL f_pindly(char *line)
if (lex_all_digits(lxr->lexer_buf)) { if (lex_all_digits(lxr->lexer_buf)) {
num_ena = (int) strtol(lxr->lexer_buf, &endp, 10); num_ena = (int) strtol(lxr->lexer_buf, &endp, 10);
} else { } else {
printf("ERROR pindly enable count is not an integer\n");
fprintf(stderr, "ERROR pindly enable count is not an integer\n");
goto error_return; goto error_return;
} }
@ -2229,7 +2229,7 @@ BOOL f_pindly(char *line)
if (lex_all_digits(lxr->lexer_buf)) { if (lex_all_digits(lxr->lexer_buf)) {
num_refs = (int) strtol(lxr->lexer_buf, &endp, 10); num_refs = (int) strtol(lxr->lexer_buf, &endp, 10);
} else { } else {
printf("ERROR pindly refs count is not an integer\n");
fprintf(stderr, "ERROR pindly refs count is not an integer\n");
goto error_return; goto error_return;
} }
@ -2268,8 +2268,8 @@ BOOL f_pindly(char *line)
} }
if (!new_gen_output_models(lxr)) { if (!new_gen_output_models(lxr)) {
printf("ERROR generating models for pindly\n");
printf("ERROR in \"%s\"\n", line);
fprintf(stderr, "ERROR generating models for pindly\n");
fprintf(stderr, "ERROR in \"%s\"\n", line);
goto error_return;; goto error_return;;
} }
gen_pindly_buffers(); gen_pindly_buffers();

12
src/frontend/udevices.c

@ -314,7 +314,7 @@ static unsigned int subckt_msg_count = 0;
static void check_name_unused(char *name) static void check_name_unused(char *name)
{ {
if (find_name_entry(name, new_names_list)) { if (find_name_entry(name, new_names_list)) {
printf("ERROR udevice name %s already used\n", name);
fprintf(stderr, "ERROR udevice name %s already used\n", name);
num_name_collisions++; num_name_collisions++;
} else { } else {
if (!new_names_list) { if (!new_names_list) {
@ -329,7 +329,7 @@ static void find_collision(char *name, NAME_ENTRY nelist)
{ {
if (!nelist) { return; } if (!nelist) { return; }
if (find_name_entry(name, nelist)) { if (find_name_entry(name, nelist)) {
printf("ERROR name collision: internal node %s "
fprintf(stderr, "ERROR name collision: internal node %s "
"collides with a pin or port\n", name); "collides with a pin or port\n", name);
num_name_collisions++; num_name_collisions++;
} }
@ -3634,7 +3634,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr); delete_instance_hdr(hdr);
behav_ret = f_logicexp(nline); behav_ret = f_logicexp(nline);
if (!behav_ret && current_subckt) { if (!behav_ret && current_subckt) {
printf("ERROR in %s\n", current_subckt);
fprintf(stderr, "ERROR in %s\n", current_subckt);
} }
if (!behav_ret && ps_udevice_exit) { if (!behav_ret && ps_udevice_exit) {
fprintf(stderr, "ERROR bad syntax in logicexp\n"); fprintf(stderr, "ERROR bad syntax in logicexp\n");
@ -3646,7 +3646,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr); delete_instance_hdr(hdr);
behav_ret = f_pindly(nline); behav_ret = f_pindly(nline);
if (!behav_ret && current_subckt) { if (!behav_ret && current_subckt) {
printf("ERROR in %s\n", current_subckt);
fprintf(stderr, "ERROR in %s\n", current_subckt);
} }
if (!behav_ret && ps_udevice_exit) { if (!behav_ret && ps_udevice_exit) {
fprintf(stderr, "ERROR bad syntax in pindly\n"); fprintf(stderr, "ERROR bad syntax in pindly\n");
@ -3682,7 +3682,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr); delete_instance_hdr(hdr);
if (ps_udevice_exit) { if (ps_udevice_exit) {
if (current_subckt) { if (current_subckt) {
printf("ERROR in %s\n", current_subckt);
fprintf(stderr, "ERROR in %s\n", current_subckt);
} }
fprintf(stderr, "ERROR unknown U* device\n"); fprintf(stderr, "ERROR unknown U* device\n");
fflush(stdout); fflush(stdout);
@ -3697,7 +3697,7 @@ BOOL u_process_instance(char *nline)
} else { } else {
if (ps_udevice_exit) { if (ps_udevice_exit) {
if (current_subckt) { if (current_subckt) {
printf("ERROR in %s\n", current_subckt);
fprintf(stderr, "ERROR in %s\n", current_subckt);
} }
fprintf(stderr, "ERROR U* device syntax error\n"); fprintf(stderr, "ERROR U* device syntax error\n");
fflush(stdout); fflush(stdout);

Loading…
Cancel
Save