Cleanup the lexor state information when done parsing.
This patch frees the lexor buffers when we are done parsing the input file.
This commit is contained in:
parent
c6336d621e
commit
eddfa12569
|
|
@ -264,3 +264,18 @@ int yywrap()
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Modern version of flex (>=2.5.9) can clean up the scanner data.
|
||||
*/
|
||||
void destroy_lexor()
|
||||
{
|
||||
# ifdef FLEX_SCANNER
|
||||
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
|
||||
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
|
||||
yylex_destroy();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -342,8 +342,9 @@ int main(int argc, char*argv[])
|
|||
for (unsigned idx = 0 ; idx < module_cnt ; idx += 1)
|
||||
vpip_load_module(module_tab[idx]);
|
||||
|
||||
if (int rc = compile_design(design_path))
|
||||
return rc;
|
||||
int ret_cd = compile_design(design_path);
|
||||
destroy_lexor();
|
||||
if (ret_cd) return ret_cd;
|
||||
|
||||
if (!have_ivl_version) {
|
||||
if (verbose_flag) vpi_mcd_printf(1, "... ");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __parse_misc_H
|
||||
#define __parse_misc_H
|
||||
/*
|
||||
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -39,6 +39,8 @@ extern void verify_version(char *ivl_ver, char* commit);
|
|||
extern int yylex(void);
|
||||
extern void yyerror(const char*msg);
|
||||
|
||||
extern void destroy_lexor();
|
||||
|
||||
/*
|
||||
* This is the path of the current source file.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue