[Flex-help] Does YY_FATAL_ERROR require a call to exit?
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Albert C. <ch...@ll...> - 2012-04-13 18:34:54
|
Hi, I maintain a library that uses flex to parse some input queries from a user. In the event of a memory allocation or other major issue in this library, an appropriate error code is passed back up to the caller/user. Unknown to me until recently, generated code in flex can fatally call exit() on a memory allocation error (and it seems other major issues). It's through the yy_fatal_error() function and the YY_FATAL_ERROR macro. While the YY_FATAL_ERROR macro can be redefined, it seems that it is always assumed it will call exit()? At the minimum, it seems YY_FATAL_ERROR is called by multiple functions w/ different return types. So I don't think I can change YY_FATAL_ERROR() to error out cleanly by return some standard return code. We'd prefer to pass an error up the caller/user like usual, but can't seem to find a way. I imagine this has been solved before, but am failing to see it and searching the web doesn't seem to offer me a solution. Does anyone have any suggestions for dealing with this? Thanks, Al -- Albert Chu ch...@ll... Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory |