[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 08/22] tools/utils: Bison: switch from name-prefix to api.prefix
bison -Wall declares %name-prefix deprecated. The suggested replacement is "api.prefix". "api.prefix" though effects rather a lot more places than %name-prefix does. As a result, rename YYLTYPE/YYSTYPE to match. As a quick workaround #define YYLTYPE/YYSTYPE to convince flex to interface correctly. Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx> --- According to the documentation api.prefix was introduced in Bison 2.6, while braces became recommended with Bison 3.0. This seems sufficiently in the past to be worth adopting now. A better workaround for flex is needed. --- tools/libs/util/libxlu_cfg.c | 9 +++++---- tools/libs/util/libxlu_cfg_y.y | 13 +++++++++---- tools/libs/util/libxlu_internal.h | 8 ++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/libs/util/libxlu_cfg.c b/tools/libs/util/libxlu_cfg.c index 7e9eec550d..20534343f4 100644 --- a/tools/libs/util/libxlu_cfg.c +++ b/tools/libs/util/libxlu_cfg.c @@ -388,7 +388,7 @@ const char *xlu_cfg_get_listitem(const XLU_ConfigList *list, int entry) { XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx, char *atom, - YYLTYPE *loc) + XLU__CFG_YYLTYPE *loc) { XLU_ConfigValue *value = NULL; @@ -412,7 +412,7 @@ XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx, char *atom, XLU_ConfigValue *xlu__cfg_list_mk(CfgParseContext *ctx, XLU_ConfigValue *val, - YYLTYPE *loc) + XLU__CFG_YYLTYPE *loc) { XLU_ConfigValue *value = NULL; XLU_ConfigValue **values = NULL; @@ -667,13 +667,14 @@ char *xlu__cfgl_dequote(CfgParseContext *ctx, const char *src) { } void xlu__cfgl_lexicalerror(CfgParseContext *ctx, char const *msg) { - YYLTYPE loc; + XLU__CFG_YYLTYPE loc; loc.first_line= xlu__cfg_yyget_lineno(ctx->scanner); xlu__cfg_yyerror(&loc, ctx, msg); ctx->lexerrlineno= loc.first_line; } -void xlu__cfg_yyerror(YYLTYPE *loc, CfgParseContext *ctx, char const *msg) { +void xlu__cfg_yyerror(XLU__CFG_YYLTYPE *loc, CfgParseContext *ctx, + char const *msg) { const char *text, *newline; int len, lineno; diff --git a/tools/libs/util/libxlu_cfg_y.y b/tools/libs/util/libxlu_cfg_y.y index e796066941..adbb74ff11 100644 --- a/tools/libs/util/libxlu_cfg_y.y +++ b/tools/libs/util/libxlu_cfg_y.y @@ -26,10 +26,10 @@ void xlu__cfg_set_store(CfgParseContext*, char *name, enum XLU_Operation op, XLU_ConfigValue *val, int lineno); XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx, - char *atom, YYLTYPE *loc); + char *atom, XLU__CFG_YYLTYPE *loc); XLU_ConfigValue *xlu__cfg_list_mk(CfgParseContext *ctx, XLU_ConfigValue *val, - YYLTYPE *loc); + XLU__CFG_YYLTYPE *loc); void xlu__cfg_list_append(CfgParseContext *ctx, XLU_ConfigValue *list, XLU_ConfigValue *val); @@ -37,10 +37,15 @@ void xlu__cfg_value_free(XLU_ConfigValue *value); char *xlu__cfgl_strdup(CfgParseContext*, const char *src); char *xlu__cfgl_dequote(CfgParseContext*, const char *src); -void xlu__cfg_yyerror(YYLTYPE *locp, CfgParseContext*, char const *msg); +void xlu__cfg_yyerror(XLU__CFG_YYLTYPE *locp, CfgParseContext*, + char const *msg); void xlu__cfgl_lexicalerror(CfgParseContext*, char const *msg); void xlu__cfgl_likely_python(CfgParseContext *ctx); + +/* issue of name-prefix versus api.prefix and Flex Bison-bridge */ +#define YYLTYPE XLU__CFG_YYLTYPE +#define YYSTYPE XLU__CFG_YYSTYPE } %{ @@ -58,7 +63,7 @@ void xlu__cfgl_likely_python(CfgParseContext *ctx); %define api.pure %defines %define parse.error verbose -%name-prefix "xlu__cfg_yy" +%define api.prefix {xlu__cfg_yy} %parse-param { CfgParseContext *ctx } %lex-param { ctx_scanner } diff --git a/tools/libs/util/libxlu_internal.h b/tools/libs/util/libxlu_internal.h index 1f7559ecd9..01fe073069 100644 --- a/tools/libs/util/libxlu_internal.h +++ b/tools/libs/util/libxlu_internal.h @@ -31,14 +31,14 @@ struct XLU_ConfigList { XLU_ConfigValue **values; }; -typedef struct YYLTYPE +typedef struct XLU__CFG_YYLTYPE { int first_line; int first_column; int last_line; int last_column; -} YYLTYPE; -#define YYLTYPE_IS_DECLARED +} XLU__CFG_YYLTYPE; +#define XLU__CFG_YYLTYPE_IS_DECLARED struct XLU_ConfigValue { enum XLU_ConfigValueType type; @@ -46,7 +46,7 @@ struct XLU_ConfigValue { char *string; XLU_ConfigList list; } u; - YYLTYPE loc; + XLU__CFG_YYLTYPE loc; }; typedef struct XLU_ConfigSetting { /* transparent */ -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sigmsg@xxxxxxx PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |