From 085e1760d47f2fb824e1393d21d39bffcb702af1 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 31 Dec 2007 03:39:06 +0000 Subject: [PATCH] Add --nounput if Flex supports the --noFUNCTION options, as at least some versions that support those options don't support disabling yyunput by defining YY_NO_UNPUT. If it doesn't support those options, don't check if it supports generating reentrant scanners, as we can't add any --noFUNCTION options to suppress generation of functions. --- runlex.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/runlex.sh b/runlex.sh index e9eb836..68ece7c 100755 --- a/runlex.sh +++ b/runlex.sh @@ -7,7 +7,7 @@ # means that neither Flex nor Lex was found, so we report an error and # quit. # -# @(#) $Header: /tcpdump/master/libpcap/runlex.sh,v 1.1.2.3 2007-12-31 02:40:58 guy Exp $ +# @(#) $Header: /tcpdump/master/libpcap/runlex.sh,v 1.1.2.4 2007-12-31 03:39:06 guy Exp $ # # @@ -75,16 +75,28 @@ then have_flex=yes # - # Does it support -R, for generating reentrant scanners? - # If so, we're not currently using that feature, but - # it'll generate some unused functions anyway - and there - # won't be any header file declaring them, so there'll be - # defined-but-not-declared warnings. Therefore, we use - # --noXXXX options to suppress generating those functions. + # Does it support the --noFUNCTION options? If so, we pass + # --nounput, as at least some versions that support those + # options don't support disabling yyunput by defining + # YY_NO_UNPUT. # - if flex --help | egrep reentrant >/dev/null + if flex --help | egrep noFUNCTION >/dev/null then - flags="$flags --noyyget_lineno --noyyget_in --noyyget_out --noyyget_leng --noyyget_text --noyyset_lineno --noyyset_in --noyyset_out" + flags="$flags --nounput" + + # + # Does it support -R, for generating reentrant scanners? + # If so, we're not currently using that feature, but + # it'll generate some unused functions anyway - and there + # won't be any header file declaring them, so there'll be + # defined-but-not-declared warnings. Therefore, we use + # --noFUNCTION options to suppress generating those + # functions. + # + if flex --help | egrep reentrant >/dev/null + then + flags="$flags --noyyget_lineno --noyyget_in --noyyget_out --noyyget_leng --noyyget_text --noyyset_lineno --noyyset_in --noyyset_out" + fi fi else #