Files
xen/tools/libxl/libxlu_cfg_l.l
T
Ian Jackson 8188bc8a37 tools/libxl: compile with -Wmissing-declarations
Since the recent build error caused by mismatch of symbol types due to
missing declarations, build libxl with -Wmissing-declarations.

The patch is mostly straightforward, a one liner in the makefile enables
the flag, a lot of functions in xl_cmdimpl.c needed to be made static
and libxl_paths.c needed to include libxl.h.

The one wart on the patch-set is that flex has a bug where it emits code
with missing declarations for yy(set|get)_column.  This can be worked
around by providing the declarations ourselves regardless.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-17 17:20:53 +01:00

82 lines
2.2 KiB
Plaintext

/* -*- fundamental -*- */
%{
#include "libxlu_cfg_i.h"
#define ctx ((CfgParseContext*)yyextra)
#define YY_NO_INPUT
#define GOT(x) do{ \
yylloc->first_line= yylineno; \
return (x); \
}while(0)
/* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
* it to fail to declare these functions, which it defines. So declare
* them ourselves. Hopefully we won't have to simultaneously support
* a flex version which declares these differently somehow. */
int xlu__cfg_yyget_column(yyscan_t yyscanner);
void xlu__cfg_yyset_column(int column_no, yyscan_t yyscanner);
%}
%option warn
%option nodefault
%option batch
%option 8bit
%option yylineno
%option noyywrap
%option bison-bridge
%option bison-locations
%option reentrant
%option prefix="xlu__cfg_yy"
%option nounput
%x lexerr
%%
[a-z][_0-9a-z]* {
yylval->string= xlu__cfgl_strdup(ctx,yytext);
GOT(IDENT);
}
[0-9][0-9a-fx]* {
yylval->string= xlu__cfgl_strdup(ctx,yytext);
GOT(NUMBER);
}
[ \t]
, { GOT(','); }
\[ { GOT('['); }
\] { GOT(']'); }
\= { GOT('='); }
\; { GOT(';'); }
\n|\#.*\n { yylloc->first_line= yylineno-1; return NEWLINE; }
\'([^\'\\\n]|\\.)*\' {
yylval->string= xlu__cfgl_dequote(ctx,yytext);
GOT(STRING);
}
\"([^\"\\\n]|\\.)*\" {
yylval->string= xlu__cfgl_dequote(ctx,yytext);
GOT(STRING);
}
. {
BEGIN(lexerr);
yymore();
}
<lexerr>[^ \t\n]*|[ \t] {
xlu__cfgl_lexicalerror(ctx,"lexical error");
BEGIN(0);
}
<lexerr>\n {
xlu__cfgl_lexicalerror(ctx,"lexical error");
BEGIN(0);
GOT(NEWLINE);
}