widl: parser_error must append a newline, so write a new function, error_loc.
This commit is contained in:
parent
a79ec597f4
commit
9051918976
|
@ -113,14 +113,14 @@ UUID *parse_uuid(const char *u)
|
||||||
yy_pop_state();
|
yy_pop_state();
|
||||||
lineno = (int)strtol(yytext, &cptr, 10);
|
lineno = (int)strtol(yytext, &cptr, 10);
|
||||||
if(!lineno)
|
if(!lineno)
|
||||||
parser_error("Malformed '#...' line-directive; invalid linenumber\n");
|
error_loc("Malformed '#...' line-directive; invalid linenumber\n");
|
||||||
fname = strchr(cptr, '"');
|
fname = strchr(cptr, '"');
|
||||||
if(!fname)
|
if(!fname)
|
||||||
parser_error("Malformed '#...' line-directive; missing filename\n");
|
error_loc("Malformed '#...' line-directive; missing filename\n");
|
||||||
fname++;
|
fname++;
|
||||||
cptr = strchr(fname, '"');
|
cptr = strchr(fname, '"');
|
||||||
if(!cptr)
|
if(!cptr)
|
||||||
parser_error("Malformed '#...' line-directive; missing terminating \"");
|
error_loc("Malformed '#...' line-directive; missing terminating \"\n");
|
||||||
*cptr = '\0';
|
*cptr = '\0';
|
||||||
line_number = lineno - 1; /* We didn't read the newline */
|
line_number = lineno - 1; /* We didn't read the newline */
|
||||||
free( input_name );
|
free( input_name );
|
||||||
|
@ -414,7 +414,7 @@ int do_import(char *fname)
|
||||||
first_import = import;
|
first_import = import;
|
||||||
|
|
||||||
if (!(path = wpp_find_include( fname, input_name )))
|
if (!(path = wpp_find_include( fname, input_name )))
|
||||||
parser_error("Unable to open include file %s\n", fname);
|
error_loc("Unable to open include file %s\n", fname);
|
||||||
|
|
||||||
import_stack[ptr].temp_name = temp_name;
|
import_stack[ptr].temp_name = temp_name;
|
||||||
import_stack[ptr].input_name = input_name;
|
import_stack[ptr].input_name = input_name;
|
||||||
|
@ -427,7 +427,7 @@ int do_import(char *fname)
|
||||||
if (ret) exit(1);
|
if (ret) exit(1);
|
||||||
|
|
||||||
if((f = fopen(temp_name, "r")) == NULL)
|
if((f = fopen(temp_name, "r")) == NULL)
|
||||||
parser_error("Unable to open %s\n", temp_name);
|
error_loc("Unable to open %s\n", temp_name);
|
||||||
|
|
||||||
import_stack[ptr].state = YY_CURRENT_BUFFER;
|
import_stack[ptr].state = YY_CURRENT_BUFFER;
|
||||||
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
|
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
|
||||||
|
|
|
@ -509,7 +509,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
||||||
gen_stub(iface, cur, cname, *proc_offset);
|
gen_stub(iface, cur, cname, *proc_offset);
|
||||||
*proc_offset += get_size_procformatstring_func( cur );
|
*proc_offset += get_size_procformatstring_func( cur );
|
||||||
if (midx == -1) midx = idx;
|
if (midx == -1) midx = idx;
|
||||||
else if (midx != idx) parser_error("method index mismatch in write_proxy\n");
|
else if (midx != idx) error("method index mismatch in write_proxy\n");
|
||||||
midx++;
|
midx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,14 +65,25 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* yyerror: yacc assumes this is not newline terminated. */
|
||||||
int parser_error(const char *s, ...)
|
int parser_error(const char *s, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, s);
|
||||||
|
generic_msg(s, "Error", parser_text, ap);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
va_end(ap);
|
||||||
|
exit(1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_loc(const char *s, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, s);
|
va_start(ap, s);
|
||||||
generic_msg(s, "Error", parser_text, ap);
|
generic_msg(s, "Error", parser_text, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
exit(1);
|
exit(1);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int parser_warning(const char *s, ...)
|
int parser_warning(const char *s, ...)
|
||||||
|
|
|
@ -35,6 +35,7 @@ char *xstrdup(const char *str);
|
||||||
|
|
||||||
int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
|
void error_loc(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||||
|
|
Loading…
Reference in New Issue