widl: Always close parsed input file.
Fixes a regression from 9d537999e3
, which removed closing the file.
This causes Windows widl build to be to remove the temporary file on exit.
This commit is contained in:
parent
6ce8a31b0b
commit
3b12583db0
4 changed files with 15 additions and 8 deletions
|
@ -42,5 +42,6 @@ int is_warning_enabled(int warning);
|
|||
|
||||
extern char *find_input_file( const char *name, const char *parent );
|
||||
extern FILE *open_input_file( const char *path );
|
||||
extern void close_all_inputs(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -481,10 +481,11 @@ static void print_imports(void)
|
|||
fprintf( stderr, "%s:%d:\n", state->input_name, state->where.first_line );
|
||||
}
|
||||
|
||||
void pop_import( struct location *where )
|
||||
struct location pop_import(void)
|
||||
{
|
||||
struct list *entry = list_head( &import_stack );
|
||||
struct import_state *state;
|
||||
struct location where;
|
||||
assert( entry );
|
||||
|
||||
state = LIST_ENTRY( entry, struct import_state, entry );
|
||||
|
@ -496,8 +497,9 @@ void pop_import( struct location *where )
|
|||
yy_switch_to_buffer( state->buffer );
|
||||
|
||||
input_name = state->input_name;
|
||||
*where = state->where;
|
||||
where = state->where;
|
||||
free( state );
|
||||
return where;
|
||||
}
|
||||
|
||||
void push_import( const char *import_name, struct location *where )
|
||||
|
@ -547,6 +549,12 @@ static void switch_to_acf(void)
|
|||
yy_switch_to_buffer( yy_create_buffer( file, YY_BUF_SIZE ) );
|
||||
}
|
||||
|
||||
void close_all_inputs(void)
|
||||
{
|
||||
while (!list_empty( &import_stack )) pop_import();
|
||||
if (yyin) fclose( yyin );
|
||||
}
|
||||
|
||||
static void reset_location( struct location *where, const char *input_name )
|
||||
{
|
||||
where->first_line = 1;
|
||||
|
|
|
@ -118,7 +118,7 @@ static typelib_t *current_typelib;
|
|||
|
||||
int parser_lex( PARSER_STYPE *yylval, PARSER_LTYPE *yylloc );
|
||||
void push_import( const char *fname, PARSER_LTYPE *yylloc );
|
||||
void pop_import( PARSER_LTYPE *yylloc );
|
||||
PARSER_LTYPE pop_import(void);
|
||||
|
||||
# define YYLLOC_DEFAULT( cur, rhs, n ) \
|
||||
do { if (n) init_location( &(cur), &YYRHSLOC( rhs, 1 ), &YYRHSLOC( rhs, n ) ); \
|
||||
|
@ -515,7 +515,7 @@ cppquote: tCPPQUOTE '(' aSTRING ')' { $$ = $3; }
|
|||
|
||||
import_start: tIMPORT aSTRING ';' { $$ = $2; push_import( $2, &yylloc ); }
|
||||
;
|
||||
import: import_start imp_statements aEOF { pop_import( &yylloc ); }
|
||||
import: import_start imp_statements aEOF { yyloc = pop_import(); }
|
||||
;
|
||||
|
||||
importlib: tIMPORTLIB '(' aSTRING ')'
|
||||
|
|
|
@ -843,10 +843,8 @@ int main(int argc,char *argv[])
|
|||
|
||||
init_types();
|
||||
ret = parser_parse();
|
||||
|
||||
if(ret) {
|
||||
exit(1);
|
||||
}
|
||||
close_all_inputs();
|
||||
if (ret) exit(1);
|
||||
|
||||
/* Everything has been done successfully, don't delete any files. */
|
||||
set_everything(FALSE);
|
||||
|
|
Loading…
Add table
Reference in a new issue