dfilter: Disable flex debug trace for release builds

This omits the flex debug code in the binary if the build type is
RelMinSize or Release.

It replaces the "%option debug" stanza with the -d command line
option, to be able to configure the flex behaviour.
This commit is contained in:
João Valverde 2023-01-09 02:08:43 +00:00
parent 65ce33b5d7
commit 613331f07b
3 changed files with 6 additions and 11 deletions

View File

@ -34,7 +34,7 @@ MACRO(ADD_LEX_FILES _source _generated)
ADD_CUSTOM_COMMAND(
OUTPUT ${_outc} ${_outh}
COMMAND ${LEX_EXECUTABLE} -o${_outc} --header-file=${_outh} ${_in}
COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> -o${_outc} --header-file=${_outh} ${_in}
DEPENDS ${_in}
)
LIST(APPEND ${_source} ${_in})

View File

@ -425,16 +425,16 @@ dfilter_compile_real(const gchar *text, dfilter_t **dfp,
df_yyset_extra(&state, scanner);
#ifdef NDEBUG
if (flags & DF_DEBUG_FLEX || flags & DF_DEBUG_LEMON) {
ws_message("Compile Wireshark without NDEBUG to enable Flex and/or Lemon debug traces");
}
#else
/* Enable/disable debugging for Flex. */
df_yyset_debug(flags & DF_DEBUG_FLEX, scanner);
#ifndef NDEBUG
/* Enable/disable debugging for Lemon. */
DfilterTrace(flags & DF_DEBUG_LEMON ? stderr : NULL, "lemon> ");
#else
if (flags & DF_DEBUG_LEMON) {
ws_message("Compile Wireshark without NDEBUG to enable Lemon debug traces");
}
#endif
while (1) {

View File

@ -20,11 +20,6 @@
*/
%option warn
/*
* Generate debug code (output is off by default for reentrant scanners).
*/
%option debug
/*
* We want a reentrant scanner.
*/