ERROR messages should be printed to stderr.

This commit is contained in:
Brian Taylor 2023-01-09 12:23:38 -08:00 committed by Holger Vogt
parent bf580abf69
commit dcfe4e7134
2 changed files with 20 additions and 20 deletions

View File

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

View File

@ -314,7 +314,7 @@ static unsigned int subckt_msg_count = 0;
static void check_name_unused(char *name)
{
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++;
} else {
if (!new_names_list) {
@ -329,7 +329,7 @@ static void find_collision(char *name, NAME_ENTRY nelist)
{
if (!nelist) { return; }
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);
num_name_collisions++;
}
@ -3634,7 +3634,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr);
behav_ret = f_logicexp(nline);
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) {
fprintf(stderr, "ERROR bad syntax in logicexp\n");
@ -3646,7 +3646,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr);
behav_ret = f_pindly(nline);
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) {
fprintf(stderr, "ERROR bad syntax in pindly\n");
@ -3682,7 +3682,7 @@ BOOL u_process_instance(char *nline)
delete_instance_hdr(hdr);
if (ps_udevice_exit) {
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");
fflush(stdout);
@ -3697,7 +3697,7 @@ BOOL u_process_instance(char *nline)
} else {
if (ps_udevice_exit) {
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");
fflush(stdout);