Mesa (master): Avoid more warnings in flex-generated code.

Carl Worth cworth at kemper.freedesktop.org
Wed Jul 21 20:29:40 UTC 2010


Module: Mesa
Branch: master
Commit: b4a08a0d87908b024a3d2595073b1beb6eda161e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4a08a0d87908b024a3d2595073b1beb6eda161e

Author: Carl Worth <cworth at cworth.org>
Date:   Wed Jul 21 13:11:46 2010 -0700

Avoid more warnings in flex-generated code.

This avoids two "function defined but not used" warnings. For the yyinput
function we define YY_NO_INPUT which tells flex to simply not generate this
function.

For unput, we add a call to this function, but inside a while(0) so
that it will quiet the warning without actually changing any
functionality.

---

 src/mesa/program/program_lexer.l |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
index a912517..0a50dab 100644
--- a/src/mesa/program/program_lexer.l
+++ b/src/mesa/program/program_lexer.l
@@ -139,6 +139,13 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
       }									\
    } while(0);
 
+#define YY_NO_INPUT
+
+/* Yes, this is intentionally doing nothing. We have this line of code
+here only to avoid the compiler complaining about an unput function
+that is defined, but never called. */
+#define YY_USER_INIT while (0) { unput(0); }
+
 #define YY_EXTRA_TYPE struct asm_parser_state *
 
 /* Flex defines a couple of functions with no declarations nor the




More information about the mesa-commit mailing list